|
|
@ -48,7 +48,7 @@ class WirelessNetworkPrivate
|
|
|
|
bool active;
|
|
|
|
bool active;
|
|
|
|
|
|
|
|
|
|
|
|
TQ_UINT32 match;
|
|
|
|
TQ_UINT32 match;
|
|
|
|
TQValueList<const TDENetworkWiFiAPInfo*> aps;
|
|
|
|
TQMap<TDEMACAddress,TQString> aps;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
WirelessNetwork::WirelessNetwork(const WirelessNetwork& other)
|
|
|
|
WirelessNetwork::WirelessNetwork(const WirelessNetwork& other)
|
|
|
@ -71,15 +71,35 @@ WirelessNetwork::~WirelessNetwork()
|
|
|
|
|
|
|
|
|
|
|
|
WirelessNetwork& WirelessNetwork::operator= (const WirelessNetwork& other)
|
|
|
|
WirelessNetwork& WirelessNetwork::operator= (const WirelessNetwork& other)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (d)
|
|
|
|
if (d) {
|
|
|
|
delete d;
|
|
|
|
delete d;
|
|
|
|
|
|
|
|
}
|
|
|
|
d = new WirelessNetworkPrivate(*other.d);
|
|
|
|
d = new WirelessNetworkPrivate(*other.d);
|
|
|
|
return *this;
|
|
|
|
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;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -87,10 +107,10 @@ bool WirelessNetwork::contains (const TDENetworkWiFiAPInfo * const ap)
|
|
|
|
return true;
|
|
|
|
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()) {
|
|
|
|
if ( this->contains(ap) || d->aps.isEmpty()) {
|
|
|
|
d->aps.append(ap);
|
|
|
|
d->aps[ap] = dev;
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
@ -98,8 +118,26 @@ bool WirelessNetwork::addAP(const TDENetworkWiFiAPInfo * const ap)
|
|
|
|
|
|
|
|
|
|
|
|
const TQByteArray WirelessNetwork::getSsid() const
|
|
|
|
const TQByteArray WirelessNetwork::getSsid() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices();
|
|
|
|
|
|
|
|
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
|
|
|
|
|
|
|
|
|
|
|
|
if ( !d->aps.isEmpty() ) {
|
|
|
|
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 {
|
|
|
|
else {
|
|
|
|
return TQByteArray();
|
|
|
|
return TQByteArray();
|
|
|
@ -108,8 +146,26 @@ const TQByteArray WirelessNetwork::getSsid() const
|
|
|
|
|
|
|
|
|
|
|
|
TQString WirelessNetwork::getDisplaySsid() const
|
|
|
|
TQString WirelessNetwork::getDisplaySsid() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices();
|
|
|
|
|
|
|
|
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
|
|
|
|
|
|
|
|
|
|
|
|
if (!d->aps.isEmpty()) {
|
|
|
|
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 {
|
|
|
|
else {
|
|
|
|
return TQString();
|
|
|
|
return TQString();
|
|
|
@ -118,30 +174,75 @@ TQString WirelessNetwork::getDisplaySsid() const
|
|
|
|
|
|
|
|
|
|
|
|
TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getFlags() const
|
|
|
|
TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getFlags() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices();
|
|
|
|
|
|
|
|
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
|
|
|
|
|
|
|
|
|
|
|
|
TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None;
|
|
|
|
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::GeneralFlagsMask);
|
|
|
|
TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(it.data()));
|
|
|
|
flags |= ((*it)->rsnFlags & TDENetworkWiFiAPFlags::GeneralFlagsMask);
|
|
|
|
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;
|
|
|
|
return flags;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getWpaFlags() const
|
|
|
|
TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getWpaFlags() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices();
|
|
|
|
|
|
|
|
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
|
|
|
|
|
|
|
|
|
|
|
|
TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None;
|
|
|
|
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;
|
|
|
|
return flags;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getRsnFlags() const
|
|
|
|
TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getRsnFlags() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices();
|
|
|
|
|
|
|
|
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
|
|
|
|
|
|
|
|
|
|
|
|
TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None;
|
|
|
|
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;
|
|
|
|
return flags;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -153,10 +254,25 @@ bool WirelessNetwork::isEncrypted() const
|
|
|
|
|
|
|
|
|
|
|
|
TQ_UINT8 WirelessNetwork::getStrength() const
|
|
|
|
TQ_UINT8 WirelessNetwork::getStrength() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices();
|
|
|
|
|
|
|
|
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
|
|
|
|
|
|
|
|
|
|
|
|
TQ_UINT8 strength = 0;
|
|
|
|
TQ_UINT8 strength = 0;
|
|
|
|
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) {
|
|
|
|
if (((*it)->signalQuality*100.0) > strength) {
|
|
|
|
TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(it.data()));
|
|
|
|
strength = ((*it)->signalQuality*100.0);
|
|
|
|
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;
|
|
|
|
return strength;
|
|
|
|