Add wireless AP detect signals

pull/16/head
Timothy Pearson 12 years ago
parent d3cfdd24fa
commit d4745d8893

@ -1136,7 +1136,7 @@ TQString TDENetworkConnectionManager_BackendNM::deviceInterfaceString(TQString m
} }
TDENetworkConnectionManager_BackendNM::TDENetworkConnectionManager_BackendNM(TQString macAddress) : TDENetworkConnectionManager(macAddress) { TDENetworkConnectionManager_BackendNM::TDENetworkConnectionManager_BackendNM(TQString macAddress) : TDENetworkConnectionManager(macAddress) {
d = new TDENetworkConnectionManager_BackendNMPrivate(); d = new TDENetworkConnectionManager_BackendNMPrivate(this);
// Set up proxy interfaces // Set up proxy interfaces
d->m_networkManagerProxy = new DBus::NetworkManagerProxy(NM_DBUS_SERVICE, NM_DBUS_PATH); 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 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 // Connect local signals
if (d->m_networkDeviceProxy) { 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 // Create public lists
@ -1182,14 +1186,30 @@ TDENetworkConnectionManager_BackendNM::~TDENetworkConnectionManager_BackendNM()
delete d; delete d;
} }
void TDENetworkConnectionManager_BackendNM::internalProcessGlobalStateChanged(TQ_UINT32 state) { void TDENetworkConnectionManager_BackendNMPrivate::internalProcessGlobalStateChanged(TQ_UINT32 state) {
internalNetworkConnectionStateChanged(nmGlobalStateToTDEGlobalState(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(oldState)
Q_UNUSED(reason) 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() { TDENetworkDeviceType::TDENetworkDeviceType TDENetworkConnectionManager_BackendNM::deviceType() {

@ -161,8 +161,6 @@ class TDECORE_EXPORT TDENetworkConnectionManager_BackendNM : public TDENetworkCo
virtual bool wiFiEnabled(); virtual bool wiFiEnabled();
private: private:
void internalProcessGlobalStateChanged(TQ_UINT32 state);
void internalProcessDeviceStateChanged(TQ_UINT32 newState, TQ_UINT32 oldState, TQ_UINT32 reason);
TDENetworkDeviceType::TDENetworkDeviceType nmDeviceTypeToTDEDeviceType(TQ_UINT32 nmType); TDENetworkDeviceType::TDENetworkDeviceType nmDeviceTypeToTDEDeviceType(TQ_UINT32 nmType);
TQString deviceInterfaceString(TQString macAddress); TQString deviceInterfaceString(TQString macAddress);
bool loadConnectionSecretsForGroup(TQString uuid, TQString group); bool loadConnectionSecretsForGroup(TQString uuid, TQString group);
@ -171,6 +169,7 @@ class TDECORE_EXPORT TDENetworkConnectionManager_BackendNM : public TDENetworkCo
private: private:
TDENetworkConnectionManager_BackendNMPrivate* d; TDENetworkConnectionManager_BackendNMPrivate* d;
friend class TDENetworkConnectionManager_BackendNMPrivate;
}; };
#endif // _TDENETWORKBACKEND_NETWORKMANAGER_H #endif // _TDENETWORKBACKEND_NETWORKMANAGER_H

@ -63,12 +63,14 @@ typedef TQMap<uint, TQT_DBusObjectPath> NMAddConnectionAsyncResponseMap;
typedef TQValueList<TQT_DBusObjectPath> TQT_DBusObjectPathList; typedef TQValueList<TQT_DBusObjectPath> TQT_DBusObjectPathList;
class TDENetworkConnectionManager_BackendNM;
class TDENetworkConnectionManager_BackendNMPrivate : public TQObject class TDENetworkConnectionManager_BackendNMPrivate : public TQObject
{ {
Q_OBJECT Q_OBJECT
public: 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: public:
DBus::NetworkManagerProxy* m_networkManagerProxy; DBus::NetworkManagerProxy* m_networkManagerProxy;
@ -83,6 +85,14 @@ class TDENetworkConnectionManager_BackendNMPrivate : public TQObject
void processConnectionSettingsAsyncReply(int, const TQT_DBusDataMap<TQString>&); void processConnectionSettingsAsyncReply(int, const TQT_DBusDataMap<TQString>&);
void processConnectionSettingsUpdateAsyncReply(int); void processConnectionSettingsUpdateAsyncReply(int);
void processAddConnectionAsyncReply(int, const TQT_DBusObjectPath&); 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 #endif // _TDENETWORKBACKEND_NETWORKMANAGER_P_H

@ -656,6 +656,20 @@ TDENetworkDevice* TDENetworkConnectionManager::findDeviceByUUID(TQString uuid) {
return NULL; 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() { void TDENetworkConnectionManager::clearTDENetworkConnectionList() {
TDENetworkConnection *connection; TDENetworkConnection *connection;
for (connection = m_connectionList->first(); connection; connection = m_connectionList->next()) { for (connection = m_connectionList->first(); connection; connection = m_connectionList->next()) {
@ -685,6 +699,10 @@ void TDENetworkConnectionManager::internalNetworkDeviceStateChanged(TDENetworkCo
m_prevDeviceStatus[hwAddress] = newState; m_prevDeviceStatus[hwAddress] = newState;
} }
void TDENetworkConnectionManager::internalAccessPointVisibilityChanged(TDEMACAddress BSSID, bool detected) {
emit(accessPointVisibilityChanged(BSSID, detected));
}
/*================================================================================================*/ /*================================================================================================*/
/* TDEGlobalNetworkManager */ /* TDEGlobalNetworkManager */
/*================================================================================================*/ /*================================================================================================*/
@ -790,6 +808,11 @@ TDENetworkDevice* TDEGlobalNetworkManager::findDeviceByUUID(TQString uuid) {
return m_internalConnectionManager->findDeviceByUUID(uuid); return m_internalConnectionManager->findDeviceByUUID(uuid);
} }
TDENetworkWiFiAPInfo* TDEGlobalNetworkManager::findAccessPointByBSSID(TDEMACAddress bssid) {
if (!m_internalConnectionManager) return NULL;
return m_internalConnectionManager->findAccessPointByBSSID(bssid);
}
/*================================================================================================*/ /*================================================================================================*/
/* End */ /* End */
/*================================================================================================*/ /*================================================================================================*/

@ -729,7 +729,7 @@ class TDECORE_EXPORT TDENetworkHWNeighbor
{ {
public: public:
TDENetworkHWNeighbor(); TDENetworkHWNeighbor();
~TDENetworkHWNeighbor(); virtual ~TDENetworkHWNeighbor();
public: public:
bool valid; bool valid;
@ -739,7 +739,7 @@ class TDECORE_EXPORT TDENetworkWiFiAPInfo : public TDENetworkHWNeighbor
{ {
public: public:
TDENetworkWiFiAPInfo(); TDENetworkWiFiAPInfo();
~TDENetworkWiFiAPInfo(); virtual ~TDENetworkWiFiAPInfo();
public: public:
TQByteArray SSID; TQByteArray SSID;
@ -1041,6 +1041,12 @@ class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject
*/ */
void networkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus previousState, TQString hwAddress); 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: public:
/** /**
* @return a TDENetworkConnectionList object containing a list of all * @return a TDENetworkConnectionList object containing a list of all
@ -1073,11 +1079,20 @@ class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject
*/ */
TDENetworkDevice* findDeviceByUUID(TQString uuid); 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: protected:
void clearTDENetworkConnectionList(); void clearTDENetworkConnectionList();
void clearTDENetworkHWNeighborList(); void clearTDENetworkHWNeighborList();
void internalNetworkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState); void internalNetworkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState);
void internalNetworkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TQString hwAddress=TQString::null); void internalNetworkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TQString hwAddress=TQString::null);
void internalAccessPointVisibilityChanged(TDEMACAddress BSSID, bool detected);
protected: protected:
TDENetworkConnectionList* m_connectionList; TDENetworkConnectionList* m_connectionList;
@ -1216,6 +1231,12 @@ class TDECORE_EXPORT TDEGlobalNetworkManager : public TQObject
*/ */
void networkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus previousState, TQString hwAddress); 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: public:
/** /**
* @return a TDENetworkConnectionList object containing a list of all * @return a TDENetworkConnectionList object containing a list of all
@ -1248,6 +1269,14 @@ class TDECORE_EXPORT TDEGlobalNetworkManager : public TQObject
*/ */
TDENetworkDevice* findDeviceByUUID(TQString uuid); 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: private:
TDENetworkConnectionManager* m_internalConnectionManager; TDENetworkConnectionManager* m_internalConnectionManager;
}; };

Loading…
Cancel
Save