summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tdecore/networkbackends/network-manager/network-manager.cpp34
-rw-r--r--tdecore/networkbackends/network-manager/network-manager.h3
-rw-r--r--tdecore/networkbackends/network-manager/network-manager_p.h12
-rw-r--r--tdecore/tdenetworkconnections.cpp23
-rw-r--r--tdecore/tdenetworkconnections.h33
5 files changed, 93 insertions, 12 deletions
diff --git a/tdecore/networkbackends/network-manager/network-manager.cpp b/tdecore/networkbackends/network-manager/network-manager.cpp
index 9d9d9e740..5cf5f7534 100644
--- a/tdecore/networkbackends/network-manager/network-manager.cpp
+++ b/tdecore/networkbackends/network-manager/network-manager.cpp
@@ -1136,7 +1136,7 @@ TQString TDENetworkConnectionManager_BackendNM::deviceInterfaceString(TQString m
}
TDENetworkConnectionManager_BackendNM::TDENetworkConnectionManager_BackendNM(TQString macAddress) : TDENetworkConnectionManager(macAddress) {
- d = new TDENetworkConnectionManager_BackendNMPrivate();
+ d = new TDENetworkConnectionManager_BackendNMPrivate(this);
// Set up proxy interfaces
d->m_networkManagerProxy = new DBus::NetworkManagerProxy(NM_DBUS_SERVICE, NM_DBUS_PATH);
@@ -1155,11 +1155,15 @@ TDENetworkConnectionManager_BackendNM::TDENetworkConnectionManager_BackendNM(TQS
}
// Connect global signals
- connect(d->m_networkManagerProxy, SIGNAL(StateChanged(TQ_UINT32)), this, SLOT(internalProcessGlobalStateChanged(TQ_UINT32)));
+ connect(d->m_networkManagerProxy, SIGNAL(StateChanged(TQ_UINT32)), d, SLOT(internalProcessGlobalStateChanged(TQ_UINT32)));
// Connect local signals
if (d->m_networkDeviceProxy) {
- connect(d->m_networkDeviceProxy, SIGNAL(StateChanged(TQ_UINT32, TQ_UINT32, TQ_UINT32)), this, SLOT(internalProcessDeviceStateChanged(TQ_UINT32, TQ_UINT32, TQ_UINT32)));
+ connect(d->m_networkDeviceProxy, SIGNAL(StateChanged(TQ_UINT32, TQ_UINT32, TQ_UINT32)), d, SLOT(internalProcessDeviceStateChanged(TQ_UINT32, TQ_UINT32, TQ_UINT32)));
+ }
+ if (d->m_wiFiDeviceProxy) {
+ connect(d->m_wiFiDeviceProxy, SIGNAL(AccessPointAdded(const TQT_DBusObjectPath&)), d, SLOT(internalProcessWiFiAccessPointAdded(const TQT_DBusObjectPath&)));
+ connect(d->m_wiFiDeviceProxy, SIGNAL(AccessPointRemoved(const TQT_DBusObjectPath&)), d, SLOT(internalProcessWiFiAccessPointRemoved(const TQT_DBusObjectPath&)));
}
// Create public lists
@@ -1182,14 +1186,30 @@ TDENetworkConnectionManager_BackendNM::~TDENetworkConnectionManager_BackendNM()
delete d;
}
-void TDENetworkConnectionManager_BackendNM::internalProcessGlobalStateChanged(TQ_UINT32 state) {
- internalNetworkConnectionStateChanged(nmGlobalStateToTDEGlobalState(state));
+void TDENetworkConnectionManager_BackendNMPrivate::internalProcessGlobalStateChanged(TQ_UINT32 state) {
+ m_parent->internalNetworkConnectionStateChanged(nmGlobalStateToTDEGlobalState(state));
}
-void TDENetworkConnectionManager_BackendNM::internalProcessDeviceStateChanged(TQ_UINT32 newState, TQ_UINT32 oldState, TQ_UINT32 reason) {
+void TDENetworkConnectionManager_BackendNMPrivate::internalProcessDeviceStateChanged(TQ_UINT32 newState, TQ_UINT32 oldState, TQ_UINT32 reason) {
Q_UNUSED(oldState)
Q_UNUSED(reason)
- internalNetworkDeviceStateChanged(nmDeviceStateToTDEDeviceState(newState), m_macAddress);
+ m_parent->internalNetworkDeviceStateChanged(nmDeviceStateToTDEDeviceState(newState), m_parent->m_macAddress);
+}
+
+void TDENetworkConnectionManager_BackendNMPrivate::internalProcessWiFiAccessPointAdded(const TQT_DBusObjectPath& dbuspath) {
+ TDENetworkWiFiAPInfo* apInfo = m_parent->getAccessPointDetails(dbuspath);
+ if (apInfo) {
+ m_parent->internalAccessPointVisibilityChanged(apInfo->BSSID, TRUE);
+ delete apInfo;
+ }
+}
+
+void TDENetworkConnectionManager_BackendNMPrivate::internalProcessWiFiAccessPointRemoved(const TQT_DBusObjectPath& dbuspath) {
+ TDENetworkWiFiAPInfo* apInfo = m_parent->getAccessPointDetails(dbuspath);
+ if (apInfo) {
+ m_parent->internalAccessPointVisibilityChanged(apInfo->BSSID, FALSE);
+ delete apInfo;
+ }
}
TDENetworkDeviceType::TDENetworkDeviceType TDENetworkConnectionManager_BackendNM::deviceType() {
diff --git a/tdecore/networkbackends/network-manager/network-manager.h b/tdecore/networkbackends/network-manager/network-manager.h
index 8fa876728..709cd42cf 100644
--- a/tdecore/networkbackends/network-manager/network-manager.h
+++ b/tdecore/networkbackends/network-manager/network-manager.h
@@ -161,8 +161,6 @@ class TDECORE_EXPORT TDENetworkConnectionManager_BackendNM : public TDENetworkCo
virtual bool wiFiEnabled();
private:
- void internalProcessGlobalStateChanged(TQ_UINT32 state);
- void internalProcessDeviceStateChanged(TQ_UINT32 newState, TQ_UINT32 oldState, TQ_UINT32 reason);
TDENetworkDeviceType::TDENetworkDeviceType nmDeviceTypeToTDEDeviceType(TQ_UINT32 nmType);
TQString deviceInterfaceString(TQString macAddress);
bool loadConnectionSecretsForGroup(TQString uuid, TQString group);
@@ -171,6 +169,7 @@ class TDECORE_EXPORT TDENetworkConnectionManager_BackendNM : public TDENetworkCo
private:
TDENetworkConnectionManager_BackendNMPrivate* d;
+ friend class TDENetworkConnectionManager_BackendNMPrivate;
};
#endif // _TDENETWORKBACKEND_NETWORKMANAGER_H \ No newline at end of file
diff --git a/tdecore/networkbackends/network-manager/network-manager_p.h b/tdecore/networkbackends/network-manager/network-manager_p.h
index 88c63a59f..0ead39e3f 100644
--- a/tdecore/networkbackends/network-manager/network-manager_p.h
+++ b/tdecore/networkbackends/network-manager/network-manager_p.h
@@ -63,12 +63,14 @@ typedef TQMap<uint, TQT_DBusObjectPath> NMAddConnectionAsyncResponseMap;
typedef TQValueList<TQT_DBusObjectPath> TQT_DBusObjectPathList;
+class TDENetworkConnectionManager_BackendNM;
+
class TDENetworkConnectionManager_BackendNMPrivate : public TQObject
{
Q_OBJECT
public:
- TDENetworkConnectionManager_BackendNMPrivate() : m_networkManagerProxy(NULL), m_networkManagerSettings(NULL), m_networkDeviceProxy(NULL), m_wiFiDeviceProxy(NULL) {}
+ TDENetworkConnectionManager_BackendNMPrivate(TDENetworkConnectionManager_BackendNM* parent) : m_networkManagerProxy(NULL), m_networkManagerSettings(NULL), m_networkDeviceProxy(NULL), m_wiFiDeviceProxy(NULL), m_parent(parent) {}
public:
DBus::NetworkManagerProxy* m_networkManagerProxy;
@@ -83,6 +85,14 @@ class TDENetworkConnectionManager_BackendNMPrivate : public TQObject
void processConnectionSettingsAsyncReply(int, const TQT_DBusDataMap<TQString>&);
void processConnectionSettingsUpdateAsyncReply(int);
void processAddConnectionAsyncReply(int, const TQT_DBusObjectPath&);
+
+ void internalProcessGlobalStateChanged(TQ_UINT32 state);
+ void internalProcessDeviceStateChanged(TQ_UINT32 newState, TQ_UINT32 oldState, TQ_UINT32 reason);
+ void internalProcessWiFiAccessPointAdded(const TQT_DBusObjectPath&);
+ void internalProcessWiFiAccessPointRemoved(const TQT_DBusObjectPath&);
+
+ private:
+ TDENetworkConnectionManager_BackendNM* m_parent;
};
#endif // _TDENETWORKBACKEND_NETWORKMANAGER_P_H \ No newline at end of file
diff --git a/tdecore/tdenetworkconnections.cpp b/tdecore/tdenetworkconnections.cpp
index d9f4b5d97..cc4c4b94d 100644
--- a/tdecore/tdenetworkconnections.cpp
+++ b/tdecore/tdenetworkconnections.cpp
@@ -656,6 +656,20 @@ TDENetworkDevice* TDENetworkConnectionManager::findDeviceByUUID(TQString uuid) {
return NULL;
}
+TDENetworkWiFiAPInfo* TDENetworkConnectionManager::findAccessPointByBSSID(TDEMACAddress bssid) {
+ TDENetworkHWNeighbor *neighbor;
+ for (neighbor = m_hwNeighborList->first(); neighbor; neighbor = m_hwNeighborList->next()) {
+ TDENetworkWiFiAPInfo* apInfo = dynamic_cast<TDENetworkWiFiAPInfo*>(neighbor);
+ if (!apInfo) {
+ continue;
+ }
+ if (apInfo->BSSID == bssid) {
+ return apInfo;
+ }
+ }
+ return NULL;
+}
+
void TDENetworkConnectionManager::clearTDENetworkConnectionList() {
TDENetworkConnection *connection;
for (connection = m_connectionList->first(); connection; connection = m_connectionList->next()) {
@@ -685,6 +699,10 @@ void TDENetworkConnectionManager::internalNetworkDeviceStateChanged(TDENetworkCo
m_prevDeviceStatus[hwAddress] = newState;
}
+void TDENetworkConnectionManager::internalAccessPointVisibilityChanged(TDEMACAddress BSSID, bool detected) {
+ emit(accessPointVisibilityChanged(BSSID, detected));
+}
+
/*================================================================================================*/
/* TDEGlobalNetworkManager */
/*================================================================================================*/
@@ -790,6 +808,11 @@ TDENetworkDevice* TDEGlobalNetworkManager::findDeviceByUUID(TQString uuid) {
return m_internalConnectionManager->findDeviceByUUID(uuid);
}
+TDENetworkWiFiAPInfo* TDEGlobalNetworkManager::findAccessPointByBSSID(TDEMACAddress bssid) {
+ if (!m_internalConnectionManager) return NULL;
+ return m_internalConnectionManager->findAccessPointByBSSID(bssid);
+}
+
/*================================================================================================*/
/* End */
/*================================================================================================*/
diff --git a/tdecore/tdenetworkconnections.h b/tdecore/tdenetworkconnections.h
index 4afdbc863..fb1079d85 100644
--- a/tdecore/tdenetworkconnections.h
+++ b/tdecore/tdenetworkconnections.h
@@ -729,7 +729,7 @@ class TDECORE_EXPORT TDENetworkHWNeighbor
{
public:
TDENetworkHWNeighbor();
- ~TDENetworkHWNeighbor();
+ virtual ~TDENetworkHWNeighbor();
public:
bool valid;
@@ -739,7 +739,7 @@ class TDECORE_EXPORT TDENetworkWiFiAPInfo : public TDENetworkHWNeighbor
{
public:
TDENetworkWiFiAPInfo();
- ~TDENetworkWiFiAPInfo();
+ virtual ~TDENetworkWiFiAPInfo();
public:
TQByteArray SSID;
@@ -1041,6 +1041,12 @@ class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject
*/
void networkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus previousState, TQString hwAddress);
+ /**
+ * Emitted whenever a wireless access point is detected or lost
+ * If a new access point was detected, @param detected will be set to TRUE, otherwise if lost it will be set to FALSE
+ */
+ void accessPointVisibilityChanged(TDEMACAddress BSSID, bool detected);
+
public:
/**
* @return a TDENetworkConnectionList object containing a list of all
@@ -1073,11 +1079,20 @@ class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject
*/
TDENetworkDevice* findDeviceByUUID(TQString uuid);
+ /**
+ * @return a pointer to a TDENetworkWiFiAPInfo object with the specified @param bssid,
+ * or a NULL pointer if no such access point exists.
+ *
+ * Note that the returned object is internally managed and must not be deleted!
+ */
+ TDENetworkWiFiAPInfo* findAccessPointByBSSID(TDEMACAddress bssid);
+
protected:
void clearTDENetworkConnectionList();
void clearTDENetworkHWNeighborList();
void internalNetworkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState);
void internalNetworkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TQString hwAddress=TQString::null);
+ void internalAccessPointVisibilityChanged(TDEMACAddress BSSID, bool detected);
protected:
TDENetworkConnectionList* m_connectionList;
@@ -1216,6 +1231,12 @@ class TDECORE_EXPORT TDEGlobalNetworkManager : public TQObject
*/
void networkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus previousState, TQString hwAddress);
+ /**
+ * Emitted whenever a wireless access point is detected or lost
+ * If a new access point was detected, @param detected will be set to TRUE, otherwise if lost it will be set to FALSE
+ */
+ void accessPointVisibilityChanged(TDEMACAddress BSSID, bool detected);
+
public:
/**
* @return a TDENetworkConnectionList object containing a list of all
@@ -1248,6 +1269,14 @@ class TDECORE_EXPORT TDEGlobalNetworkManager : public TQObject
*/
TDENetworkDevice* findDeviceByUUID(TQString uuid);
+ /**
+ * @return a pointer to a TDENetworkWiFiAPInfo object with the specified @param bssid,
+ * or a NULL pointer if no such access point exists.
+ *
+ * Note that the returned object is internally managed and must not be deleted!
+ */
+ TDENetworkWiFiAPInfo* findAccessPointByBSSID(TDEMACAddress bssid);
+
private:
TDENetworkConnectionManager* m_internalConnectionManager;
};