diff options
author | LeelaPrasannaKumar Chintagunta <ext-leela.chintagunta@nokia.com> | 2012-03-06 12:50:36 +0530 |
---|---|---|
committer | LeelaPrasannaKumar Chintagunta <ext-leela.chintagunta@nokia.com> | 2012-03-06 12:50:36 +0530 |
commit | 869226220dc1caefb9b407138090ff8bb92d6abd (patch) | |
tree | 3cfd5907d886edc502c87975e1ca148b5a496357 | |
parent | 85cfc96e250b4891396ba410825728e92174a34d (diff) |
DeviceInfo Singleton#RMobilePhone implementation#alignedtimer testfailure
-rw-r--r-- | src/systeminfo/qsystemalignedtimer_symbian.cpp | 3 | ||||
-rw-r--r-- | src/systeminfo/qsysteminfo_s60.cpp | 194 | ||||
-rw-r--r-- | src/systeminfo/qsysteminfo_s60_p.h | 167 | ||||
-rw-r--r-- | src/systeminfo/symbian/telephonyinfo_s60.cpp | 1122 | ||||
-rw-r--r-- | src/systeminfo/symbian/telephonyinfo_s60.h | 207 |
5 files changed, 1376 insertions, 317 deletions
diff --git a/src/systeminfo/qsystemalignedtimer_symbian.cpp b/src/systeminfo/qsystemalignedtimer_symbian.cpp index 12bbf57cdf..f77161abce 100644 --- a/src/systeminfo/qsystemalignedtimer_symbian.cpp +++ b/src/systeminfo/qsystemalignedtimer_symbian.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011-2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -120,6 +120,7 @@ void QSystemAlignedTimerPrivate::singleShot(int minimumTime, int maximumTime, QO TRACES(qDebug() << "QSystemAlignedTimerPrivate::singleShot--Issuing request,Wait for SingleShot() callback"); alignedTimer->m_singleShotReceiver = receiver; alignedTimer->m_singleShotMember = member; + alignedTimer->setSingleShot(true); alignedTimer->start(minimumTime, maximumTime); } } diff --git a/src/systeminfo/qsysteminfo_s60.cpp b/src/systeminfo/qsysteminfo_s60.cpp index b78e0c4bad..cdf47f207b 100644 --- a/src/systeminfo/qsysteminfo_s60.cpp +++ b/src/systeminfo/qsysteminfo_s60.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010-2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010-2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -98,19 +98,9 @@ const float KMMPerTwip = 0.0177f; //Milimeter Per Twip QTM_BEGIN_NAMESPACE -QSystemInfoPrivateBase::QSystemInfoPrivateBase(QObject *parent) - : QObject(parent) -{ - m_deviceInfo = new DeviceInfo(); -} - -QSystemInfoPrivateBase::~QSystemInfoPrivateBase() -{ - delete m_deviceInfo; -} QSystemInfoPrivate::QSystemInfoPrivate(QObject *parent) - : QSystemInfoPrivateBase(parent) + : QObject(parent) { } @@ -439,25 +429,25 @@ bool QSystemInfoPrivate::hasFeatureSupported(QSystemInfo::Feature feature) } QSystemNetworkInfoPrivate::QSystemNetworkInfoPrivate(QObject *parent) - : QSystemInfoPrivateBase(parent) + : QObject(parent) { TRACES(qDebug() << "QSystemNetworkInfoPrivate::QSystemNetworkInfoPrivate<---"); - m_deviceInfo->cellSignalStrenghtInfo()->addObserver(this); - m_deviceInfo->cellNetworkInfo()->addObserver(this); - m_deviceInfo->cellNetworkRegistrationInfo()->addObserver(this); + DeviceInfo::instance()->cellSignalStrenghtInfo()->addObserver(this); + DeviceInfo::instance()->cellNetworkInfo()->addObserver(this); + DeviceInfo::instance()->cellNetworkRegistrationInfo()->addObserver(this); #ifdef ETELMM_SUPPORTED - m_deviceInfo->networkInfo()->addObserver(this); + DeviceInfo::instance()->networkInfo()->addObserver(this); #endif - m_deviceInfo->wlanInfo()->addObserver(this); - /*connect(m_deviceInfo->wlanInfo(), SIGNAL(wlanNetworkNameChanged()), + DeviceInfo::instance()->wlanInfo()->addObserver(this); + /*connect(DeviceInfo::instance()->wlanInfo(), SIGNAL(wlanNetworkNameChanged()), this, SLOT(wlanNetworkNameChanged())); - connect(m_deviceInfo->wlanInfo(), SIGNAL(wlanNetworkSignalStrengthChanged()), + connect(DeviceInfo::instance()->wlanInfo(), SIGNAL(wlanNetworkSignalStrengthChanged()), this, SLOT(wlanNetworkSignalStrengthChanged())); - connect(m_deviceInfo->wlanInfo(), SIGNAL(wlanNetworkStatusChanged()), + connect(DeviceInfo::instance()->wlanInfo(), SIGNAL(wlanNetworkStatusChanged()), this, SLOT(wlanNetworkStatusChanged()));*/ - m_deviceInfo->subscriberInfo(); + DeviceInfo::instance()->subscriberInfo(); #ifdef NETWORKHANDLER_SYMBIAN_SUPPORTED - m_deviceInfo->networkInfoListener()->addObserver(this); + DeviceInfo::instance()->networkInfoListener()->addObserver(this); #endif TRACES(qDebug() << "QSystemNetworkInfoPrivate::QSystemNetworkInfoPrivate--->"); } @@ -466,15 +456,15 @@ QSystemNetworkInfoPrivate::~QSystemNetworkInfoPrivate() { TRACES(qDebug() << "QSystemNetworkInfoPrivate::~QSystemNetworkInfoPrivate<--"); - m_deviceInfo->cellSignalStrenghtInfo()->removeObserver(this); - m_deviceInfo->cellNetworkInfo()->removeObserver(this); - m_deviceInfo->cellNetworkRegistrationInfo()->removeObserver(this); + DeviceInfo::instance()->cellSignalStrenghtInfo()->removeObserver(this); + DeviceInfo::instance()->cellNetworkInfo()->removeObserver(this); + DeviceInfo::instance()->cellNetworkRegistrationInfo()->removeObserver(this); #ifdef ETELMM_SUPPORTED - m_deviceInfo->networkInfo()->removeObserver(this); + DeviceInfo::instance()->networkInfo()->removeObserver(this); #endif - m_deviceInfo->wlanInfo()->removeObserver(this); + DeviceInfo::instance()->wlanInfo()->removeObserver(this); #ifdef NETWORKHANDLER_SYMBIAN_SUPPORTED - m_deviceInfo->networkInfoListener()->removeObserver(this); + DeviceInfo::instance()->networkInfoListener()->removeObserver(this); #endif TRACES(qDebug() << "QSystemNetworkInfoPrivate::~QSystemNetworkInfoPrivate-->"); } @@ -488,8 +478,8 @@ QSystemNetworkInfo::NetworkStatus QSystemNetworkInfoPrivate::networkStatus(QSyst case QSystemNetworkInfo::LteMode: { #ifndef ETELMM_SUPPORTED - CTelephony::TRegistrationStatus networkStatus = m_deviceInfo->cellNetworkRegistrationInfo()->cellNetworkStatus(); - CTelephony::TNetworkMode networkMode = m_deviceInfo->cellNetworkInfo()->networkMode(); + CTelephony::TRegistrationStatus networkStatus = DeviceInfo::instance()->cellNetworkRegistrationInfo()->cellNetworkStatus(); + CTelephony::TNetworkMode networkMode = DeviceInfo::instance()->cellNetworkInfo()->networkMode(); if (networkMode == CTelephony::ENetworkModeGsm && mode != QSystemNetworkInfo::GsmMode) return QSystemNetworkInfo::NoNetworkAvailable; @@ -518,7 +508,7 @@ QSystemNetworkInfo::NetworkStatus QSystemNetworkInfoPrivate::networkStatus(QSyst QSystemNetworkInfo::NetworkMode currMode =currentMode(); if (currMode == mode) { - nStatus = m_deviceInfo->networkInfo()->GetStatus(); + nStatus = DeviceInfo::instance()->networkInfo()->GetStatus(); } switch (nStatus) { case RMobilePhone::ERegistrationUnknown : return QSystemNetworkInfo::UndefinedStatus; @@ -536,7 +526,7 @@ QSystemNetworkInfo::NetworkStatus QSystemNetworkInfoPrivate::networkStatus(QSyst } case QSystemNetworkInfo::WlanMode: { - if (m_deviceInfo->wlanInfo()->wlanNetworkConnectionStatus()) + if (DeviceInfo::instance()->wlanInfo()->wlanNetworkConnectionStatus()) return QSystemNetworkInfo::Connected; else return QSystemNetworkInfo::NoNetworkAvailable; @@ -557,7 +547,7 @@ int QSystemNetworkInfoPrivate::networkSignalStrength(QSystemNetworkInfo::Network case QSystemNetworkInfo::CdmaMode: case QSystemNetworkInfo::WcdmaMode: { - CTelephony::TNetworkMode networkMode = m_deviceInfo->cellNetworkInfo()->networkMode(); + CTelephony::TNetworkMode networkMode = DeviceInfo::instance()->cellNetworkInfo()->networkMode(); if (networkMode == CTelephony::ENetworkModeGsm && mode != QSystemNetworkInfo::GsmMode) return -1; @@ -568,11 +558,11 @@ int QSystemNetworkInfoPrivate::networkSignalStrength(QSystemNetworkInfo::Network if (networkMode == CTelephony::ENetworkModeWcdma && mode != QSystemNetworkInfo::WcdmaMode) return -1; - return m_deviceInfo->cellSignalStrenghtInfo()->cellNetworkSignalStrength(); + return DeviceInfo::instance()->cellSignalStrenghtInfo()->cellNetworkSignalStrength(); } case QSystemNetworkInfo::WlanMode: - return m_deviceInfo->wlanInfo()->wlanNetworkSignalStrength(); + return DeviceInfo::instance()->wlanInfo()->wlanNetworkSignalStrength(); case QSystemNetworkInfo::EthernetMode: case QSystemNetworkInfo::BluetoothMode: case QSystemNetworkInfo::WimaxMode: @@ -584,27 +574,27 @@ int QSystemNetworkInfoPrivate::networkSignalStrength(QSystemNetworkInfo::Network int QSystemNetworkInfoPrivate::cellId() { - return m_deviceInfo->cellNetworkInfo()->cellId(); + return DeviceInfo::instance()->cellNetworkInfo()->cellId(); } int QSystemNetworkInfoPrivate::locationAreaCode() { - return m_deviceInfo->cellNetworkInfo()->locationAreaCode(); + return DeviceInfo::instance()->cellNetworkInfo()->locationAreaCode(); } QString QSystemNetworkInfoPrivate::currentMobileCountryCode() { - return m_deviceInfo->cellNetworkInfo()->countryCode(); + return DeviceInfo::instance()->cellNetworkInfo()->countryCode(); } QString QSystemNetworkInfoPrivate::currentMobileNetworkCode() { - return m_deviceInfo->cellNetworkInfo()->networkCode(); + return DeviceInfo::instance()->cellNetworkInfo()->networkCode(); } QString QSystemNetworkInfoPrivate::homeMobileCountryCode() { - QString imsi = m_deviceInfo->subscriberInfo()->imsi(); + QString imsi = DeviceInfo::instance()->subscriberInfo()->imsi(); if (imsi.length() >= 3) { return imsi.left(3); } @@ -614,7 +604,7 @@ QString QSystemNetworkInfoPrivate::homeMobileCountryCode() QString QSystemNetworkInfoPrivate::homeMobileNetworkCode() { - return m_deviceInfo->cellNetworkInfo()->homeNetworkCode(); + return DeviceInfo::instance()->cellNetworkInfo()->homeNetworkCode(); } @@ -626,7 +616,7 @@ QString QSystemNetworkInfoPrivate::networkName(QSystemNetworkInfo::NetworkMode m case QSystemNetworkInfo::CdmaMode: case QSystemNetworkInfo::WcdmaMode: { - CTelephony::TNetworkMode networkMode = m_deviceInfo->cellNetworkInfo()->networkMode(); + CTelephony::TNetworkMode networkMode = DeviceInfo::instance()->cellNetworkInfo()->networkMode(); if (networkMode == CTelephony::ENetworkModeGsm && mode != QSystemNetworkInfo::GsmMode) return QString(); @@ -638,13 +628,13 @@ QString QSystemNetworkInfoPrivate::networkName(QSystemNetworkInfo::NetworkMode m return QString(); #ifndef NETWORKHANDLER_SYMBIAN_SUPPORTED - return m_deviceInfo->cellNetworkInfo()->networkName(); + return DeviceInfo::instance()->cellNetworkInfo()->networkName(); #else - return m_deviceInfo->networkInfoListener()->networkName(); + return DeviceInfo::instance()->networkInfoListener()->networkName(); #endif } case QSystemNetworkInfo::WlanMode: - return m_deviceInfo->wlanInfo()->wlanNetworkName(); + return DeviceInfo::instance()->wlanInfo()->wlanNetworkName(); case QSystemNetworkInfo::EthernetMode: case QSystemNetworkInfo::BluetoothMode: case QSystemNetworkInfo::WimaxMode: @@ -703,20 +693,20 @@ QNetworkInterface QSystemNetworkInfoPrivate::interfaceForMode(QSystemNetworkInfo void QSystemNetworkInfoPrivate::countryCodeChanged() { - emit currentMobileCountryCodeChanged(m_deviceInfo->cellNetworkInfo()->countryCode()); + emit currentMobileCountryCodeChanged(DeviceInfo::instance()->cellNetworkInfo()->countryCode()); } void QSystemNetworkInfoPrivate::networkCodeChanged() { - emit currentMobileNetworkCodeChanged(m_deviceInfo->cellNetworkInfo()->networkCode()); + emit currentMobileNetworkCodeChanged(DeviceInfo::instance()->cellNetworkInfo()->networkCode()); } void QSystemNetworkInfoPrivate::networkNameChanged() { #ifndef NETWORKHANDLER_SYMBIAN_SUPPORTED - emit networkNameChanged(currentMode(), m_deviceInfo->cellNetworkInfo()->networkName()); + emit networkNameChanged(currentMode(), DeviceInfo::instance()->cellNetworkInfo()->networkName()); #else - emit networkNameChanged(currentMode(), m_deviceInfo->networkInfoListener()->networkName()); + emit networkNameChanged(currentMode(), DeviceInfo::instance()->networkInfoListener()->networkName()); #endif } @@ -749,7 +739,7 @@ void QSystemNetworkInfoPrivate::changedCellId(int cellIdTel) void QSystemNetworkInfoPrivate::cellNetworkSignalStrengthChanged() { emit networkSignalStrengthChanged(currentMode(), - m_deviceInfo->cellSignalStrenghtInfo()->cellNetworkSignalStrength()); + DeviceInfo::instance()->cellSignalStrenghtInfo()->cellNetworkSignalStrength()); } void QSystemNetworkInfoPrivate::cellNetworkStatusChanged() @@ -760,9 +750,9 @@ void QSystemNetworkInfoPrivate::cellNetworkStatusChanged() void QSystemNetworkInfoPrivate::wlanNetworkNameChanged() { - bool status = m_deviceInfo->wlanInfo()->wlanNetworkConnectionStatus(); + bool status = DeviceInfo::instance()->wlanInfo()->wlanNetworkConnectionStatus(); if (status) - emit networkNameChanged(QSystemNetworkInfo::WlanMode,m_deviceInfo->wlanInfo()->wlanNetworkName()); + emit networkNameChanged(QSystemNetworkInfo::WlanMode,DeviceInfo::instance()->wlanInfo()->wlanNetworkName()); else networkNameChanged();//Restore default network name, as WLAN will leave name as blank } @@ -770,13 +760,13 @@ void QSystemNetworkInfoPrivate::wlanNetworkNameChanged() void QSystemNetworkInfoPrivate::wlanNetworkSignalStrengthChanged() { emit networkSignalStrengthChanged(QSystemNetworkInfo::WlanMode, - m_deviceInfo->wlanInfo()->wlanNetworkSignalStrength()); + DeviceInfo::instance()->wlanInfo()->wlanNetworkSignalStrength()); } //TODO: There are no WLAN specific modes (Not connected, Infrastructure, Adhoc, Secure Infrastructure and Searching) void QSystemNetworkInfoPrivate::wlanNetworkStatusChanged() { - bool status = m_deviceInfo->wlanInfo()->wlanNetworkConnectionStatus(); + bool status = DeviceInfo::instance()->wlanInfo()->wlanNetworkConnectionStatus(); if (status) emit networkStatusChanged(QSystemNetworkInfo::WlanMode, QSystemNetworkInfo::Connected); else @@ -797,7 +787,7 @@ QSystemNetworkInfo::NetworkMode QSystemNetworkInfoPrivate::currentMode() { QSystemNetworkInfo::NetworkMode mode = QSystemNetworkInfo::UnknownMode; #ifndef ETELMM_SUPPORTED - CTelephony::TNetworkMode networkMode = m_deviceInfo->cellNetworkInfo()->networkMode(); + CTelephony::TNetworkMode networkMode = DeviceInfo::instance()->cellNetworkInfo()->networkMode(); switch (networkMode) { case CTelephony::ENetworkModeGsm: mode = QSystemNetworkInfo::GsmMode; break; case CTelephony::ENetworkModeCdma95: @@ -808,7 +798,7 @@ QSystemNetworkInfo::NetworkMode QSystemNetworkInfoPrivate::currentMode() } #else RMobilePhone::TMobilePhoneNetworkMode nMode = RMobilePhone::ENetworkModeUnknown; - nMode = m_deviceInfo->networkInfo()->GetMode(); + nMode = DeviceInfo::instance()->networkInfo()->GetMode(); if (nMode != RMobilePhone::ENetworkModeUnknown) { switch (nMode) { case RMobilePhone::ENetworkModeGsm : mode = QSystemNetworkInfo::GsmMode; @@ -832,7 +822,7 @@ QSystemNetworkInfo::NetworkMode QSystemNetworkInfoPrivate::currentMode() QSystemNetworkInfo::CellDataTechnology QSystemNetworkInfoPrivate::cellDataTechnology() { #ifdef ETELPACKETSERVICE_SUPPORTED - TUint celldatatechnology = m_deviceInfo->networkInfo()->CellDataTechnology(); + TUint celldatatechnology = DeviceInfo::instance()->networkInfo()->CellDataTechnology(); switch (celldatatechnology ) { case KHsdpaBearer: @@ -1085,13 +1075,13 @@ QSystemDisplayInfo::BacklightState QSystemDisplayInfoPrivate::backlightStatus(i } QSystemStorageInfoPrivate::QSystemStorageInfoPrivate(QObject *parent) - : QSystemInfoPrivateBase(parent) + : QObject(parent) { iFs.Connect(); - m_deviceInfo->mmcStorageStatus()->addObserver(this); + DeviceInfo::instance()->mmcStorageStatus()->addObserver(this); #ifdef DISKNOTIFY_SUPPORTED - CStorageDiskNotifier* storageNotifier = m_deviceInfo->storagedisknotifier(); + CStorageDiskNotifier* storageNotifier = DeviceInfo::instance()->storagedisknotifier(); if (storageNotifier != NULL){ storageNotifier->AddObserver(this); } @@ -1101,9 +1091,9 @@ QSystemStorageInfoPrivate::QSystemStorageInfoPrivate(QObject *parent) QSystemStorageInfoPrivate::~QSystemStorageInfoPrivate() { iFs.Close(); - m_deviceInfo->mmcStorageStatus()->removeObserver(this); + DeviceInfo::instance()->mmcStorageStatus()->removeObserver(this); #ifdef DISKNOTIFY_SUPPORTED - CStorageDiskNotifier* storageNotifier = m_deviceInfo->storagedisknotifier(); + CStorageDiskNotifier* storageNotifier = DeviceInfo::instance()->storagedisknotifier(); if (storageNotifier != NULL){ storageNotifier->RemoveObserver(this); } @@ -1281,34 +1271,34 @@ QSystemStorageInfo::StorageState QSystemStorageInfoPrivate::CheckDiskSpaceThresh } QSystemDeviceInfoPrivate::QSystemDeviceInfoPrivate(QObject *parent) - : QSystemInfoPrivateBase(parent), m_profileEngine(NULL), m_proEngNotifyHandler(NULL), + : QObject(parent), m_profileEngine(NULL), m_proEngNotifyHandler(NULL), m_bluetoothRepository(NULL), m_bluetoothNotifyHandler(NULL) { - m_deviceInfo->batteryInfo()->addObserver(this); - m_deviceInfo->chargingStatus()->addObserver(this); + DeviceInfo::instance()->batteryInfo()->addObserver(this); + DeviceInfo::instance()->chargingStatus()->addObserver(this); m_previousBatteryStatus = QSystemDeviceInfo::NoBatteryLevel; #ifdef LOCKANDFLIP_SUPPORTED - m_deviceInfo->keylockStatus()->addObserver(this); - m_deviceInfo->flipStatus()->addObserver(this); + DeviceInfo::instance()->keylockStatus()->addObserver(this); + DeviceInfo::instance()->flipStatus()->addObserver(this); #endif #ifdef THERMALSTATUS_SUPPORTED - m_deviceInfo->thermalStatus()->addObserver(this); + DeviceInfo::instance()->thermalStatus()->addObserver(this); #endif - m_deviceInfo->phoneInfo(); - m_deviceInfo->subscriberInfo(); + DeviceInfo::instance()->phoneInfo(); + DeviceInfo::instance()->subscriberInfo(); } QSystemDeviceInfoPrivate::~QSystemDeviceInfoPrivate() { - m_deviceInfo->chargingStatus()->removeObserver(this); - m_deviceInfo->batteryInfo()->removeObserver(this); + DeviceInfo::instance()->chargingStatus()->removeObserver(this); + DeviceInfo::instance()->batteryInfo()->removeObserver(this); #ifdef LOCKANDFLIP_SUPPORTED - m_deviceInfo->keylockStatus()->removeObserver(this); - m_deviceInfo->flipStatus()->removeObserver(this); + DeviceInfo::instance()->keylockStatus()->removeObserver(this); + DeviceInfo::instance()->flipStatus()->removeObserver(this); #endif #ifdef THERMALSTATUS_SUPPORTED - m_deviceInfo->thermalStatus()->removeObserver(this); + DeviceInfo::instance()->thermalStatus()->removeObserver(this); #endif if (m_proEngNotifyHandler) { m_proEngNotifyHandler->CancelProfileActivationNotifications(); @@ -1438,7 +1428,7 @@ QSystemDeviceInfo::InputMethodFlags QSystemDeviceInfoPrivate::inputMethodType() QSystemDeviceInfo::PowerState QSystemDeviceInfoPrivate::currentPowerState() { - switch (m_deviceInfo->chargingStatus()->chargingStatus()) { + switch (DeviceInfo::instance()->chargingStatus()->chargingStatus()) { case EChargingStatusNotConnected: case EChargingStatusNotCharging: case EChargingStatusError: @@ -1457,7 +1447,7 @@ QSystemDeviceInfo::PowerState QSystemDeviceInfoPrivate::currentPowerState() QSystemDeviceInfo::ThermalState QSystemDeviceInfoPrivate::currentThermalState() { #ifdef THERMALSTATUS_SUPPORTED - TUint8 thermalstate = m_deviceInfo->thermalStatus()->getThermalStatus(); + TUint8 thermalstate = DeviceInfo::instance()->thermalStatus()->getThermalStatus(); switch ( thermalstate ) { case ENormal: return QSystemDeviceInfo::NormalThermal; @@ -1503,7 +1493,7 @@ void QSystemDeviceInfoPrivate::NotiftythermalStateChanged(TUint8 thermalstate) QString QSystemDeviceInfoPrivate::imei() { - return m_deviceInfo->phoneInfo()->imei(); + return DeviceInfo::instance()->phoneInfo()->imei(); } QString QSystemDeviceInfoPrivate::imsi() @@ -1511,17 +1501,17 @@ QString QSystemDeviceInfoPrivate::imsi() if (simStatus() == QSystemDeviceInfo::SimNotAvailable) return QString(); else - return m_deviceInfo->subscriberInfo()->imsi(); + return DeviceInfo::instance()->subscriberInfo()->imsi(); } QString QSystemDeviceInfoPrivate::manufacturer() { - return m_deviceInfo->phoneInfo()->manufacturer(); + return DeviceInfo::instance()->phoneInfo()->manufacturer(); } QString QSystemDeviceInfoPrivate::model() { - return m_deviceInfo->phoneInfo()->model(); + return DeviceInfo::instance()->phoneInfo()->model(); } QString QSystemDeviceInfoPrivate::productName() @@ -1536,12 +1526,12 @@ QString QSystemDeviceInfoPrivate::productName() int QSystemDeviceInfoPrivate::batteryLevel() const { - return m_deviceInfo->batteryInfo()->batteryLevel(); + return DeviceInfo::instance()->batteryInfo()->batteryLevel(); } QSystemDeviceInfo::BatteryStatus QSystemDeviceInfoPrivate::batteryStatus() { - int batteryLevel = m_deviceInfo->batteryInfo()->batteryLevel(); + int batteryLevel = DeviceInfo::instance()->batteryInfo()->batteryLevel(); QSystemDeviceInfo::PowerState currentpwrstate = currentPowerState(); if (batteryLevel < 15 ) { if ( (currentpwrstate == QSystemDeviceInfo::WallPowerChargingBattery) || (currentpwrstate == QSystemDeviceInfo::WallPower) ) { @@ -1567,7 +1557,7 @@ QSystemDeviceInfo::BatteryStatus QSystemDeviceInfoPrivate::batteryStatus() QSystemDeviceInfo::SimStatus QSystemDeviceInfoPrivate::simStatus() { #ifdef SYMBIAN_3_1 - if (!m_deviceInfo->subscriberInfo()->imsi().isEmpty()) + if (!DeviceInfo::instance()->subscriberInfo()->imsi().isEmpty()) return QSystemDeviceInfo::SingleSimAvailable; #else //SYMBIAN_3_1 TInt lockStatus = 0; @@ -1653,7 +1643,7 @@ QSystemDeviceInfo::KeyboardTypeFlags QSystemDeviceInfoPrivate::keyboardTypes() default: break; } - bool filpKbStatus = m_deviceInfo->flipStatus()->IsFlipSupported(); + bool filpKbStatus = DeviceInfo::instance()->flipStatus()->IsFlipSupported(); if ( filpKbStatus ) { if ( keyboardFlags == QSystemDeviceInfo::UnknownKeyboard) keyboardFlags = QSystemDeviceInfo::FlipKeyboard; @@ -1694,8 +1684,8 @@ bool QSystemDeviceInfoPrivate::isKeyboardFlippedOpen() { #ifdef LOCKANDFLIP_SUPPORTED // It is functional only for the Grip open devices - // TBD Remove : (m_deviceInfo->flipStatus()->IsFlipSupported()) - return ( m_deviceInfo->flipStatus()->getFlipStatus() ); + // TBD Remove : (DeviceInfo::instance()->flipStatus()->IsFlipSupported()) + return ( DeviceInfo::instance()->flipStatus()->getFlipStatus() ); #else return false; #endif @@ -1750,7 +1740,7 @@ QSystemDeviceInfo::LockTypeFlags QSystemDeviceInfoPrivate::lockStatus() QSystemDeviceInfo::LockTypeFlags status = QSystemDeviceInfo::UnknownLock; #ifdef LOCKANDFLIP_SUPPORTED - int value = m_deviceInfo->keylockStatus()->getLockStatus(); + int value = DeviceInfo::instance()->keylockStatus()->getLockStatus(); switch ( value ){ /*case EKeyguardNotActive: status = QSystemDeviceInfo::DeviceUnlocked; @@ -1864,11 +1854,11 @@ void QSystemScreenSaverPrivate::setScreenSaverInhibited(bool on) } QSystemBatteryInfoPrivate::QSystemBatteryInfoPrivate(QObject *parent) -: QSystemInfoPrivateBase(parent) , m_batteryHWRM(NULL) +: QObject(parent) , m_batteryHWRM(NULL) { m_batteryHWRM = CBatteryHWRM::New(); bool chargestate,usbstate; - m_deviceInfo->batteryCommonInfo()->ChargerType(chargestate,usbstate); + DeviceInfo::instance()->batteryCommonInfo()->ChargerType(chargestate,usbstate); if (chargestate) { if (usbstate) m_charger = QSystemBatteryInfo::USBCharger; @@ -1877,12 +1867,12 @@ QSystemBatteryInfoPrivate::QSystemBatteryInfoPrivate(QObject *parent) } else m_charger = QSystemBatteryInfo::NoCharger; m_previousChagrger = m_charger ; - m_deviceInfo->batteryCommonInfo()->AddObserver(this); + DeviceInfo::instance()->batteryCommonInfo()->AddObserver(this); } QSystemBatteryInfoPrivate::~QSystemBatteryInfoPrivate() { - m_deviceInfo->batteryCommonInfo()->RemoveObserver(this); + DeviceInfo::instance()->batteryCommonInfo()->RemoveObserver(this); if (m_batteryHWRM) { delete(m_batteryHWRM); @@ -1894,7 +1884,7 @@ QSystemBatteryInfoPrivate::~QSystemBatteryInfoPrivate() QSystemBatteryInfo::ChargerType QSystemBatteryInfoPrivate::chargerType() const { bool chargestate,usbstate; - m_deviceInfo->batteryCommonInfo()->ChargerType(chargestate,usbstate); + DeviceInfo::instance()->batteryCommonInfo()->ChargerType(chargestate,usbstate); QSystemBatteryInfo::ChargerType result = QSystemBatteryInfo::UnknownCharger; if (chargestate) { if (usbstate) @@ -1908,7 +1898,7 @@ QSystemBatteryInfo::ChargerType QSystemBatteryInfoPrivate::chargerType() const QSystemBatteryInfo::ChargingState QSystemBatteryInfoPrivate::chargingState() const { - bool batteryChargingState = m_deviceInfo->batteryCommonInfo()->ChargingState(); + bool batteryChargingState = DeviceInfo::instance()->batteryCommonInfo()->ChargingState(); QSystemBatteryInfo::ChargingState result = QSystemBatteryInfo::ChargingError; if (batteryChargingState) result = QSystemBatteryInfo::Charging; @@ -1920,23 +1910,23 @@ QSystemBatteryInfo::ChargingState QSystemBatteryInfoPrivate::chargingState() con int QSystemBatteryInfoPrivate::nominalCapacity() const { - return m_deviceInfo->batteryCommonInfo()->NominalCapacity(); + return DeviceInfo::instance()->batteryCommonInfo()->NominalCapacity(); } int QSystemBatteryInfoPrivate::remainingCapacityPercent() const { - return m_deviceInfo->batteryCommonInfo()->RemainingCapacityPercent(); + return DeviceInfo::instance()->batteryCommonInfo()->RemainingCapacityPercent(); } int QSystemBatteryInfoPrivate::remainingCapacity() const { - return m_deviceInfo->batteryCommonInfo()->RemainingCapacity(); + return DeviceInfo::instance()->batteryCommonInfo()->RemainingCapacity(); } int QSystemBatteryInfoPrivate::voltage() const { - return m_deviceInfo->batteryCommonInfo()->Voltage(); + return DeviceInfo::instance()->batteryCommonInfo()->Voltage(); } int QSystemBatteryInfoPrivate::remainingChargingTime() const @@ -1954,7 +1944,7 @@ int QSystemBatteryInfoPrivate::currentFlow() const int QSystemBatteryInfoPrivate::remainingCapacityBars() const { - return m_deviceInfo->batteryCommonInfo()->RemainingCapacityBars(); + return DeviceInfo::instance()->batteryCommonInfo()->RemainingCapacityBars(); } int QSystemBatteryInfoPrivate::maxBars() const @@ -1965,7 +1955,7 @@ int QSystemBatteryInfoPrivate::maxBars() const QSystemBatteryInfo::BatteryStatus QSystemBatteryInfoPrivate::batteryStatus() const { QString logString; - int batteryStatusVal = m_deviceInfo->batteryCommonInfo()->BatteryStatus(); + int batteryStatusVal = DeviceInfo::instance()->batteryCommonInfo()->BatteryStatus(); QSystemBatteryInfo::BatteryStatus result = QSystemBatteryInfo::BatteryUnknown; switch (batteryStatusVal) { case EBatteryStatusOk : result = QSystemBatteryInfo:: BatteryOk ; @@ -2055,7 +2045,7 @@ void QSystemBatteryInfoPrivate::changedChargingState() { void QSystemBatteryInfoPrivate::changedChargerType() { bool chargestate,usbstate; - m_deviceInfo->batteryCommonInfo()->ChargerType(chargestate,usbstate); + DeviceInfo::instance()->batteryCommonInfo()->ChargerType(chargestate,usbstate); if (chargestate) { if (usbstate) m_charger = QSystemBatteryInfo::USBCharger; diff --git a/src/systeminfo/qsysteminfo_s60_p.h b/src/systeminfo/qsysteminfo_s60_p.h index 8a774960ae..9a1aa99890 100644 --- a/src/systeminfo/qsysteminfo_s60_p.h +++ b/src/systeminfo/qsysteminfo_s60_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010-2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -89,30 +89,15 @@ #include "networkoperatornamelistener_s60.h" #endif +#include <QThread> QT_BEGIN_HEADER QTM_BEGIN_NAMESPACE const int KMaxBatteryBars = 7; //Max number of battery bars (7 is fixed for all symbian devices now) -class DeviceInfo; - -//////// QSystemInfoPrivateBase -class QSystemInfoPrivateBase : public QObject -{ - Q_OBJECT - -public: - - QSystemInfoPrivateBase(QObject *parent = 0); - virtual ~QSystemInfoPrivateBase(); - -protected: - DeviceInfo* m_deviceInfo; -}; - //////// QSystemInfo -class QSystemInfoPrivate : public QSystemInfoPrivateBase +class QSystemInfoPrivate : public QObject { Q_OBJECT @@ -137,7 +122,7 @@ private: }; //////// QSystemNetworkInfo -class QSystemNetworkInfoPrivate : public QSystemInfoPrivateBase, public MTelephonyInfoObserver, public MNetworkInfoObserver, public MWlanInfoObserver +class QSystemNetworkInfoPrivate : public QObject, public MTelephonyInfoObserver, public MNetworkInfoObserver, public MWlanInfoObserver #ifdef NETWORKHANDLER_SYMBIAN_SUPPORTED , public MNetworkOperatorNameObserver #endif @@ -245,7 +230,7 @@ private: }; //////// QSystemStorageInfo -class QSystemStorageInfoPrivate : public QSystemInfoPrivateBase, +class QSystemStorageInfoPrivate : public QObject, public MStorageStatusObserver #ifdef DISKNOTIFY_SUPPORTED ,public MStorageSpaceNotifyObserver @@ -295,7 +280,7 @@ class MProEngNotifyHandler; QTM_BEGIN_NAMESPACE -class QSystemDeviceInfoPrivate : public QSystemInfoPrivateBase, +class QSystemDeviceInfoPrivate : public QObject, public MTelephonyInfoObserver, public MProEngProfileActivationObserver, public MCenRepNotifyHandlerCallback, @@ -435,18 +420,112 @@ private: //data class DeviceInfo { public: + static DeviceInfo *instance() + { + TRACES( qDebug() << "DeviceInfo::instance()" + << ": QThread id = " << QThread::currentThread() + << "Symbian thread id = " << RThread().Id().Id()); + if (!Dll::Tls()) + { + Dll::SetTls(new DeviceInfo); + TRACES( qDebug() << "DeviceInfo::instance() CREATED!" + << ": QThread id = " << QThread::currentThread() + << "Symbian thread id = " << RThread().Id().Id()); + } + return static_cast<DeviceInfo *>(Dll::Tls()); + } + + void initMobilePhonehandleL() + { + #ifdef ETELMM_SUPPORTED + if (m_rmobilePhoneInitialised) + return; + + TInt err = KErrNone; + err = m_etelServer.Connect(); + if ( err != KErrNone ) { + TRACES (qDebug() << "DeviceInfo:: InitMobilePhonehandle err code RTelServer::Connect" << err); + User::Leave(err); + } + + //Eumerate legal phone + // Get number of phones + TInt phones(0); + User::LeaveIfError(m_etelServer.EnumeratePhones(phones)); + + // Get phone info of first legal phone. + TInt legalPhoneIndex = KErrNotFound; + for (TInt i=0; i<phones && legalPhoneIndex == KErrNotFound; i++) + { + if (m_etelServer.GetPhoneInfo(i, m_etelphoneInfo) == KErrNone) + { + if (m_etelphoneInfo.iNetworkType == RTelServer::ENetworkTypeMobileDigital) + { + legalPhoneIndex = i; + } + } + } + User::LeaveIfError(legalPhoneIndex); + + err = m_rmobilePhone.Open(m_etelServer,m_etelphoneInfo.iName); + if (err != KErrNone) { + TRACES (qDebug() << "DeviceInfo:: InitMobilePhonehandle err code RMobilePhone::Open =" << err); + User::Leave(err); + } + + err = m_rmobilePhone.Initialise(); + if (err != KErrNone) { + TRACES (qDebug() << "DeviceInfo:: InitMobilePhonehandle err val for RMobilePhone::Initialise =" << err); + User::Leave(err); + } + + TRACES (qDebug() << "InitMobilePhonehandleL- successful"); + m_rmobilePhoneInitialised = true; + #endif + } + + void initRmobilePhone() + { + #ifdef ETELMM_SUPPORTED + TRAPD ( err,initMobilePhonehandleL()); + if (err ) { + m_rmobilePhone.Close(); + m_etelServer.Close(); + } + #endif + } + + bool etelmmSupported() + { + #ifdef ETELMM_SUPPORTED + return true; + #else + return false; + #endif + } + CPhoneInfo *phoneInfo() { + if (etelmmSupported() && !m_rmobilePhoneInitialised) initRmobilePhone(); if (!m_phoneInfo) { - m_phoneInfo = new CPhoneInfo(*m_telephony); +#ifdef ETELMM_SUPPORTED + m_phoneInfo = new CPhoneInfo(m_rmobilePhone); +#else + m_phoneInfo = new CPhoneInfo(*m_telephony); +#endif } return m_phoneInfo; } CSubscriberInfo *subscriberInfo() { + if (etelmmSupported() && !m_rmobilePhoneInitialised) initRmobilePhone(); if (!m_subscriberInfo) { - m_subscriberInfo = new CSubscriberInfo(*m_telephony); +#ifdef ETELMM_SUPPORTED + m_subscriberInfo = new CSubscriberInfo(m_rmobilePhone); +#else + m_subscriberInfo = new CSubscriberInfo(*m_telephony); +#endif } return m_subscriberInfo; } @@ -461,32 +540,52 @@ public: CBatteryInfo *batteryInfo() { + if (etelmmSupported() && !m_rmobilePhoneInitialised) initRmobilePhone(); if (!m_batteryInfo) { - m_batteryInfo = new CBatteryInfo(*m_telephony); +#ifdef ETELMM_SUPPORTED + m_batteryInfo = new CBatteryInfo(m_rmobilePhone); +#else + m_batteryInfo = new CBatteryInfo(*m_telephony); +#endif } return m_batteryInfo; } CCellNetworkInfo *cellNetworkInfo() { + if (etelmmSupported() && !m_rmobilePhoneInitialised) initRmobilePhone(); if (!m_cellNetworkInfo) { - m_cellNetworkInfo = new CCellNetworkInfo(*m_telephony); +#ifdef ETELMM_SUPPORTED + m_cellNetworkInfo = new CCellNetworkInfo(m_rmobilePhone); +#else + m_cellNetworkInfo = new CCellNetworkInfo(*m_telephony); +#endif } return m_cellNetworkInfo; } CCellNetworkRegistrationInfo *cellNetworkRegistrationInfo() { + if (etelmmSupported() && !m_rmobilePhoneInitialised) initRmobilePhone(); if (!m_cellNetworkRegistrationInfo) { - m_cellNetworkRegistrationInfo = new CCellNetworkRegistrationInfo(*m_telephony); +#ifdef ETELMM_SUPPORTED + m_cellNetworkRegistrationInfo = new CCellNetworkRegistrationInfo(m_rmobilePhone); +#else + m_cellNetworkRegistrationInfo = new CCellNetworkRegistrationInfo(*m_telephony); +#endif } return m_cellNetworkRegistrationInfo; } CCellSignalStrengthInfo *cellSignalStrenghtInfo() { + if (etelmmSupported() && !m_rmobilePhoneInitialised) initRmobilePhone(); if (!m_cellSignalStrengthInfo) { - m_cellSignalStrengthInfo = new CCellSignalStrengthInfo(*m_telephony); +#ifdef ETELMM_SUPPORTED + m_cellSignalStrengthInfo = new CCellSignalStrengthInfo(m_rmobilePhone); +#else + m_cellSignalStrengthInfo = new CCellSignalStrengthInfo(*m_telephony); +#endif } return m_cellSignalStrengthInfo; } @@ -589,6 +688,7 @@ public: #ifdef NETWORKHANDLER_SYMBIAN_SUPPORTED ,m_networkinfolistener(NULL) #endif + ,m_rmobilePhoneInitialised(false) { TRACES(qDebug() << "DeviceInfo():Constructor"); m_telephony = CTelephony::NewL(); @@ -624,6 +724,11 @@ public: #ifdef NETWORKHANDLER_SYMBIAN_SUPPORTED delete m_networkinfolistener; #endif + +#ifdef ETELMM_SUPPORTED + m_etelServer.Close(); + m_rmobilePhone.Close(); +#endif } private: @@ -657,9 +762,15 @@ private: CNetworkOperatorNameListener* m_networkinfolistener; #endif +#ifdef ETELMM_SUPPORTED + RTelServer m_etelServer; + RMobilePhone m_rmobilePhone; + RTelServer::TPhoneInfo m_etelphoneInfo; +#endif + bool m_rmobilePhoneInitialised; }; -class QSystemBatteryInfoPrivate : public QSystemInfoPrivateBase, public MBatteryInfoObserver, public MBatteryHWRMObserver +class QSystemBatteryInfoPrivate : public QObject, public MBatteryInfoObserver, public MBatteryHWRMObserver { Q_OBJECT public: diff --git a/src/systeminfo/symbian/telephonyinfo_s60.cpp b/src/systeminfo/symbian/telephonyinfo_s60.cpp index d381f04434..45d8446055 100644 --- a/src/systeminfo/symbian/telephonyinfo_s60.cpp +++ b/src/systeminfo/symbian/telephonyinfo_s60.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010-2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010-2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -45,16 +45,21 @@ #include <mmtsy_names.h> #endif +#ifndef ETELMM_SUPPORTED +// number of nested event loops allowed to avoid stackoverflow +const int KMaxLoops = 25; + CTelephonyInfo::CTelephonyInfo(CTelephony &telephony) : CActive(EPriorityStandard), - m_telephony(telephony) + m_telephony(telephony), m_loops() { CActiveScheduler::Add(this); } CTelephonyInfo::~CTelephonyInfo() { - delete iEventLoop; + //Cancel(); + exitWait(); } void CTelephonyInfo::addObserver(MTelephonyInfoObserver *observer) @@ -67,36 +72,65 @@ void CTelephonyInfo::removeObserver(MTelephonyInfoObserver *observer) m_observers.removeOne(observer); } -void CTelephonyInfo::RunL() +void CTelephonyInfo::waitForRequest() const { - TRACES (qDebug() << "CTelephonyInfo::RunL<---"); + TRACES (qDebug() << "CTelephonyInfo::waitForRequest<---"); + + //Restricing number of blocking loops + //Each call to api's e.g. IMSI must be blocked until they are initialized + //But we cannot maintain infinite number of blocked calls as stack is limited + //So restrict the number of loops after which we return uninitialized values + if (m_loops.size() <= KMaxLoops) { + QEventLoop* loop = NULL; + loop = new QEventLoop(); + if ( loop != NULL ) { + m_loops.push(loop); + loop->exec(); + delete loop; + } + } else { + qDebug() << "Blocked calls loop count exceeded"; + } - if ( iEventLoop ){ - TRACES (qDebug() << "eventloop::exiting"); - if (iEventLoop->isRunning()) iEventLoop->exit(); - } + TRACES (qDebug() << "CTelephonyInfo::waitForRequest--->"); } -void CTelephonyInfo::makeRequest() +void CTelephonyInfo::exitWait() const { - if (!IsActive()) - SetActive(); + TRACES (qDebug() << "CTelephonyInfo::ExitWait<---"); - if ( !iEventLoop ){ - iEventLoop = new QEventLoop(); - TRACES ( qDebug() << "started event loop..."); - } - iEventLoop->exec(); //start the loop + while (!m_loops.isEmpty()) + { + QEventLoop* loop = m_loops.pop(); + loop->quit(); + } + + TRACES (qDebug() << "CTelephonyInfo::ExitWait--->"); } -CPhoneInfo::CPhoneInfo(CTelephony &telephony) : CTelephonyInfo(telephony), - m_phoneIdV1Pckg(m_phoneIdV1) +CPhoneInfo::CPhoneInfo(CTelephony &telephony) : CTelephonyInfo(telephony),m_initializing(true) + ,m_phoneIdV1Pckg(m_phoneIdV1) { TRACES (qDebug() << "CPhoneInfo::CPhoneInfo<---"); + makeRequest(); + TRACES (qDebug() << "CPhoneInfo::CPhoneInfo--->"); +} + +void CPhoneInfo::makeRequest() +{ + TRACES (qDebug() << "CPhoneInfo::makeRequest<--"); + if (!IsActive()){ m_telephony.GetPhoneId(iStatus, m_phoneIdV1Pckg); + SetActive(); + } + TRACES (qDebug() << "CPhoneInfo::makeRequest-->"); +} - makeRequest(); +void CPhoneInfo::RunL() +{ + TRACES (qDebug() << "CPhoneInfo::RunL<---"); + if (iStatus == KErrNone) { TBuf<CTelephony::KPhoneSerialNumberSize> imei = m_phoneIdV1.iSerialNumber; m_imei = QString::fromUtf16(imei.Ptr(), imei.Length()); @@ -105,7 +139,14 @@ CPhoneInfo::CPhoneInfo(CTelephony &telephony) : CTelephonyInfo(telephony), TBuf<CTelephony::KPhoneModelIdSize> model = m_phoneIdV1.iModel; m_model = QString::fromUtf16(model.Ptr(), model.Length()); - TRACES (qDebug() << "CPhoneInfo::CPhoneInfo--->"); + + m_initializing = false; + } + + if (iStatus == KErrPermissionDenied) m_initializing =false; + exitWait(); + + TRACES (qDebug() << "CPhoneInfo::RunL--->"); } CPhoneInfo::~CPhoneInfo() @@ -115,34 +156,81 @@ CPhoneInfo::~CPhoneInfo() void CPhoneInfo::DoCancel() { - m_telephony.CancelAsync(CTelephony::EGetPhoneIdCancel); + TRACES (qDebug() << "CPhoneInfo::DoCancel<---"); + if (m_initializing) { + m_telephony.CancelAsync(CTelephony::EGetPhoneIdCancel); + } + TRACES (qDebug() << "CPhoneInfo::DoCancel--->"); } -QString CPhoneInfo::imei() const +QString CPhoneInfo::imei() { - return m_imei; + TRACES (qDebug() << "CPhoneInfo::imei:" << m_imei); + + if (m_initializing) { + makeRequest(); + waitForRequest(); + } + + return m_imei; } -QString CPhoneInfo::manufacturer() const +QString CPhoneInfo::manufacturer() { - return m_manufacturer; + TRACES (qDebug() << "CPhoneInfo::manufacturer:" << m_manufacturer); + + if (m_initializing) { + makeRequest(); + waitForRequest(); + } + + return m_manufacturer; } -QString CPhoneInfo::model() const +QString CPhoneInfo::model() { - return m_model; + TRACES (qDebug() << "CPhoneInfo::model:" << m_model); + + if (m_initializing) { + makeRequest(); + waitForRequest(); + } + + return m_model; } -CSubscriberInfo::CSubscriberInfo(CTelephony &telephony) : CTelephonyInfo(telephony), - m_subscriberIdV1Pckg(m_subscriberIdV1) +CSubscriberInfo::CSubscriberInfo(CTelephony &telephony) : CTelephonyInfo(telephony),m_initializing(true) + ,m_subscriberIdV1Pckg(m_subscriberIdV1) { TRACES (qDebug() << "CSubscriberInfo::CSubscriberInfo<---"); + makeRequest(); + TRACES (qDebug() << "CSubscriberInfo::CSubscriberInfo--->"); +} + +void CSubscriberInfo::makeRequest() +{ + TRACES (qDebug() << "CSubscriberInfo::MakeRequest<---"); + if (!IsActive()) { m_telephony.GetSubscriberId(iStatus, m_subscriberIdV1Pckg); - makeRequest(); + SetActive(); + } + TRACES (qDebug() << "CSubscriberInfo::MakeRequest--->"); +} + +void CSubscriberInfo::RunL() +{ + TRACES (qDebug() << "CSubscriberInfo::RunL<---"); + if (iStatus == KErrNone) { TBuf<CTelephony::KIMSISize> imsi = m_subscriberIdV1.iSubscriberId; m_imsi = QString::fromUtf16(imsi.Ptr(), imsi.Length()); - TRACES (qDebug() << "CSubscriberInfo::CSubscriberInfo--->"); + m_initializing = false; + } + + if (iStatus == KErrPermissionDenied ) m_initializing = false; + exitWait(); + + TRACES (qDebug() << "CSubscriberInfo::RunL--->"); } CSubscriberInfo::~CSubscriberInfo() @@ -152,26 +240,31 @@ CSubscriberInfo::~CSubscriberInfo() void CSubscriberInfo::DoCancel() { - m_telephony.CancelAsync(CTelephony::EGetSubscriberIdCancel); + TRACES (qDebug() << "CSubscriberInfo::DoCancel<---"); + if (m_initializing) { + m_telephony.CancelAsync(CTelephony::EGetSubscriberIdCancel); + } + TRACES (qDebug() << "CSubscriberInfo::DoCancel--->"); } -QString CSubscriberInfo::imsi() const +QString CSubscriberInfo::imsi() { - return m_imsi; + TRACES (qDebug() << "CSubscriberInfo::imsi:" << m_imsi); + if (m_initializing) { + makeRequest(); + waitForRequest(); + } + return m_imsi; } CBatteryInfo::CBatteryInfo(CTelephony &telephony) : CTelephonyInfo(telephony), m_initializing(true), m_batteryInfoV1Pckg(m_batteryInfoV1) { TRACES (qDebug() << "CBatteryInfo::CBatteryInfo<---"); - m_telephony.GetBatteryInfo(iStatus, m_batteryInfoV1Pckg); - - makeRequest(); - m_batteryLevel = m_batteryInfoV1.iChargeLevel; - m_previousBatteryLevel = m_batteryLevel; + m_telephony.GetBatteryInfo(iStatus, m_batteryInfoV1Pckg); + SetActive(); - startMonitoring(); TRACES (qDebug() << "CBatteryInfo::CBatteryInfo--->"); } @@ -183,46 +276,64 @@ CBatteryInfo::~CBatteryInfo() void CBatteryInfo::RunL() { TRACES (qDebug() << "CBatteryInfo::RunL<---"); - if (m_initializing) { - CTelephonyInfo::RunL(); - m_initializing = false; - } else { - m_batteryLevel = m_batteryInfoV1.iChargeLevel; + + if (iStatus == KErrNone) { + m_batteryLevel = m_batteryInfoV1.iChargeLevel; + + if (!m_initializing) { foreach (MTelephonyInfoObserver *observer, m_observers) { - if (m_batteryLevel != m_previousBatteryLevel) { - observer->batteryLevelChanged(); - } - } + if (m_batteryLevel != m_previousBatteryLevel) + observer->batteryLevelChanged(); + } + } + m_previousBatteryLevel = m_batteryLevel; } - m_previousBatteryLevel = m_batteryLevel; + + if (m_initializing) { + m_initializing = false; + exitWait(); + if (iStatus == KErrPermissionDenied) { + return; //No monitoring required + } + } + startMonitoring(); + TRACES (qDebug() << "CBatteryInfo::RunL--->"); } void CBatteryInfo::DoCancel() { TRACES (qDebug() << "CBatteryInfo::DoCancel<---"); - if (m_initializing) { - m_telephony.CancelAsync(CTelephony::EGetBatteryInfoCancel); - } else { - m_telephony.CancelAsync(CTelephony::EBatteryInfoChangeCancel); + if (m_initializing) { + m_telephony.CancelAsync(CTelephony::EGetBatteryInfoCancel); + } + else + { + m_telephony.CancelAsync(CTelephony::EBatteryInfoChangeCancel); } TRACES (qDebug() << "CBatteryInfo::DoCancel--->"); } - int CBatteryInfo::batteryLevel() const { - return m_batteryLevel; + TRACES (qDebug() << "CBatteryInfo::batteryLevel:" << m_batteryLevel); + + if (m_initializing) + waitForRequest(); + + return m_batteryLevel; } void CBatteryInfo::startMonitoring() { TRACES (qDebug() << "CBatteryInfo::startMonitoring<---"); + if (!IsActive()) { m_telephony.NotifyChange(iStatus, CTelephony::EBatteryInfoChange, m_batteryInfoV1Pckg); SetActive(); } + TRACES (qDebug() << "CBatteryInfo::startMonitoring--->"); } @@ -230,33 +341,10 @@ CCellNetworkInfo::CCellNetworkInfo(CTelephony &telephony) : CTelephonyInfo(telep m_initializing(true), m_networkInfoV1Pckg(m_networkInfoV1) { TRACES (qDebug() << "CCellNetworkInfo::CCellNetworkInfo<---"); - m_telephony.GetCurrentNetworkInfo(iStatus, m_networkInfoV1Pckg); - makeRequest(); - - m_cellId = m_networkInfoV1.iCellId; - m_previouscellId = m_cellId; - m_locationAreaCode = m_networkInfoV1.iLocationAreaCode; - - TBuf<CTelephony::KNetworkIdentitySize> networkId = m_networkInfoV1.iNetworkId; - m_networkId = QString::fromUtf16(networkId.Ptr(), networkId.Length()); - m_previousNetworkId = m_networkId; - - TBuf<CTelephony::KNetworkCountryCodeSize> countryCode = m_networkInfoV1.iCountryCode; - m_countryCode = QString::fromUtf16(countryCode.Ptr(), countryCode.Length()); - m_previousCountryCode = m_countryCode; - TBuf<CTelephony::KNetworkLongNameSize> longName = m_networkInfoV1.iLongName; - if (longName.Length() > 0) { - m_networkName = QString::fromUtf16(longName.Ptr(), longName.Length()); - } else { - TBuf<CTelephony::KNetworkDisplayTagSize> displayTag = m_networkInfoV1.iDisplayTag; - m_networkName = QString::fromUtf16(displayTag.Ptr(), displayTag.Length()); - } - m_previousNetworkName = m_networkName; - m_networkMode = m_networkInfoV1.iMode; - m_previousNetworkMode = m_networkMode; + m_telephony.GetCurrentNetworkInfo(iStatus, m_networkInfoV1Pckg); + SetActive(); - startMonitoring(); TRACES (qDebug() << "CCellNetworkInfo::CCellNetworkInfo--->"); } @@ -268,95 +356,130 @@ CCellNetworkInfo::~CCellNetworkInfo() void CCellNetworkInfo::RunL() { TRACES (qDebug() << "CCellNetworkInfo::RunL<---"); - if (m_initializing) { - CTelephonyInfo::RunL(); - m_initializing = false; - } else { - if (iStatus != KErrNone) return; //To avoid looping if app doesn't have ReadDeviceData caps - m_cellId = m_networkInfoV1.iCellId; - m_locationAreaCode = m_networkInfoV1.iLocationAreaCode; - TBuf<CTelephony::KNetworkIdentitySize> networkId = m_networkInfoV1.iNetworkId; - m_networkId = QString::fromUtf16(networkId.Ptr(), networkId.Length()); + if (iStatus == KErrNone) { + m_cellId = m_networkInfoV1.iCellId; + m_locationAreaCode = m_networkInfoV1.iLocationAreaCode; - TBuf<CTelephony::KNetworkCountryCodeSize> countryCode = m_networkInfoV1.iCountryCode; - m_countryCode = QString::fromUtf16(countryCode.Ptr(), countryCode.Length()); + TBuf<CTelephony::KNetworkIdentitySize> networkId = m_networkInfoV1.iNetworkId; + m_networkId = QString::fromUtf16(networkId.Ptr(), networkId.Length()); - TBuf<CTelephony::KNetworkLongNameSize> longName = m_networkInfoV1.iLongName; - if (longName.Length() > 0) { - m_networkName = QString::fromUtf16(longName.Ptr(), longName.Length()); - } else { - TBuf<CTelephony::KNetworkDisplayTagSize> displayTag = m_networkInfoV1.iDisplayTag; - m_networkName = QString::fromUtf16(displayTag.Ptr(), displayTag.Length()); - } + TBuf<CTelephony::KNetworkCountryCodeSize> countryCode = m_networkInfoV1.iCountryCode; + m_countryCode = QString::fromUtf16(countryCode.Ptr(), countryCode.Length()); - m_networkMode = m_networkInfoV1.iMode; + TBuf<CTelephony::KNetworkLongNameSize> longName = m_networkInfoV1.iLongName; + if (longName.Length() > 0) { + m_networkName = QString::fromUtf16(longName.Ptr(), longName.Length()); + } else { + TBuf<CTelephony::KNetworkDisplayTagSize> displayTag = m_networkInfoV1.iDisplayTag; + m_networkName = QString::fromUtf16(displayTag.Ptr(), displayTag.Length()); + } - foreach (MTelephonyInfoObserver *observer, m_observers) { - if (m_networkId != m_previousNetworkId) { - observer->networkCodeChanged(); - } - if (m_countryCode != m_previousCountryCode) { - observer->countryCodeChanged(); - } - if (m_networkName != m_previousNetworkName) { - observer->networkNameChanged(); - } - if (m_networkMode != m_previousNetworkMode) { - observer->networkModeChanged(); - } - if (m_cellId != m_previouscellId) { - observer->changedCellId(m_cellId); - } - } - m_previousNetworkId = m_networkId; - m_previousCountryCode = m_countryCode; - m_previousNetworkName = m_networkName; - m_previousNetworkMode = m_networkMode; - m_previouscellId = m_cellId; - startMonitoring(); + m_networkMode = m_networkInfoV1.iMode; + + if (!m_initializing) { + foreach (MTelephonyInfoObserver *observer, m_observers) { + if (m_networkId != m_previousNetworkId) { + observer->networkCodeChanged(); + } + if (m_countryCode != m_previousCountryCode) { + observer->countryCodeChanged(); + } + if (m_networkName != m_previousNetworkName) { + observer->networkNameChanged(); + } + if (m_networkMode != m_previousNetworkMode) { + observer->networkModeChanged(); + } + if (m_cellId != m_previouscellId) { + observer->changedCellId(m_cellId); + } + } + } + + m_previouscellId = m_cellId; + m_previousNetworkId = m_networkId; + m_previousCountryCode = m_countryCode; + m_previousNetworkName = m_networkName; + m_previousNetworkMode = m_networkMode; } + + if (m_initializing) { + m_initializing = false; + exitWait(); + if (iStatus == KErrPermissionDenied) { + return; //No monitoring required + } + } + + startMonitoring(); TRACES (qDebug() << "CCellNetworkInfo::RunL--->"); } void CCellNetworkInfo::DoCancel() { - TRACES (qDebug() << "CCellNetworkInfo::DoCancel--->"); + TRACES (qDebug() << "CCellNetworkInfo::DoCancel<---"); if (m_initializing) { m_telephony.CancelAsync(CTelephony::EGetCurrentNetworkInfoCancel); } else { m_telephony.CancelAsync(CTelephony::ECurrentNetworkInfoChangeCancel); } - TRACES (qDebug() << "CCellNetworkInfo::DoCancel<---"); + TRACES (qDebug() << "CCellNetworkInfo::DoCancel--->"); } int CCellNetworkInfo::cellId() const { - return m_cellId; + TRACES (qDebug() << "CCellNetworkInfo::cellId:" << m_cellId); + + if (m_initializing) + waitForRequest(); + + return m_cellId; } int CCellNetworkInfo::locationAreaCode() const { - return m_locationAreaCode; + TRACES (qDebug() << "CCellNetworkInfo::locationAreaCode:" << m_locationAreaCode); + + if (m_initializing) + waitForRequest(); + + return m_locationAreaCode; } QString CCellNetworkInfo::countryCode() const { - return m_countryCode; + TRACES (qDebug() << "CCellNetworkInfo::countryCode:" << m_countryCode); + + if (m_initializing) + waitForRequest(); + + return m_countryCode; } QString CCellNetworkInfo::networkCode() const { - return m_networkId; + TRACES (qDebug() << "CCellNetworkInfo::networkCode:" << m_networkId); + + if (m_initializing) + waitForRequest(); + + return m_networkId; } QString CCellNetworkInfo::networkName() const { - return m_networkName; + TRACES (qDebug() << "CCellNetworkInfo::networkName<---"); + + if (m_initializing) + waitForRequest(); + + return m_networkName; } QString CCellNetworkInfo::homeNetworkCode() { + TRACES (qDebug() << "CCellNetworkInfo::homeNetworkCode<---"); #ifdef ETELMM_SUPPORTED RTelServer telServer; RMobilePhone mobilePhone; @@ -406,16 +529,23 @@ QString CCellNetworkInfo::homeNetworkCode() CTelephony::TNetworkMode CCellNetworkInfo::networkMode() const { - return m_networkMode; + TRACES (qDebug() << "CCellNetworkInfo::networkMode:" << m_networkMode); + + if (m_initializing) + waitForRequest(); + + return m_networkMode; } void CCellNetworkInfo::startMonitoring() { TRACES (qDebug() << "CCellNetworkInfo::startMonitoring<---"); + if (!IsActive()) { m_telephony.NotifyChange(iStatus, CTelephony::ECurrentNetworkInfoChange, m_networkInfoV1Pckg); SetActive(); } + TRACES (qDebug() << "CCellNetworkInfo::startMonitoring--->"); } @@ -423,13 +553,10 @@ CCellNetworkRegistrationInfo::CCellNetworkRegistrationInfo(CTelephony &telephony m_initializing(true), m_networkRegistrationV1Pckg(m_networkRegistrationV1) { TRACES (qDebug() << "CCellNetworkRegistrationInfo::CCellNetworkRegistrationInfo--->"); - m_telephony.GetNetworkRegistrationStatus(iStatus, m_networkRegistrationV1Pckg); - makeRequest(); - m_networkStatus = m_networkRegistrationV1.iRegStatus; - m_previousNetworkStatus = m_networkStatus; + m_telephony.GetNetworkRegistrationStatus(iStatus, m_networkRegistrationV1Pckg); + SetActive(); - startMonitoring(); TRACES (qDebug() << "CCellNetworkRegistrationInfo::CCellNetworkRegistrationInfo<---"); } @@ -441,21 +568,27 @@ CCellNetworkRegistrationInfo::~CCellNetworkRegistrationInfo() void CCellNetworkRegistrationInfo::RunL() { TRACES (qDebug() << "CCellNetworkRegistrationInfo::RunL<---"); - if (m_initializing) { - CTelephonyInfo::RunL(); - m_initializing = false; - } else { - if (iStatus != KErrNone) return; //To avoid looping if app doesn't have ReadDeviceData caps - m_networkStatus = m_networkRegistrationV1.iRegStatus; - + if (iStatus == KErrNone) { + m_networkStatus = m_networkRegistrationV1.iRegStatus; + if (!m_initializing) { foreach (MTelephonyInfoObserver *observer, m_observers) { if (m_networkStatus != m_previousNetworkStatus) { observer->cellNetworkStatusChanged(); } } - m_previousNetworkStatus = m_networkStatus; - startMonitoring(); + } + m_previousNetworkStatus = m_networkStatus; } + + if (m_initializing) { + m_initializing = false; + exitWait(); + if (iStatus == KErrPermissionDenied) { + return; //No monitoring required + } + } + + startMonitoring(); TRACES (qDebug() << "CCellNetworkRegistrationInfo::RunL--->"); } @@ -472,16 +605,23 @@ void CCellNetworkRegistrationInfo::DoCancel() CTelephony::TRegistrationStatus CCellNetworkRegistrationInfo::cellNetworkStatus() const { - return m_networkStatus; + TRACES (qDebug() << "CCellNetworkRegistrationInfo::cellNetworkStatus:" << m_networkStatus); + + if (m_initializing) + waitForRequest(); + + return m_networkStatus; } void CCellNetworkRegistrationInfo::startMonitoring() { TRACES (qDebug() << "CCellNetworkRegistrationInfo::startMonitoring<---"); + if (!IsActive()) { m_telephony.NotifyChange(iStatus, CTelephony::ENetworkRegistrationStatusChange, m_networkRegistrationV1Pckg); SetActive(); } + TRACES (qDebug() << "CCellNetworkRegistrationInfo::startMonitoring--->"); } @@ -489,16 +629,10 @@ CCellSignalStrengthInfo::CCellSignalStrengthInfo(CTelephony &telephony) : CTelep m_initializing(true), m_signalStrengthV1Pckg(m_signalStrengthV1) { TRACES (qDebug() << "CCellSignalStrengthInfo::CCellSignalStrengthInfo<---"); - m_telephony.GetSignalStrength(iStatus, m_signalStrengthV1Pckg); - makeRequest(); - m_cellNetworkSignalStrength = m_signalStrengthV1.iSignalStrength; - m_previousCellNetworkSignalStrength = m_cellNetworkSignalStrength; - - m_signalBar = m_signalStrengthV1.iBar; - m_previousSignalBar = m_signalBar; + m_telephony.GetSignalStrength(iStatus, m_signalStrengthV1Pckg); + SetActive(); - startMonitoring(); TRACES (qDebug() << "CCellSignalStrengthInfo::CCellSignalStrengthInfo--->"); } @@ -510,22 +644,33 @@ CCellSignalStrengthInfo::~CCellSignalStrengthInfo() void CCellSignalStrengthInfo::RunL() { TRACES (qDebug() << "CCellSignalStrengthInfo::RunL<---"); - if (m_initializing) { - CTelephonyInfo::RunL(); - m_initializing = false; - } else { - if (iStatus != KErrNone) return; //To avoid looping if app doesn't have ReadDeviceData caps - m_cellNetworkSignalStrength = m_signalStrengthV1.iSignalStrength; - m_signalBar = m_signalStrengthV1.iBar; - if (m_signalBar != m_previousSignalBar) { - foreach (MTelephonyInfoObserver *observer, m_observers) { - observer->cellNetworkSignalStrengthChanged(); - } - } - m_previousSignalBar = m_signalBar; - startMonitoring(); + if (iStatus == KErrNone) { + m_cellNetworkSignalStrength = m_signalStrengthV1.iSignalStrength; + m_signalBar = m_signalStrengthV1.iBar; + + if (!m_initializing) { + if (m_signalBar != m_previousSignalBar) { + foreach (MTelephonyInfoObserver *observer, m_observers) { + observer->cellNetworkSignalStrengthChanged(); + } + } + } + + m_previousCellNetworkSignalStrength = m_cellNetworkSignalStrength; + m_previousSignalBar = m_signalBar; } + + if (m_initializing) { + m_initializing = false; + exitWait(); + if (iStatus == KErrPermissionDenied) { + return; //No monitoring required + } + } + + startMonitoring(); + TRACES (qDebug() << "CCellSignalStrengthInfo::RunL--->"); } @@ -542,6 +687,9 @@ void CCellSignalStrengthInfo::DoCancel() int CCellSignalStrengthInfo::cellNetworkSignalStrength() const { + TRACES (qDebug() << "CCellSignalStrengthInfo::cellNetworkSignalStrength<---"); + if (m_initializing) + waitForRequest(); //Workaround solution based on the number of signal bars (max. 7) return int((TReal(m_signalBar) * 100.0 + 0.5) / 7.0); } @@ -555,3 +703,639 @@ void CCellSignalStrengthInfo::startMonitoring() } TRACES (qDebug() << "CCellSignalStrengthInfo::startMonitoring--->"); } +#else //ETELMM_SUPPORTED +CPhoneInfo::CPhoneInfo(RMobilePhone &aMobilePhone): + m_rmobilePhone(aMobilePhone),m_phoneInfoinitialised(false) +{ + TRACES (qDebug() << "CPhoneInfov2::Constructor<--"); + TRACES (qDebug() << "CPhoneInfov2::Constructor-->"); +} + +CPhoneInfo::~CPhoneInfo() +{ + TRACES (qDebug() << "CPhoneInfov2::Destructor<--"); + TRACES (qDebug() << "CPhoneInfov2::Destructor-->"); +} + +void CPhoneInfo::initialise() +{ + TRACES (qDebug() << "CPhoneInfov2::Initialise<--"); + + if (m_phoneInfoinitialised) + { + TRACES(qDebug() << "CPhoneInfov2 already initialised, return"); + return; + } + + //RMobilePhone implementation + //check for identity capabilities + TUint32 identityCaps; + TInt capabilityErr = m_rmobilePhone.GetIdentityCaps(identityCaps); + if (capabilityErr != KErrNone) + { + TRACES ( qDebug() << "CPhoneInfo::initialise-capability error:" << capabilityErr); + return; + } + + //Initialize imei,imsi, manufacturer + TRequestStatus phoneInforeqstatus; + RMobilePhone::TMobilePhoneIdentityV1 mobilePhoneIdentity; + m_rmobilePhone.GetPhoneId(phoneInforeqstatus, mobilePhoneIdentity); + User::WaitForRequest(phoneInforeqstatus); + if ( phoneInforeqstatus == KErrNone ) { + m_model = QString::fromUtf16(mobilePhoneIdentity.iModel.Ptr(), mobilePhoneIdentity.iModel.Length()); + m_manufacturer = QString::fromUtf16(mobilePhoneIdentity.iManufacturer.Ptr(), mobilePhoneIdentity.iManufacturer.Length()); + m_imei = QString::fromUtf16(mobilePhoneIdentity.iSerialNumber.Ptr(), mobilePhoneIdentity.iSerialNumber.Length()); + TRACES ( qDebug() << "CPhoneInfov2::Model:" << m_model); + TRACES ( qDebug() << "CPhoneInfov2::Manufacturer:" << m_manufacturer); + TRACES ( qDebug() << "CPhoneInfov2::Imei:" << m_imei); + m_phoneInfoinitialised = true; + } + + TRACES (qDebug() << "CPhoneInfov2::Initialise-->"); +} + +QString CPhoneInfo::imei() +{ + TRACES (qDebug() << "query CPhoneInfov2::IMEI" << m_imei); + initialise(); + return m_imei; +} + +QString CPhoneInfo::manufacturer() +{ + TRACES (qDebug() << "query CPhoneInfov2::manufacturer" << m_manufacturer); + initialise(); + return m_manufacturer; +} + +QString CPhoneInfo::model() +{ + TRACES (qDebug() << "query CPhoneInfov2::model" << m_model); + initialise(); + return m_model; +} + +CSubscriberInfo::CSubscriberInfo(RMobilePhone &aMobilePhone): + m_rmobilePhone(aMobilePhone),m_subscriberInfoinitialised(false) +{ + TRACES (qDebug() << "CSubscriberInfov2::Constructor<--"); + TRACES (qDebug() << "CSubscriberInfov2::Constructor-->"); +} + +CSubscriberInfo::~CSubscriberInfo() +{ + TRACES (qDebug() << "CSubscriberInfov2::Destructor<--"); + TRACES (qDebug() << "CSubscriberInfo2::Destructor-->"); +} + +void CSubscriberInfo::initialise() +{ + TRACES (qDebug() << "CSubscriberInfov2::Initialise<--"); + + if (m_subscriberInfoinitialised) + { + TRACES(qDebug() << "CSubscriberInfov2 already initialised, return"); + return; + } + + //RMobilePhone implementation + //check for identity capabilities + TUint32 identityCaps; + TInt capabilityErr = m_rmobilePhone.GetIdentityCaps(identityCaps); + if (capabilityErr != KErrNone) + { + TRACES ( qDebug() << "CSubscriberInfo::initialise-capability error:" << capabilityErr); + return; + } + + //Initialize imei,imsi, manufacturer + TRequestStatus subscriberInforeqstatus; + RMobilePhone::TMobilePhoneSubscriberId subscriberId; + m_rmobilePhone.GetSubscriberId(subscriberInforeqstatus, subscriberId); + User::WaitForRequest(subscriberInforeqstatus); + if ( subscriberInforeqstatus == KErrNone ) { + m_imsi = QString::fromUtf16(subscriberId.Ptr(), subscriberId.Length()); + TRACES ( qDebug() << "CSubscriberInfov2::Initialise.Imsi:" << m_imsi); + m_subscriberInfoinitialised = true; + } + + TRACES (qDebug() << "CSubscriberInfov2::Initialise-->"); +} + +QString CSubscriberInfo::imsi() +{ + TRACES (qDebug() << "query CSubscriberInfov2::IMSI" << m_imsi); + initialise(); + return m_imsi; +} + +CEtelInfo::CEtelInfo(RMobilePhone &aMobilePhone):CActive(EPriorityStandard), + m_rmobilePhone(aMobilePhone),m_initialised(false) +{ + CActiveScheduler::Add(this); +} + +CEtelInfo::~CEtelInfo() +{ +} + +void CEtelInfo::addObserver(MTelephonyInfoObserver *observer) +{ + m_observers.append(observer); +} + +void CEtelInfo::removeObserver(MTelephonyInfoObserver *observer) +{ + m_observers.removeOne(observer); +} + +CBatteryInfo::CBatteryInfo(RMobilePhone &aMobilePhone) + : CEtelInfo(aMobilePhone),m_batteryLevel(0) +{ + TRACES ( qDebug() << "CBatteryInfov2::constructor<--" ); + initialise(); + TRACES ( qDebug() << "CBatteryInfov2::constructor-->" ); +} + +void CBatteryInfo::initialise() +{ + TRACES (qDebug() << "CBatteryInfov2::initialise<--"); + if (m_initialised) + { + TRACES (qDebug() << "CBatteryInfov2 already initialised,return"); + return; + } + //Check BatteryCaps + TUint32 batteryCaps; + TInt batteryCapserror = m_rmobilePhone.GetBatteryCaps(batteryCaps); + if ( batteryCapserror != KErrNone) TRACES ( qDebug() << "CBatteryInfo::initialise-capability error:" << batteryCapserror); + + if ( batteryCapserror == KErrNone && (batteryCaps & RMobilePhone::KCapsGetBatteryInfo) ) { + TRequestStatus batterystatus; + m_rmobilePhone.GetBatteryInfo(batterystatus, m_batteryinfo); + User::WaitForRequest(batterystatus); + if (batterystatus == KErrNone){ + m_batteryLevel = m_batteryinfo.iChargeLevel; + TRACES(qDebug() << "CBatteryInfov2:Initial chargelevel:" << m_batteryLevel); + m_initialised = true; + } + } + + if ( batteryCapserror == KErrPermissionDenied) + { + m_initialised = true; + return; + } + + if (batteryCaps & RMobilePhone::KCapsNotifyBatteryInfoChange) startMonitoring(); + + TRACES (qDebug() << "CBatteryInfov2::initialise-->"); +} + +CBatteryInfo::~CBatteryInfo() +{ + Cancel(); +} + +void CBatteryInfo::DoCancel() +{ + TRACES ( qDebug() << "CBatteryInfov2::DoCancel<--" ); + if (IsActive()) + m_rmobilePhone.CancelAsyncRequest(EMobilePhoneNotifyBatteryInfoChange); + TRACES ( qDebug() << "CBatteryInfov2::DoCancel-->" ); +} + +void CBatteryInfo::RunL() +{ + TRACES(qDebug() << "CBatteryInfov2::RunL()<---"); + if (iStatus == KErrNone) + { + if ( m_batteryLevel != m_batteryinfo.iChargeLevel ) { + foreach (MTelephonyInfoObserver *observer, m_observers) { + TRACES (qDebug() << "Notifying batteryLevelChanged"); + observer->batteryLevelChanged(); + } + } + m_batteryLevel = m_batteryinfo.iChargeLevel; + } + startMonitoring(); + TRACES(qDebug() << "CBatteryInfov2::RunL()--->"); +} + +void CBatteryInfo::startMonitoring() +{ + TRACES(qDebug() << "CBatteryInfov2::StartMonitoring--start"); + if (!IsActive()) { + m_rmobilePhone.NotifyBatteryInfoChange(iStatus, m_batteryinfo); + SetActive(); + } + TRACES(qDebug() << "CBatteryInfov2::StartMonitoring--End"); +} + +int CBatteryInfo::batteryLevel() const +{ + TRACES (qDebug() << "CBatteryInfov2::batteryLevel:" << m_batteryLevel); + return m_batteryLevel; +} + +//Signal Strength +CCellSignalStrengthInfo::CCellSignalStrengthInfo(RMobilePhone &aMobilePhone) + :CEtelInfo(aMobilePhone) +{ + TRACES(qDebug() << "CCellSignalStrengthInfov2::CCellSignalStrengthInfov2<---"); + initialise(); + TRACES(qDebug() << "CCellSignalStrengthInfov2::CCellSignalStrengthInfov2--->"); +} + +void CCellSignalStrengthInfo::initialise() +{ + TRACES (qDebug() << "CCellSignalStrengthInfov2::initialise<--"); + if (m_initialised) + { + TRACES (qDebug() << "CCellSignalStrengthInfov2 already initialised,return"); + return; + } + //Check Signal related Caps + TUint32 signalCaps; + TInt signalCapserror = m_rmobilePhone.GetSignalCaps(signalCaps); + if ( signalCapserror != KErrNone) TRACES ( qDebug() << "CCellSignalStrengthInfo::initialise-capability error:" << signalCapserror); + + if (signalCapserror == KErrNone) + { + TRequestStatus signalstatus; + if (signalCaps & RMobilePhone::KCapsGetSignalStrength) + { + m_rmobilePhone.GetSignalStrength(signalstatus, m_cellNetworkSignalStrength, m_signalBar); + User::WaitForRequest(signalstatus); + if ( signalstatus == KErrNone ) { + //m_prevcellNetworkSignalStrength = m_cellNetworkSignalStrength; + m_prevsignalBar = m_signalBar; + m_initialised = true; + } + } + } + + if ( signalCapserror == KErrPermissionDenied) + { + m_initialised = true; + return; + } + + if (signalCaps & RMobilePhone::KCapsNotifySignalStrengthChange) startMonitoring(); + TRACES (qDebug() << "CCellSignalStrengthInfov2::initialise-->"); +} + +CCellSignalStrengthInfo::~CCellSignalStrengthInfo() +{ + Cancel(); +} + +void CCellSignalStrengthInfo::DoCancel() +{ + TRACES ( qDebug() << "CCellSignalStrengthInfov2::DoCancel<--" ); + if (IsActive()) + m_rmobilePhone.CancelAsyncRequest(EMobilePhoneNotifySignalStrengthChange); + TRACES ( qDebug() << "CCellSignalStrengthInfov2::DoCancel-->" ); +} + +void CCellSignalStrengthInfo::RunL() +{ + TRACES(qDebug() << "CCellSignalStrengthInfov2::RunL()<---"); + if (iStatus == KErrNone) + { + if ( m_signalBar != m_prevsignalBar ) { + foreach (MTelephonyInfoObserver *observer, m_observers) { + TRACES (qDebug() << "Notifying cellNetworkSignalStrengthChanged"); + observer->cellNetworkSignalStrengthChanged(); + } + } + m_prevsignalBar = m_signalBar; + } + startMonitoring(); + TRACES(qDebug() << "CCellSignalStrengthInfov2::RunL()--->"); +} + +void CCellSignalStrengthInfo::startMonitoring() +{ + TRACES(qDebug() << "CCellSignalStrengthInfov2::StartMonitoring--start"); + if (!IsActive()) { + m_rmobilePhone.NotifySignalStrengthChange(iStatus, m_cellNetworkSignalStrength, m_signalBar); + SetActive(); + } + TRACES(qDebug() << "CCellSignalStrengthInfov2::StartMonitoring--End"); +} + +int CCellSignalStrengthInfo::cellNetworkSignalStrength() const +{ + TRACES(qDebug() << "CCellsignalstrengthv2::cellNetworkSignalStrength"); + return int((TReal(m_signalBar) * 100.0 + 0.5) / 7.0); +} + +CCellNetworkRegistrationInfo::CCellNetworkRegistrationInfo(RMobilePhone &aMobilePhone):CEtelInfo(aMobilePhone) +{ + TRACES(qDebug() << "CCellNetworkRegistrationInfov2::CCellNetworkRegistrationInfov2<---"); + initialise(); + TRACES(qDebug() << "CCellNetworkRegistrationInfov2::CCellNetworkRegistrationInfov2--->"); +} + +CCellNetworkRegistrationInfo::~CCellNetworkRegistrationInfo() +{ + Cancel(); +} + +void CCellNetworkRegistrationInfo::initialise() +{ + TRACES (qDebug() << "CCellNetworkRegistrationInfov2::initialise<--"); + if (m_initialised) + { + TRACES (qDebug() << "CCellNetworkRegistrationInfov2 already initialised,return"); + return; + } + + TUint32 capsPhone; + TInt capserror = m_rmobilePhone.GetMultimodeCaps(capsPhone); + if ( capserror != KErrNone) TRACES ( qDebug() << "CCellNetworkRegistrationInfo::initialise-capability error:" << capserror); + if (!capserror) { + TRequestStatus reqStatus; + m_rmobilePhone.GetNetworkRegistrationStatus(reqStatus, m_networkStatus); + User::WaitForRequest(reqStatus); + m_previousNetworkStatus = m_networkStatus; + m_initialised = true; + } + + if ( capserror == KErrPermissionDenied) + { + m_initialised = true; + return; + } + + startMonitoring(); + TRACES (qDebug() << "CCellNetworkRegistrationInfov2::initialise-->"); +} + +void CCellNetworkRegistrationInfo::RunL() +{ + TRACES (qDebug() << "CCellNetworkRegistrationInfov2::RunL()<---"); + if (iStatus == KErrNone) + { + if ( m_networkStatus != m_previousNetworkStatus) { + foreach (MTelephonyInfoObserver *observer, m_observers) { + TRACES (qDebug() << "Notifying cellnetworkstatusChanged"); + observer->cellNetworkStatusChanged(); + } + } + m_previousNetworkStatus = m_networkStatus; + } + startMonitoring(); + TRACES (qDebug() << "CCellNetworkRegistrationInfov2::RunL()--->"); +} + +void CCellNetworkRegistrationInfo::startMonitoring() +{ + TRACES (qDebug() << "CCellNetworkRegistrationInfov2::StartMonitoring<---"); + if (!IsActive()) { + m_rmobilePhone.NotifyNetworkRegistrationStatusChange(iStatus,m_networkStatus); + SetActive(); + } + TRACES (qDebug() << "CCellNetworkRegistrationInfov2::StartMonitoring--->"); +} + +void CCellNetworkRegistrationInfo::DoCancel() +{ + TRACES (qDebug() << "CCellNetworkRegistrationInfov2::DoCancel"); + m_rmobilePhone.CancelAsyncRequest(EMobilePhoneNotifyNetworkRegistrationStatusChange); +} + +RMobilePhone::TMobilePhoneRegistrationStatus CCellNetworkRegistrationInfo::cellNetworkStatus() const +{ + TRACES (qDebug() << "CCellNetworkRegistrationInfov2::cellNetworkStatus:" << m_networkStatus); + return m_networkStatus; +} + +CCellNetworkInfo::CCellNetworkInfo(RMobilePhone &aMobilePhone) + :CEtelInfo(aMobilePhone),iNetworkInfoPckg(iNetworkInfo) +{ + TRACES(qDebug() << "CCellNetworkInfov2::CCellNetworkInfov2<---"); + initialise(); + TRACES(qDebug() << "CCellNetworkInfov2::CCellNetworkInfov2--->"); +} + +void CCellNetworkInfo::initialise() +{ + TRACES (qDebug() << "CCellNetworkInfov2::initialise<--"); + + if (m_initialised) + { + TRACES (qDebug() << "CCellNetworkInfov2 already initialised,return"); + return; + } + + // Check Signal related Caps + TUint32 networkCaps; + TInt capserror = m_rmobilePhone.GetNetworkCaps(networkCaps); + if ( capserror != KErrNone) TRACES ( qDebug() << "CCellNetworkInfo::initialise-capability error:" << capserror); + if ( capserror == KErrNone && (networkCaps & RMobilePhone::KCapsGetCurrentNetwork)) + { + //For cellid & location area code, networkid, countrycode + TRequestStatus locationstatus; + m_rmobilePhone.GetCurrentNetwork(locationstatus, iNetworkInfoPckg, iLocation); + User::WaitForRequest(locationstatus); + if ( locationstatus == KErrNone ) + { + //cellid + m_cellId = iLocation.iCellId; + m_previouscellId = m_cellId; + + //location area code + m_locationAreaCode = iLocation.iLocationAreaCode; + + //network id + m_networkId = QString::fromUtf16(iNetworkInfo.iNetworkId.Ptr(), iNetworkInfo.iNetworkId.Length()); + m_previousNetworkId = m_networkId; + + //country code + m_countryCode = QString::fromUtf16(iNetworkInfo.iCountryCode.Ptr(), iNetworkInfo.iCountryCode.Length()); + m_previousCountryCode = m_countryCode; + + //networkname + RMobilePhone::TMobilePhoneNetworkLongName longName = iNetworkInfo.iLongName; + if (longName.Length() > 0 ) { + m_networkName = QString::fromUtf16(longName.Ptr(), longName.Length()); + } else { + RMobilePhone::TMobilePhoneNetworkDisplayTag displayTag = iNetworkInfo.iDisplayTag; + m_networkName = QString::fromUtf16(displayTag.Ptr(), displayTag.Length()); + } + m_previousNetworkName = m_networkName; + //network mode + m_networkMode = iNetworkInfo.iMode; + m_previousNetworkMode = m_networkMode; + m_initialised = true; + } + } + + if (capserror == KErrPermissionDenied) { + m_initialised = true; + return; + } + + if (networkCaps & RMobilePhone::KCapsNotifyCurrentNetwork) startMonitoring(); + + TRACES (qDebug() << "CCellNetworkInfov2::initialise-->"); +} + +CCellNetworkInfo::~CCellNetworkInfo() +{ + Cancel(); +} + +int CCellNetworkInfo::cellId() const +{ + TRACES (qDebug() << "CCellNetworkInfov2::cellId():" << m_cellId); + return m_cellId; +} + +int CCellNetworkInfo::locationAreaCode() const +{ + TRACES (qDebug() << "CCellNetworkInfov2::cellId():" << m_locationAreaCode); + return m_locationAreaCode; +} + +QString CCellNetworkInfo::countryCode() const +{ + TRACES (qDebug() << "CCellNetworkInfov2::countryCode():" << m_countryCode); + return m_countryCode; +} + +QString CCellNetworkInfo::networkCode() const +{ + TRACES (qDebug() << "CCellNetworkInfov2::networkCode():" << m_networkId); + return m_networkId; +} + +QString CCellNetworkInfo::networkName() const +{ + TRACES (qDebug() << "CCellNetworkInfov2::networkName():" << m_networkName); + return m_networkName; +} + +QString CCellNetworkInfo::homeNetworkCode() +{ + TRequestStatus homenetworkstatus; + RMobilePhone::TMobilePhoneNetworkInfoV1 infov1; + RMobilePhone::TMobilePhoneNetworkInfoV1Pckg statusPkg(infov1); + m_rmobilePhone.GetHomeNetwork(homenetworkstatus, statusPkg); + User::WaitForRequest(homenetworkstatus); + if (homenetworkstatus.Int() == KErrNone) + { + QString homeNetworkCode= QString::fromUtf16(infov1.iNetworkId.Ptr(), infov1.iNetworkId.Length()); + return homeNetworkCode; + } + else + return QString(); +} + +CTelephony::TNetworkMode CCellNetworkInfo::networkMode() const +{ + TRACES (qDebug() << "CCellNetworkInfov2::networkMode():" << m_networkMode); + switch (m_networkMode){ + case RMobilePhone::ENetworkModeUnregistered: + return CTelephony::ENetworkModeUnregistered; + case RMobilePhone::ENetworkModeGsm: + return CTelephony::ENetworkModeGsm; + case RMobilePhone::ENetworkModeAmps: + return CTelephony::ENetworkModeAmps; + case RMobilePhone::ENetworkModeCdma95: + return CTelephony::ENetworkModeCdma95; + case RMobilePhone::ENetworkModeCdma2000: + return CTelephony::ENetworkModeCdma2000; + case RMobilePhone::ENetworkModeWcdma: + return CTelephony::ENetworkModeWcdma; + /*case RMobilePhone::ENetworkModeTdcdma: + return CTelephony::ENetworkModeTdcdma;*/ + default: + return CTelephony::ENetworkModeUnknown; + } +} + +void CCellNetworkInfo::DoCancel() +{ + TRACES ( qDebug() << "CCellNetworkInfov2::DoCancel<--" ); + if (IsActive()) + m_rmobilePhone.CancelAsyncRequest(EMobilePhoneNotifyCurrentNetworkChange); + TRACES ( qDebug() << "CCellNetworkInfov2::DoCancel-->" ); +} + +void CCellNetworkInfo::RunL() +{ + TRACES(qDebug() << "CCellNetworkInfov2::RunL()<---"); + if (iStatus == KErrNone) + { + //cellid + m_cellId = iLocation.iCellId; + + //location area code + m_locationAreaCode = iLocation.iLocationAreaCode; + + //network id + m_networkId = QString::fromUtf16(iNetworkInfo.iNetworkId.Ptr(), iNetworkInfo.iNetworkId.Length()); + + //country code + m_countryCode = QString::fromUtf16(iNetworkInfo.iCountryCode.Ptr(), iNetworkInfo.iCountryCode.Length()); + + //networkname + RMobilePhone::TMobilePhoneNetworkLongName longName = iNetworkInfo.iLongName; + if (longName.Length() > 0 ) { + m_networkName = QString::fromUtf16(longName.Ptr(), longName.Length()); + } else { + RMobilePhone::TMobilePhoneNetworkDisplayTag displayTag = iNetworkInfo.iDisplayTag; + m_networkName = QString::fromUtf16(displayTag.Ptr(), displayTag.Length()); + } + + //network mode + m_networkMode = iNetworkInfo.iMode; + + foreach (MTelephonyInfoObserver *observer, m_observers) + { + if (m_networkId != m_previousNetworkId) { + TRACES (qDebug() << "Notifying networkcodechanged"); + observer->networkCodeChanged(); + } + if (m_countryCode != m_previousCountryCode) { + TRACES (qDebug() << "Notifying countryCodeChanged"); + observer->countryCodeChanged(); + } + if (m_networkName != m_previousNetworkName) { + TRACES (qDebug() << "Notifying networkNameChanged"); + observer->networkNameChanged(); + } + if (m_networkMode != m_previousNetworkMode) { + TRACES (qDebug() << "Notifying networkModeChanged"); + observer->networkModeChanged(); + } + if (m_cellId != m_previouscellId) { + TRACES (qDebug() << "Notifying cellId changes"); + observer->changedCellId(m_cellId); + } + } + m_previouscellId = m_cellId; + m_previousNetworkId = m_networkId; + m_previousCountryCode = m_countryCode; + m_previousNetworkName = m_networkName; + m_previousNetworkMode = m_networkMode; + } + startMonitoring(); + TRACES(qDebug() << "CCellNetworkInfov2::RunL()--->"); +} + +void CCellNetworkInfo::startMonitoring() +{ + TRACES(qDebug() << "CCellNetworkInfov2::StartMonitoring--start"); + if (!IsActive()) { + m_rmobilePhone.NotifyCurrentNetworkChange(iStatus, iNetworkInfoPckg, iLocation); + SetActive(); + } + TRACES(qDebug() << "CCellNetworkInfov2::StartMonitoring--End"); +} + +#endif diff --git a/src/systeminfo/symbian/telephonyinfo_s60.h b/src/systeminfo/symbian/telephonyinfo_s60.h index 6c40a7b403..4059addb48 100644 --- a/src/systeminfo/symbian/telephonyinfo_s60.h +++ b/src/systeminfo/symbian/telephonyinfo_s60.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010-2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010-2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -39,15 +39,20 @@ ** ****************************************************************************/ -#ifndef DEVICEINFO_H -#define DEVICEINFO_H +#ifndef TELEPHONY_S60_H +#define TELEPHONY_S60_H #include <e32base.h> #include <etel3rdparty.h> #include <QString> #include <QList> +#include <QStack> #include <QEventLoop> +#include <qDebug> #include "trace.h" +#ifdef ETELMM_SUPPORTED +#include <etelmm.h> +#endif class CActiveSchedulerWait; @@ -66,6 +71,7 @@ public: virtual void changedCellId(int) = 0; }; +#ifndef ETELMM_SUPPORTED class CTelephonyInfo : public CActive { public: @@ -75,16 +81,14 @@ public: void addObserver(MTelephonyInfoObserver *observer); void removeObserver(MTelephonyInfoObserver *observer); -protected: //from CActive - void RunL(); - protected: - void makeRequest(); + void waitForRequest() const; + void exitWait() const; protected: CTelephony &m_telephony; QList<MTelephonyInfoObserver *> m_observers; - QEventLoop* iEventLoop; + mutable QStack<QEventLoop*> m_loops; }; class CPhoneInfo : public CTelephonyInfo @@ -94,16 +98,19 @@ public: ~CPhoneInfo(); protected: + void RunL(); void DoCancel(); public: - QString imei() const; - QString manufacturer() const; - QString model() const; + QString imei(); + QString manufacturer(); + QString model(); private: - CTelephony::TPhoneIdV1 m_phoneIdV1; - CTelephony::TPhoneIdV1Pckg m_phoneIdV1Pckg; + void makeRequest(); + bool m_initializing; + mutable CTelephony::TPhoneIdV1 m_phoneIdV1; + mutable CTelephony::TPhoneIdV1Pckg m_phoneIdV1Pckg; QString m_imei; QString m_manufacturer; @@ -117,14 +124,17 @@ public: ~CSubscriberInfo(); protected: + void RunL(); void DoCancel(); public: - QString imsi() const; + QString imsi(); private: - CTelephony::TSubscriberIdV1 m_subscriberIdV1; - CTelephony::TSubscriberIdV1Pckg m_subscriberIdV1Pckg; + void makeRequest(); + bool m_initializing; + mutable CTelephony::TSubscriberIdV1 m_subscriberIdV1; + mutable CTelephony::TSubscriberIdV1Pckg m_subscriberIdV1Pckg; QString m_imsi; }; @@ -248,5 +258,168 @@ private: int m_signalBar; int m_previousSignalBar; }; +#else //ETELMM_SUPPORTED +class CPhoneInfo : public CBase +{ +public: + CPhoneInfo(RMobilePhone &aMobilePhone); + ~CPhoneInfo(); + void initialise(); + +public: + QString imei(); + QString manufacturer(); + QString model(); + +private: + RMobilePhone &m_rmobilePhone; + bool m_phoneInfoinitialised; + QString m_imei; + QString m_manufacturer; + QString m_model; +}; + +class CSubscriberInfo : public CBase +{ +public: + CSubscriberInfo(RMobilePhone &aMobilePhone); + ~CSubscriberInfo(); + void initialise(); + +public: + QString imsi(); + +private: + RMobilePhone &m_rmobilePhone; + bool m_subscriberInfoinitialised; + QString m_imsi; +}; + + +class CEtelInfo : public CActive +{ +public: + CEtelInfo(RMobilePhone &aMobilePhone); + ~CEtelInfo(); + void addObserver(MTelephonyInfoObserver *observer); + void removeObserver(MTelephonyInfoObserver *observer); + +protected: + RMobilePhone &m_rmobilePhone; + QList<MTelephonyInfoObserver *> m_observers; + bool m_initialised; +}; + + +class CBatteryInfo : public CEtelInfo +{ +public: + CBatteryInfo(RMobilePhone &aMobilePhone); + ~CBatteryInfo(); + void initialise(); + void startMonitoring(); + +protected: + void RunL(); + void DoCancel(); + +public: + int batteryLevel() const; + +private: + int m_batteryLevel; + RMobilePhone::TMobilePhoneBatteryInfoV1 m_batteryinfo; +}; + + +class CCellSignalStrengthInfo : public CEtelInfo +{ +public: + CCellSignalStrengthInfo(RMobilePhone &aMobilePhone); + ~CCellSignalStrengthInfo(); + void initialise(); + void startMonitoring(); + +protected: + void RunL(); + void DoCancel(); + +public: + int cellNetworkSignalStrength() const; + +private: + TInt32 m_cellNetworkSignalStrength; + TInt8 m_signalBar; + TInt32 m_prevcellNetworkSignalStrength; + TInt8 m_prevsignalBar; +}; + +class CCellNetworkRegistrationInfo : public CEtelInfo +{ +public: + CCellNetworkRegistrationInfo(RMobilePhone &aMobilePhone); + ~CCellNetworkRegistrationInfo(); + void initialise(); + void startMonitoring(); + +protected: + void RunL(); + void DoCancel(); + +public: + RMobilePhone::TMobilePhoneRegistrationStatus cellNetworkStatus() const; + +private: + RMobilePhone::TMobilePhoneRegistrationStatus m_networkStatus; + RMobilePhone::TMobilePhoneRegistrationStatus m_previousNetworkStatus; +}; + +class CCellNetworkInfo : public CEtelInfo +{ +public: + CCellNetworkInfo(RMobilePhone &aMobilePhone); + ~CCellNetworkInfo(); + void initialise(); + void startMonitoring(); + +protected: + void RunL(); + void DoCancel(); + +public: + int cellId() const; + int locationAreaCode() const; + + QString countryCode() const; + QString networkCode() const; + QString networkName() const; + QString homeNetworkCode(); + CTelephony::TNetworkMode networkMode() const;/*RMobilePhone::TMobilePhoneNetworkMode <=> CTelePhony::TNetworkMode*/ + +private: + /** Network info of mobile phone. */ + RMobilePhone::TMobilePhoneNetworkInfoV1 iNetworkInfo; + /** Location of mobile phone. */ + RMobilePhone::TMobilePhoneLocationAreaV1 iLocation; + /** Packaged network info object. */ + RMobilePhone::TMobilePhoneNetworkInfoV1Pckg iNetworkInfoPckg; + + int m_cellId; + int m_previouscellId; + int m_locationAreaCode; + + QString m_networkId; + QString m_previousNetworkId; + + QString m_countryCode; + QString m_previousCountryCode; + + QString m_networkName; + QString m_previousNetworkName; + + RMobilePhone::TMobilePhoneNetworkMode m_networkMode; + RMobilePhone::TMobilePhoneNetworkMode m_previousNetworkMode; +}; +#endif //End ETELMM_SUPPORTED -#endif //DEVICEINFO_H +#endif //TELEPHONY_S60_H |