Changeset View
Changeset View
Standalone View
Standalone View
src/wirelessdevice.cpp
Show First 20 Lines • Show All 88 Lines • ▼ Show 20 Line(s) | |||||
89 | { | 89 | { | ||
90 | Q_D(const WirelessDevice); | 90 | Q_D(const WirelessDevice); | ||
91 | return d->apMap.keys(); | 91 | return d->apMap.keys(); | ||
92 | } | 92 | } | ||
93 | 93 | | |||
94 | QDBusPendingReply<> NetworkManager::WirelessDevice::requestScan(const QVariantMap &options) | 94 | QDBusPendingReply<> NetworkManager::WirelessDevice::requestScan(const QVariantMap &options) | ||
95 | { | 95 | { | ||
96 | Q_D(WirelessDevice); | 96 | Q_D(WirelessDevice); | ||
97 | d->lastRequestScanTime = QDateTime::currentDateTime(); | ||||
97 | return d->wirelessIface.RequestScan(options); | 98 | return d->wirelessIface.RequestScan(options); | ||
98 | } | 99 | } | ||
99 | 100 | | |||
100 | NetworkManager::AccessPoint::Ptr NetworkManager::WirelessDevice::activeAccessPoint() const | 101 | NetworkManager::AccessPoint::Ptr NetworkManager::WirelessDevice::activeAccessPoint() const | ||
101 | { | 102 | { | ||
102 | Q_D(const WirelessDevice); | 103 | Q_D(const WirelessDevice); | ||
103 | return d->activeAccessPoint; | 104 | return d->activeAccessPoint; | ||
104 | } | 105 | } | ||
Show All 17 Lines | |||||
122 | } | 123 | } | ||
123 | 124 | | |||
124 | int NetworkManager::WirelessDevice::bitRate() const | 125 | int NetworkManager::WirelessDevice::bitRate() const | ||
125 | { | 126 | { | ||
126 | Q_D(const WirelessDevice); | 127 | Q_D(const WirelessDevice); | ||
127 | return d->bitRate; | 128 | return d->bitRate; | ||
128 | } | 129 | } | ||
129 | 130 | | |||
131 | QDateTime NetworkManager::WirelessDevice::lastScanTime() const | ||||
132 | { | ||||
133 | Q_D(const WirelessDevice); | ||||
134 | return d->lastScanTime; | ||||
135 | } | ||||
136 | | ||||
137 | QDateTime NetworkManager::WirelessDevice::lastRequestScanTime() const | ||||
138 | { | ||||
139 | Q_D(const WirelessDevice); | ||||
140 | return d->lastRequestScanTime; | ||||
141 | } | ||||
142 | | ||||
130 | NetworkManager::WirelessDevice::Capabilities NetworkManager::WirelessDevice::wirelessCapabilities() const | 143 | NetworkManager::WirelessDevice::Capabilities NetworkManager::WirelessDevice::wirelessCapabilities() const | ||
131 | { | 144 | { | ||
132 | Q_D(const WirelessDevice); | 145 | Q_D(const WirelessDevice); | ||
133 | return d->wirelessCapabilities; | 146 | return d->wirelessCapabilities; | ||
134 | } | 147 | } | ||
135 | 148 | | |||
136 | NetworkManager::AccessPoint::Ptr NetworkManager::WirelessDevice::findAccessPoint(const QString &uni) | 149 | NetworkManager::AccessPoint::Ptr NetworkManager::WirelessDevice::findAccessPoint(const QString &uni) | ||
137 | { | 150 | { | ||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Line(s) | 240 | } else if (property == QLatin1String("Bitrate")) { | |||
228 | bitRate = value.toUInt(); | 241 | bitRate = value.toUInt(); | ||
229 | Q_EMIT q->bitRateChanged(bitRate); | 242 | Q_EMIT q->bitRateChanged(bitRate); | ||
230 | } else if (property == QLatin1String("Mode")) { | 243 | } else if (property == QLatin1String("Mode")) { | ||
231 | mode = q->convertOperationMode(value.toUInt()); | 244 | mode = q->convertOperationMode(value.toUInt()); | ||
232 | Q_EMIT q->modeChanged(mode); | 245 | Q_EMIT q->modeChanged(mode); | ||
233 | } else if (property == QLatin1String("WirelessCapabilities")) { | 246 | } else if (property == QLatin1String("WirelessCapabilities")) { | ||
234 | wirelessCapabilities = q->convertCapabilities(value.toUInt()); | 247 | wirelessCapabilities = q->convertCapabilities(value.toUInt()); | ||
235 | Q_EMIT q->wirelessCapabilitiesChanged(wirelessCapabilities); | 248 | Q_EMIT q->wirelessCapabilitiesChanged(wirelessCapabilities); | ||
249 | } else if (property == QLatin1String("LastScan")) { | ||||
250 | lastScanTime = QDateTime::currentDateTime(); | ||||
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… | |||||
251 | Q_EMIT q->lastScanTimeChanged(lastScanTime); | ||||
236 | } else if (property == QLatin1String("AccessPoints")) { | 252 | } else if (property == QLatin1String("AccessPoints")) { | ||
237 | // TODO use this instead AccessPointAdded/Removed signals? | 253 | // TODO use this instead AccessPointAdded/Removed signals? | ||
238 | } else { | 254 | } else { | ||
239 | DevicePrivate::propertyChanged(property, value); | 255 | DevicePrivate::propertyChanged(property, value); | ||
240 | } | 256 | } | ||
241 | } | 257 | } | ||
242 | 258 | | |||
243 | NetworkManager::WirelessDevice::OperationMode NetworkManager::WirelessDevice::convertOperationMode(uint theirMode) | 259 | 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.