summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-09-06 10:37:40 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-09-06 10:37:40 -0500
commit6dbc7e595089ebd914c46e1def17ac1c90903594 (patch)
tree6d946e528ffcc2a3bec34db32180fdbe17e9da8e
parent0216dae757a1ae8e4971b00b0c79fbafb33bbd57 (diff)
downloadtdelibs-6dbc7e59.tar.gz
tdelibs-6dbc7e59.zip
Add new convenience functions to network manager
-rw-r--r--tdecore/tdenetworkconnections.cpp79
-rw-r--r--tdecore/tdenetworkconnections.h16
2 files changed, 91 insertions, 4 deletions
diff --git a/tdecore/tdenetworkconnections.cpp b/tdecore/tdenetworkconnections.cpp
index 2e35cb6c8..fa5405bd4 100644
--- a/tdecore/tdenetworkconnections.cpp
+++ b/tdecore/tdenetworkconnections.cpp
@@ -476,7 +476,7 @@ TDENetworkWiFiAPInfo::~TDENetworkWiFiAPInfo() {
//
}
-TQString TDENetworkWiFiAPInfo::friendlySSID() {
+TQString TDENetworkWiFiAPInfo::friendlySSID() const {
TQString ret;
ret = TQString(SSID);
@@ -504,8 +504,41 @@ TDENetworkConnection::~TDENetworkConnection() {
//
}
+TDENetworkConnectionType::TDENetworkConnectionType TDENetworkConnection::type() {
+ if (dynamic_cast<TDEWiredEthernetConnection*>(this)) {
+ return TDENetworkConnectionType::WiredEthernet;
+ }
+ else if (dynamic_cast<TDEWiredInfinibandConnection*>(this)) {
+ return TDENetworkConnectionType::Infiniband;
+ }
+ else if (dynamic_cast<TDEVPNConnection*>(this)) {
+ return TDENetworkConnectionType::VPN;
+ }
+ else if (dynamic_cast<TDEWiMaxConnection*>(this)) {
+ return TDENetworkConnectionType::WiMax;
+ }
+ else if (dynamic_cast<TDEVLANConnection*>(this)) {
+ return TDENetworkConnectionType::VLAN;
+ }
+ else if (dynamic_cast<TDEOLPCMeshConnection*>(this)) {
+ return TDENetworkConnectionType::OLPCMesh;
+ }
+ else if (dynamic_cast<TDEBluetoothConnection*>(this)) {
+ return TDENetworkConnectionType::Bluetooth;
+ }
+ else if (dynamic_cast<TDEModemConnection*>(this)) {
+ return TDENetworkConnectionType::Modem;
+ }
+ else if (dynamic_cast<TDEWiFiConnection*>(this)) {
+ return TDENetworkConnectionType::WiFi;
+ }
+ else {
+ return TDENetworkConnectionType::Other;
+ }
+}
+
/*================================================================================================*/
-/* TDEWiredEthernetConnection */
+/* TDEWiredEthernetConnection */
/*================================================================================================*/
TDEWiredEthernetConnection::TDEWiredEthernetConnection() : TDENetworkConnection() {
@@ -687,6 +720,48 @@ TDENetworkWiFiAPInfo* TDENetworkConnectionManager::findAccessPointByBSSID(TDEMAC
return NULL;
}
+TQString TDENetworkConnectionManager::friendlyConnectionTypeName(TDENetworkConnectionType::TDENetworkConnectionType type) {
+ if (type == TDENetworkConnectionType::WiredEthernet) {
+ return i18n("Wired Ethernet");
+ }
+ else if (type == TDENetworkConnectionType::WiFi) {
+ return i18n("802.11 WiFi");
+ }
+ else if (type == TDENetworkConnectionType::Bluetooth) {
+ return i18n("Bluetooth");
+ }
+ else if (type == TDENetworkConnectionType::OLPCMesh) {
+ return i18n("OLPC Mesh");
+ }
+ else if (type == TDENetworkConnectionType::WiMax) {
+ return i18n("WiMax");
+ }
+ else if (type == TDENetworkConnectionType::Modem) {
+ return i18n("Cellular Modem");
+ }
+ else if (type == TDENetworkConnectionType::Infiniband) {
+ return i18n("Infiniband");
+ }
+ else if (type == TDENetworkConnectionType::Bond) {
+ return i18n("Bond");
+ }
+ else if (type == TDENetworkConnectionType::VLAN) {
+ return i18n("Virtual LAN");
+ }
+ else if (type == TDENetworkConnectionType::ADSL) {
+ return i18n("ADSL");
+ }
+ else if (type == TDENetworkConnectionType::VPN) {
+ return i18n("Virtual Private Network");
+ }
+ else if (type == TDENetworkConnectionType::Other) {
+ return i18n("Other");
+ }
+ else {
+ return TQString::null;
+ }
+}
+
void TDENetworkConnectionManager::clearTDENetworkConnectionList() {
TDENetworkConnection *connection;
for (connection = m_connectionList->first(); connection; connection = m_connectionList->next()) {
diff --git a/tdecore/tdenetworkconnections.h b/tdecore/tdenetworkconnections.h
index 3bff2e5db..181abd29f 100644
--- a/tdecore/tdenetworkconnections.h
+++ b/tdecore/tdenetworkconnections.h
@@ -246,7 +246,9 @@ namespace TDENetworkWiFiAPFlags {
GroupTKIP = 0x00000080,
GroupCCMP = 0x00000100,
KeyManagementPSK = 0x00000200,
- KeyManagement80211 = 0x00000400
+ KeyManagement80211 = 0x00000400,
+ GeneralFlagsMask = 0x00000001,
+ EncryptionFlagsMask = 0xfffffffe
};
CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkWiFiAPFlags)
@@ -752,7 +754,7 @@ class TDECORE_EXPORT TDENetworkWiFiAPInfo : public TDENetworkHWNeighbor
virtual ~TDENetworkWiFiAPInfo();
public:
- TQString friendlySSID();
+ TQString friendlySSID() const;
public:
TQByteArray SSID;
@@ -773,6 +775,9 @@ class TDECORE_EXPORT TDENetworkConnection
virtual ~TDENetworkConnection();
public:
+ TDENetworkConnectionType::TDENetworkConnectionType type();
+
+ public:
TQString UUID;
TQString friendlyName;
TDENetworkIPConfiguration ipConfig;
@@ -978,6 +983,8 @@ class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject
* Initiates a connection with UUID @param uuid.
* @return A TDENetworkConnectionStatus enum value with the current connection status
* The client application should poll for status updates using checkConnectionStatus()
+ * Note that if this manager's type is not TDENetworkDeviceType::BackendOnly, the connection
+ * will be initiated on the internal device specified when this object was created
*/
virtual TDENetworkConnectionStatus::TDENetworkConnectionStatus initiateConnection(TQString uuid) = 0;
@@ -1100,6 +1107,11 @@ class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject
*/
TDENetworkWiFiAPInfo* findAccessPointByBSSID(TDEMACAddress bssid);
+ /**
+ * @return a string containing the friendly name of the connection type @param type given
+ */
+ static TQString friendlyConnectionTypeName(TDENetworkConnectionType::TDENetworkConnectionType type);
+
protected:
void clearTDENetworkConnectionList();
void clearTDENetworkHWNeighborList();