Changeset View
Changeset View
Standalone View
Standalone View
src/wirelessdevice.cpp
Show All 25 Lines | |||||
26 | #undef signals | 26 | #undef signals | ||
27 | #include <libnm/NetworkManager.h> | 27 | #include <libnm/NetworkManager.h> | ||
28 | #define signals Q_SIGNALS | 28 | #define signals Q_SIGNALS | ||
29 | 29 | | |||
30 | #include "accesspoint.h" | 30 | #include "accesspoint.h" | ||
31 | #include "manager_p.h" | 31 | #include "manager_p.h" | ||
32 | 32 | | |||
33 | #include "nmdebug.h" | 33 | #include "nmdebug.h" | ||
34 | #include "utils.h" | ||||
34 | 35 | | |||
35 | NetworkManager::WirelessDevicePrivate::WirelessDevicePrivate(const QString &path, WirelessDevice *q) | 36 | NetworkManager::WirelessDevicePrivate::WirelessDevicePrivate(const QString &path, WirelessDevice *q) | ||
36 | : DevicePrivate(path, q) | 37 | : DevicePrivate(path, q) | ||
37 | #ifdef NMQT_STATIC | 38 | #ifdef NMQT_STATIC | ||
38 | , wirelessIface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::sessionBus()) | 39 | , wirelessIface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::sessionBus()) | ||
39 | #else | 40 | #else | ||
40 | , wirelessIface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus()) | 41 | , wirelessIface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus()) | ||
41 | #endif | 42 | #endif | ||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | |||||
89 | { | 90 | { | ||
90 | Q_D(const WirelessDevice); | 91 | Q_D(const WirelessDevice); | ||
91 | return d->apMap.keys(); | 92 | return d->apMap.keys(); | ||
92 | } | 93 | } | ||
93 | 94 | | |||
94 | QDBusPendingReply<> NetworkManager::WirelessDevice::requestScan(const QVariantMap &options) | 95 | QDBusPendingReply<> NetworkManager::WirelessDevice::requestScan(const QVariantMap &options) | ||
95 | { | 96 | { | ||
96 | Q_D(WirelessDevice); | 97 | Q_D(WirelessDevice); | ||
98 | d->lastRequestScanTime = QDateTime::currentDateTime(); | ||||
97 | return d->wirelessIface.RequestScan(options); | 99 | return d->wirelessIface.RequestScan(options); | ||
98 | } | 100 | } | ||
99 | 101 | | |||
100 | NetworkManager::AccessPoint::Ptr NetworkManager::WirelessDevice::activeAccessPoint() const | 102 | NetworkManager::AccessPoint::Ptr NetworkManager::WirelessDevice::activeAccessPoint() const | ||
101 | { | 103 | { | ||
102 | Q_D(const WirelessDevice); | 104 | Q_D(const WirelessDevice); | ||
103 | return d->activeAccessPoint; | 105 | return d->activeAccessPoint; | ||
104 | } | 106 | } | ||
Show All 17 Lines | |||||
122 | } | 124 | } | ||
123 | 125 | | |||
124 | int NetworkManager::WirelessDevice::bitRate() const | 126 | int NetworkManager::WirelessDevice::bitRate() const | ||
125 | { | 127 | { | ||
126 | Q_D(const WirelessDevice); | 128 | Q_D(const WirelessDevice); | ||
127 | return d->bitRate; | 129 | return d->bitRate; | ||
128 | } | 130 | } | ||
129 | 131 | | |||
132 | QDateTime NetworkManager::WirelessDevice::lastScan() const | ||||
133 | { | ||||
134 | Q_D(const WirelessDevice); | ||||
135 | return d->lastScan; | ||||
136 | } | ||||
137 | | ||||
138 | QDateTime NetworkManager::WirelessDevice::lastRequestScanTime() const | ||||
139 | { | ||||
140 | Q_D(const WirelessDevice); | ||||
141 | return d->lastRequestScanTime; | ||||
142 | } | ||||
143 | | ||||
130 | NetworkManager::WirelessDevice::Capabilities NetworkManager::WirelessDevice::wirelessCapabilities() const | 144 | NetworkManager::WirelessDevice::Capabilities NetworkManager::WirelessDevice::wirelessCapabilities() const | ||
131 | { | 145 | { | ||
132 | Q_D(const WirelessDevice); | 146 | Q_D(const WirelessDevice); | ||
133 | return d->wirelessCapabilities; | 147 | return d->wirelessCapabilities; | ||
134 | } | 148 | } | ||
135 | 149 | | |||
136 | NetworkManager::AccessPoint::Ptr NetworkManager::WirelessDevice::findAccessPoint(const QString &uni) | 150 | NetworkManager::AccessPoint::Ptr NetworkManager::WirelessDevice::findAccessPoint(const QString &uni) | ||
137 | { | 151 | { | ||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Line(s) | 241 | } else if (property == QLatin1String("Bitrate")) { | |||
228 | bitRate = value.toUInt(); | 242 | bitRate = value.toUInt(); | ||
229 | Q_EMIT q->bitRateChanged(bitRate); | 243 | Q_EMIT q->bitRateChanged(bitRate); | ||
230 | } else if (property == QLatin1String("Mode")) { | 244 | } else if (property == QLatin1String("Mode")) { | ||
231 | mode = q->convertOperationMode(value.toUInt()); | 245 | mode = q->convertOperationMode(value.toUInt()); | ||
232 | Q_EMIT q->modeChanged(mode); | 246 | Q_EMIT q->modeChanged(mode); | ||
233 | } else if (property == QLatin1String("WirelessCapabilities")) { | 247 | } else if (property == QLatin1String("WirelessCapabilities")) { | ||
234 | wirelessCapabilities = q->convertCapabilities(value.toUInt()); | 248 | wirelessCapabilities = q->convertCapabilities(value.toUInt()); | ||
235 | Q_EMIT q->wirelessCapabilitiesChanged(wirelessCapabilities); | 249 | Q_EMIT q->wirelessCapabilitiesChanged(wirelessCapabilities); | ||
250 | } else if (property == QLatin1String("LastScan")) { | ||||
251 | lastScan = NetworkManager::clockBootTimeToDateTime(value.toLongLong()); | ||||
jgrulich: Don't use QDateTime::currentDateTime() as it might be different from the actual value returned… | |||||
LastScan is in CLOCK_BOOTIME which is complicated to work with. meven: LastScan is in CLOCK_BOOTIME which is complicated to work with.
So I use naively the signal… | |||||
Then cannot you work with it as with qlonglong? It shouldn't matter then if it's in CLOCK_BOOTIME . jgrulich: Then cannot you work with it as with qlonglong? It shouldn't matter then if it's in… | |||||
I need to be able to know the elapsed time since LastScan. So it doesn't matter as long as I manage to get a CLOCK_BOOTIME value for current time. Anyway I am thinking about adding a short util function somewhere to convert CLOCK_BOOTTIME to QDateTime. meven: I need to be able to know the elapsed time since LastScan. So it doesn't matter as long as I… | |||||
252 | Q_EMIT q->lastScanChanged(lastScan); | ||||
236 | } else if (property == QLatin1String("AccessPoints")) { | 253 | } else if (property == QLatin1String("AccessPoints")) { | ||
237 | // TODO use this instead AccessPointAdded/Removed signals? | 254 | // TODO use this instead AccessPointAdded/Removed signals? | ||
238 | } else { | 255 | } else { | ||
239 | DevicePrivate::propertyChanged(property, value); | 256 | DevicePrivate::propertyChanged(property, value); | ||
240 | } | 257 | } | ||
241 | } | 258 | } | ||
242 | 259 | | |||
243 | NetworkManager::WirelessDevice::OperationMode NetworkManager::WirelessDevice::convertOperationMode(uint theirMode) | 260 | NetworkManager::WirelessDevice::OperationMode NetworkManager::WirelessDevice::convertOperationMode(uint theirMode) | ||
Show All 25 Lines |
Don't use QDateTime::currentDateTime() as it might be different from the actual value returned by NetworkManager.