summaryrefslogtreecommitdiffstats
path: root/src/plugins/bearer/icd
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-07-28 06:02:45 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-07-28 06:02:45 (GMT)
commit7b10151cb6550fe8060217fad8549950eadd5fca (patch)
tree96a450a91f083ba3024ebc6eb85bae466b3c62d7 /src/plugins/bearer/icd
parent104e9d2b3f8ac981a277cb0d63a1e5be8e352275 (diff)
parent289f9a97c3828135bdc2fd6b3e8466c1c970a5c5 (diff)
downloadQt-7b10151cb6550fe8060217fad8549950eadd5fca.zip
Qt-7b10151cb6550fe8060217fad8549950eadd5fca.tar.gz
Qt-7b10151cb6550fe8060217fad8549950eadd5fca.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: Cherry pick fix for MOBILITY-1234 from Qt Mobility. Cherry pick fix for QTMOBILITY-408 from Qt Mobility. Cherry pick fix for MOBILITY-1194 from Qt Mobility. Fix compilation error on Symbian^4. Fix detection of OCC functionality. Cherry pick fix for MOBILITY-1194 from Qt Mobility.
Diffstat (limited to 'src/plugins/bearer/icd')
-rw-r--r--src/plugins/bearer/icd/qnetworksession_impl.cpp59
-rw-r--r--src/plugins/bearer/icd/qnetworksession_impl.h8
2 files changed, 34 insertions, 33 deletions
diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp
index aeac620..e8e5183 100644
--- a/src/plugins/bearer/icd/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp
@@ -235,7 +235,7 @@ void QNetworkSessionPrivateImpl::updateIdentifier(const QString &newId)
}
-quint64 QNetworkSessionPrivateImpl::getStatistics(bool sent) const
+QNetworkSessionPrivateImpl::Statistics QNetworkSessionPrivateImpl::getStatistics() const
{
/* This could be also implemented by using the Maemo::Icd::statistics()
* that gets the statistics data for a specific IAP. Change if
@@ -243,56 +243,51 @@ quint64 QNetworkSessionPrivateImpl::getStatistics(bool sent) const
*/
Maemo::Icd icd;
QList<Maemo::IcdStatisticsResult> stats_results;
- quint64 counter_rx = 0, counter_tx = 0;
+ Statistics stats = { 0, 0, 0};
- if (!icd.statistics(stats_results)) {
- return 0;
- }
+ if (!icd.statistics(stats_results))
+ return stats;
foreach (const Maemo::IcdStatisticsResult &res, stats_results) {
- if (res.params.network_attrs & ICD_NW_ATTR_IAPNAME) {
- /* network_id is the IAP UUID */
- if (QString(res.params.network_id.data()) == activeConfig.identifier()) {
- counter_tx = res.bytes_sent;
- counter_rx = res.bytes_received;
- }
- } else {
- /* We probably will never get to this branch */
- IcdNetworkConfigurationPrivate *icdConfig =
- toIcdConfig(privateConfiguration(activeConfig));
+ if (res.params.network_attrs & ICD_NW_ATTR_IAPNAME) {
+ /* network_id is the IAP UUID */
+ if (QString(res.params.network_id.data()) == activeConfig.identifier()) {
+ stats.txData = res.bytes_sent;
+ stats.rxData = res.bytes_received;
+ stats.activeTime = res.time_active;
+ }
+ } else {
+ /* We probably will never get to this branch */
+ IcdNetworkConfigurationPrivate *icdConfig =
+ toIcdConfig(privateConfiguration(activeConfig));
- icdConfig->mutex.lock();
- if (res.params.network_id == icdConfig->network_id) {
- counter_tx = res.bytes_sent;
- counter_rx = res.bytes_received;
- }
- icdConfig->mutex.unlock();
- }
+ icdConfig->mutex.lock();
+ if (res.params.network_id == icdConfig->network_id) {
+ stats.txData = res.bytes_sent;
+ stats.rxData = res.bytes_received;
+ stats.activeTime = res.time_active;
+ }
+ icdConfig->mutex.unlock();
+ }
}
- if (sent)
- return counter_tx;
- else
- return counter_rx;
+ return stats;
}
quint64 QNetworkSessionPrivateImpl::bytesWritten() const
{
- return getStatistics(true);
+ return getStatistics().txData;
}
quint64 QNetworkSessionPrivateImpl::bytesReceived() const
{
- return getStatistics(false);
+ return getStatistics().rxData;
}
quint64 QNetworkSessionPrivateImpl::activeTime() const
{
- if (startTime.isNull()) {
- return 0;
- }
- return startTime.secsTo(QDateTime::currentDateTime());
+ return getStatistics().activeTime;
}
diff --git a/src/plugins/bearer/icd/qnetworksession_impl.h b/src/plugins/bearer/icd/qnetworksession_impl.h
index c43b1f0..390e508 100644
--- a/src/plugins/bearer/icd/qnetworksession_impl.h
+++ b/src/plugins/bearer/icd/qnetworksession_impl.h
@@ -170,6 +170,12 @@ private:
QNetworkConfigurationManager manager;
QIcdEngine *engine;
+ struct Statistics {
+ quint64 txData;
+ quint64 rxData;
+ quint64 activeTime;
+ };
+
// The config set on QNetworkSession.
QNetworkConfiguration config;
@@ -186,7 +192,7 @@ private:
friend class IcdListener;
void updateState(QNetworkSession::State);
void updateIdentifier(const QString &newId);
- quint64 getStatistics(bool sent) const;
+ Statistics getStatistics() const;
void cleanupSession(void);
void updateProxyInformation();