|
|
|
@ -48,7 +48,7 @@ class WirelessNetworkPrivate
|
|
|
|
|
bool active;
|
|
|
|
|
|
|
|
|
|
TQ_UINT32 match;
|
|
|
|
|
TQValueList<const TDENetworkWiFiAPInfo*> aps;
|
|
|
|
|
TQMap<TDEMACAddress,TQString> aps;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
WirelessNetwork::WirelessNetwork(const WirelessNetwork& other)
|
|
|
|
@ -71,15 +71,35 @@ WirelessNetwork::~WirelessNetwork()
|
|
|
|
|
|
|
|
|
|
WirelessNetwork& WirelessNetwork::operator= (const WirelessNetwork& other)
|
|
|
|
|
{
|
|
|
|
|
if (d)
|
|
|
|
|
if (d) {
|
|
|
|
|
delete d;
|
|
|
|
|
}
|
|
|
|
|
d = new WirelessNetworkPrivate(*other.d);
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool WirelessNetwork::contains (const TDENetworkWiFiAPInfo * const ap)
|
|
|
|
|
bool WirelessNetwork::contains(const TDEMACAddress ap)
|
|
|
|
|
{
|
|
|
|
|
if ( (d->match & MATCH_SSID) && getSsid() != ap->SSID) {
|
|
|
|
|
TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices();
|
|
|
|
|
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
|
|
|
|
|
|
|
|
|
|
TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(d->aps[ap]));
|
|
|
|
|
TDENetworkWiFiAPInfo* apInfo = NULL;
|
|
|
|
|
if (dev) {
|
|
|
|
|
TDENetworkConnectionManager* deviceConnMan = dev->connectionManager();
|
|
|
|
|
apInfo = deviceConnMan->findAccessPointByBSSID(ap);
|
|
|
|
|
}
|
|
|
|
|
else if (d->aps[ap] == "") {
|
|
|
|
|
apInfo = nm->findAccessPointByBSSID(ap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (apInfo) {
|
|
|
|
|
if ( (d->match & MATCH_SSID) && (getSsid() != apInfo->SSID)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// AP was not found in list
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -87,10 +107,10 @@ bool WirelessNetwork::contains (const TDENetworkWiFiAPInfo * const ap)
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool WirelessNetwork::addAP(const TDENetworkWiFiAPInfo * const ap)
|
|
|
|
|
bool WirelessNetwork::addAP(const TDEMACAddress ap, const TQString dev)
|
|
|
|
|
{
|
|
|
|
|
if ( this->contains( ap ) || d->aps.isEmpty()) {
|
|
|
|
|
d->aps.append(ap);
|
|
|
|
|
if ( this->contains(ap) || d->aps.isEmpty()) {
|
|
|
|
|
d->aps[ap] = dev;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
@ -98,8 +118,26 @@ bool WirelessNetwork::addAP(const TDENetworkWiFiAPInfo * const ap)
|
|
|
|
|
|
|
|
|
|
const TQByteArray WirelessNetwork::getSsid() const
|
|
|
|
|
{
|
|
|
|
|
TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices();
|
|
|
|
|
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
|
|
|
|
|
|
|
|
|
|
if ( !d->aps.isEmpty() ) {
|
|
|
|
|
return (*(d->aps.begin()))->SSID;
|
|
|
|
|
TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(d->aps.begin().data()));
|
|
|
|
|
TDENetworkWiFiAPInfo* apInfo = NULL;
|
|
|
|
|
if (dev) {
|
|
|
|
|
TDENetworkConnectionManager* deviceConnMan = dev->connectionManager();
|
|
|
|
|
apInfo = deviceConnMan->findAccessPointByBSSID(d->aps.begin().key());
|
|
|
|
|
}
|
|
|
|
|
else if (d->aps.begin().data() == "") {
|
|
|
|
|
apInfo = nm->findAccessPointByBSSID(d->aps.begin().key());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (apInfo) {
|
|
|
|
|
return apInfo->SSID;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return TQByteArray();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return TQByteArray();
|
|
|
|
@ -108,8 +146,26 @@ const TQByteArray WirelessNetwork::getSsid() const
|
|
|
|
|
|
|
|
|
|
TQString WirelessNetwork::getDisplaySsid() const
|
|
|
|
|
{
|
|
|
|
|
TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices();
|
|
|
|
|
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
|
|
|
|
|
|
|
|
|
|
if (!d->aps.isEmpty()) {
|
|
|
|
|
return (*(d->aps.begin()))->friendlySSID();
|
|
|
|
|
TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(d->aps.begin().data()));
|
|
|
|
|
TDENetworkWiFiAPInfo* apInfo = NULL;
|
|
|
|
|
if (dev) {
|
|
|
|
|
TDENetworkConnectionManager* deviceConnMan = dev->connectionManager();
|
|
|
|
|
apInfo = deviceConnMan->findAccessPointByBSSID(d->aps.begin().key());
|
|
|
|
|
}
|
|
|
|
|
else if (d->aps.begin().data() == "") {
|
|
|
|
|
apInfo = nm->findAccessPointByBSSID(d->aps.begin().key());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (apInfo) {
|
|
|
|
|
return apInfo->friendlySSID();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return TQString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return TQString();
|
|
|
|
@ -118,30 +174,75 @@ TQString WirelessNetwork::getDisplaySsid() const
|
|
|
|
|
|
|
|
|
|
TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getFlags() const
|
|
|
|
|
{
|
|
|
|
|
TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices();
|
|
|
|
|
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
|
|
|
|
|
|
|
|
|
|
TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None;
|
|
|
|
|
for (TQValueList<const TDENetworkWiFiAPInfo*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) {
|
|
|
|
|
flags |= ((*it)->wpaFlags & TDENetworkWiFiAPFlags::GeneralFlagsMask);
|
|
|
|
|
flags |= ((*it)->rsnFlags & TDENetworkWiFiAPFlags::GeneralFlagsMask);
|
|
|
|
|
for (TQMap<TDEMACAddress,TQString>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) {
|
|
|
|
|
TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(it.data()));
|
|
|
|
|
TDENetworkWiFiAPInfo* apInfo = NULL;
|
|
|
|
|
if (dev) {
|
|
|
|
|
TDENetworkConnectionManager* deviceConnMan = dev->connectionManager();
|
|
|
|
|
apInfo = deviceConnMan->findAccessPointByBSSID(it.key());
|
|
|
|
|
}
|
|
|
|
|
else if (it.data() == "") {
|
|
|
|
|
apInfo = nm->findAccessPointByBSSID(it.key());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (apInfo) {
|
|
|
|
|
flags |= (apInfo->wpaFlags & TDENetworkWiFiAPFlags::GeneralFlagsMask);
|
|
|
|
|
flags |= (apInfo->rsnFlags & TDENetworkWiFiAPFlags::GeneralFlagsMask);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return flags;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getWpaFlags() const
|
|
|
|
|
{
|
|
|
|
|
TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices();
|
|
|
|
|
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
|
|
|
|
|
|
|
|
|
|
TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None;
|
|
|
|
|
for (TQValueList<const TDENetworkWiFiAPInfo*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it)
|
|
|
|
|
for (TQMap<TDEMACAddress,TQString>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it)
|
|
|
|
|
{
|
|
|
|
|
flags |= ((*it)->wpaFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask);
|
|
|
|
|
TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(it.data()));
|
|
|
|
|
TDENetworkWiFiAPInfo* apInfo = NULL;
|
|
|
|
|
if (dev) {
|
|
|
|
|
TDENetworkConnectionManager* deviceConnMan = dev->connectionManager();
|
|
|
|
|
apInfo = deviceConnMan->findAccessPointByBSSID(it.key());
|
|
|
|
|
}
|
|
|
|
|
else if (it.data() == "") {
|
|
|
|
|
apInfo = nm->findAccessPointByBSSID(it.key());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (apInfo) {
|
|
|
|
|
flags |= (apInfo->wpaFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return flags;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getRsnFlags() const
|
|
|
|
|
{
|
|
|
|
|
TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices();
|
|
|
|
|
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
|
|
|
|
|
|
|
|
|
|
TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None;
|
|
|
|
|
for (TQValueList<const TDENetworkWiFiAPInfo*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it)
|
|
|
|
|
for (TQMap<TDEMACAddress,TQString>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it)
|
|
|
|
|
{
|
|
|
|
|
flags |= ((*it)->rsnFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask);
|
|
|
|
|
TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(it.data()));
|
|
|
|
|
TDENetworkWiFiAPInfo* apInfo = NULL;
|
|
|
|
|
if (dev) {
|
|
|
|
|
TDENetworkConnectionManager* deviceConnMan = dev->connectionManager();
|
|
|
|
|
apInfo = deviceConnMan->findAccessPointByBSSID(it.key());
|
|
|
|
|
}
|
|
|
|
|
else if (it.data() == "") {
|
|
|
|
|
apInfo = nm->findAccessPointByBSSID(it.key());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (apInfo) {
|
|
|
|
|
flags |= (apInfo->rsnFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return flags;
|
|
|
|
|
}
|
|
|
|
@ -153,10 +254,25 @@ bool WirelessNetwork::isEncrypted() const
|
|
|
|
|
|
|
|
|
|
TQ_UINT8 WirelessNetwork::getStrength() const
|
|
|
|
|
{
|
|
|
|
|
TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices();
|
|
|
|
|
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
|
|
|
|
|
|
|
|
|
|
TQ_UINT8 strength = 0;
|
|
|
|
|
for (TQValueList<const TDENetworkWiFiAPInfo*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) {
|
|
|
|
|
if (((*it)->signalQuality*100.0) > strength) {
|
|
|
|
|
strength = ((*it)->signalQuality*100.0);
|
|
|
|
|
for (TQMap<TDEMACAddress,TQString>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) {
|
|
|
|
|
TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(it.data()));
|
|
|
|
|
TDENetworkWiFiAPInfo* apInfo = NULL;
|
|
|
|
|
if (dev) {
|
|
|
|
|
TDENetworkConnectionManager* deviceConnMan = dev->connectionManager();
|
|
|
|
|
apInfo = deviceConnMan->findAccessPointByBSSID(it.key());
|
|
|
|
|
}
|
|
|
|
|
else if (it.data() == "") {
|
|
|
|
|
apInfo = nm->findAccessPointByBSSID(it.key());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (apInfo) {
|
|
|
|
|
if ((apInfo->signalQuality*100.0) > strength) {
|
|
|
|
|
strength = (apInfo->signalQuality*100.0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return strength;
|
|
|
|
|