qtmobility/src/systeminfo/qsysteminfo_maemo.cpp
changeset 14 6fbed849b4f4
parent 11 06b8e2af4411
equal deleted inserted replaced
11:06b8e2af4411 14:6fbed849b4f4
   146 {
   146 {
   147     bool featureSupported = false;
   147     bool featureSupported = false;
   148     switch (feature) {
   148     switch (feature) {
   149     case QSystemInfo::SimFeature :
   149     case QSystemInfo::SimFeature :
   150         {
   150         {
   151             GConfItem locationValues("/system/nokia/location");
   151             QSystemDeviceInfoPrivate d;
   152             const QStringList locationKeys = locationValues.listEntries();
   152             featureSupported = (d.simStatus() != QSystemDeviceInfo::SimNotAvailable);
   153 
       
   154             foreach (const QString str, locationKeys) {
       
   155                 if (str.contains("sim_imsi"))
       
   156                     featureSupported = true;
       
   157                 break;
       
   158             }
       
   159         }
   153         }
   160         break;
   154         break;
   161     case QSystemInfo::LocationFeature :
   155     case QSystemInfo::LocationFeature :
   162         {
   156         {
   163             GConfItem locationValues("/system/nokia/location");
   157             GConfItem locationValues("/system/nokia/location");
   307     return currentMNC;
   301     return currentMNC;
   308 }
   302 }
   309 
   303 
   310 QString QSystemNetworkInfoPrivate::homeMobileCountryCode()
   304 QString QSystemNetworkInfoPrivate::homeMobileCountryCode()
   311 {
   305 {
   312     QString imsi = GConfItem("/system/nokia/location/sim_imsi").value().toString();
   306     QSystemDeviceInfoPrivate d;
       
   307     QString imsi = d.imsi();
   313     if (imsi.length() >= 3) {
   308     if (imsi.length() >= 3) {
   314         return imsi.left(3);
   309         return imsi.left(3);
   315     }
   310     }
   316         return QString();
   311     return "";
   317 }
   312 }
   318 
   313 
   319 QString QSystemNetworkInfoPrivate::homeMobileNetworkCode()
   314 QString QSystemNetworkInfoPrivate::homeMobileNetworkCode()
   320 {
   315 {
   321 #if !defined(QT_NO_DBUS)
   316 #if !defined(QT_NO_DBUS)
       
   317     #if defined(Q_WS_MAEMO_6)
       
   318     QDBusInterface connectionInterface("com.nokia.csd.SIM",
       
   319                                        "/com/nokia/csd/sim",
       
   320                                        "com.nokia.csd.SIM.Identity",
       
   321                                        QDBusConnection::systemBus());
       
   322     QDBusMessage reply = connectionInterface.call(QLatin1String("GetHPLMN"));
       
   323     if (reply.errorName().isEmpty()) {
       
   324         QList<QVariant> args = reply.arguments();
       
   325         // The first attribute should be MCC and the 2nd one MNC
       
   326         if (args.size() == 2) {
       
   327             return args.at(1).toString();
       
   328         }
       
   329     }
       
   330     #else
       
   331     /* Maemo 5 */
   322     QDBusInterface connectionInterface("com.nokia.phone.SIM",
   332     QDBusInterface connectionInterface("com.nokia.phone.SIM",
   323                                        "/com/nokia/phone/SIM",
   333                                        "/com/nokia/phone/SIM",
   324                                        "Phone.Sim",
   334                                        "Phone.Sim",
   325                                        QDBusConnection::systemBus());
   335                                        QDBusConnection::systemBus());
   326     if (!connectionInterface.isValid()) {
   336     if (!connectionInterface.isValid()) {
   347         }
   357         }
   348         homeMobileNetworkCode.prepend(mnc2);
   358         homeMobileNetworkCode.prepend(mnc2);
   349         homeMobileNetworkCode.prepend(mnc1);
   359         homeMobileNetworkCode.prepend(mnc1);
   350         return homeMobileNetworkCode;
   360         return homeMobileNetworkCode;
   351     }
   361     }
   352 #endif
   362     #endif
   353     return QString();
   363 #endif
       
   364     return "";
   354 }
   365 }
   355 
   366 
   356 QString QSystemNetworkInfoPrivate::networkName(QSystemNetworkInfo::NetworkMode mode)
   367 QString QSystemNetworkInfoPrivate::networkName(QSystemNetworkInfo::NetworkMode mode)
   357 {
   368 {
   358     QString netname = "";
   369     QString netname = "";
   458         }
   469         }
   459     }
   470     }
   460 #if !defined(QT_NO_DBUS)
   471 #if !defined(QT_NO_DBUS)
   461     QDBusConnection systemDbusConnection = QDBusConnection::systemBus();
   472     QDBusConnection systemDbusConnection = QDBusConnection::systemBus();
   462 
   473 
       
   474     #if defined(Q_WS_MAEMO_6)
       
   475         const QString service = "com.nokia.csd.CSNet";
       
   476         const QString servicePath = "/com/nokia/csd/csnet";
       
   477 
       
   478         /* CSD: network cell */
       
   479         QDBusInterface ifc(service, servicePath, "com.nokia.csd.CSNet.NetworkCell", systemDbusConnection);
       
   480 
       
   481         QVariant cellLac = ifc.property("CellLac");
       
   482         currentLac = cellLac.isValid() ? cellLac.value<int>() : -1;
       
   483 
       
   484         QVariant cellId = ifc.property("CellId");
       
   485         currentCellId =  cellId.isValid() ? cellId.value<int>() : -1;
       
   486 
       
   487         QVariant cellType = ifc.property("CellType");
       
   488         QString currentCellType = cellType.isValid() ? cellType.value<QString>() : "";
       
   489 
       
   490         if (currentCellType == "GSM")
       
   491             radioAccessTechnology = 1;
       
   492         else if (currentCellType == "WCDMA")
       
   493             radioAccessTechnology = 2;
       
   494 
       
   495         /* CSD: network operator */
       
   496         QDBusInterface ifc2(service, servicePath, "com.nokia.csd.CSNet.NetworkOperator", systemDbusConnection);
       
   497 
       
   498         QVariant mcc = ifc2.property("OperatorMCC");
       
   499         currentMCC = mcc.isValid() ? mcc.value<QString>() : "";
       
   500 
       
   501         QVariant mnc = ifc2.property("OperatorMNC");
       
   502         currentMNC = mnc.isValid() ? mnc.value<QString>() : "";
       
   503 
       
   504         QVariant operatorName = ifc2.property("OperatorName");
       
   505         currentOperatorName = operatorName.isValid() ? operatorName.value<QString>() : "";
       
   506 
       
   507         /* CSD: signal strength */
       
   508         QDBusInterface ifc3(service, servicePath, "com.nokia.csd.CSNet.SignalStrength", systemDbusConnection);
       
   509 
       
   510         QVariant signalStrength = ifc3.property("SignalPercent");
       
   511         cellSignalStrength = signalStrength.isValid() ? signalStrength.value<int>() : -1;
       
   512 
       
   513         /* CSD: network registration */
       
   514         QDBusInterface ifc4(service, servicePath, "com.nokia.csd.CSNet.NetworkRegistration", systemDbusConnection);
       
   515 
       
   516         QVariant registrationStatus = ifc4.property("RegistrationStatus");
       
   517         QString status = registrationStatus.isValid() ? registrationStatus.value<QString>() : "";
       
   518 
       
   519         if (status ==  "Home") {
       
   520             currentCellNetworkStatus = QSystemNetworkInfo::HomeNetwork;
       
   521         } else if (status == "Roaming") {
       
   522             currentCellNetworkStatus = QSystemNetworkInfo::Roaming;
       
   523         } else if (status == "Searching") {
       
   524             currentCellNetworkStatus = QSystemNetworkInfo::Searching;
       
   525         } else if (status == "Offline" || status == "NoSim" || status == "PowerOff" || status == "PowerSave" || status == "NoCoverage") {
       
   526             currentCellNetworkStatus = QSystemNetworkInfo::NoNetworkAvailable;
       
   527         } else if (status == "Rejected") {
       
   528             currentCellNetworkStatus = QSystemNetworkInfo::Denied;
       
   529         } else {
       
   530             currentCellNetworkStatus = QSystemNetworkInfo::UndefinedStatus;
       
   531         }
       
   532 
       
   533         /* Signal handlers */
       
   534         if (!systemDbusConnection.connect(service, servicePath, "com.nokia.csd.CSNet.SignalStrength", "SignalStrengthChanged",
       
   535                                          this, SLOT(slotSignalStrengthChanged(int, int)))) {
       
   536             qDebug() << "unable to connect SignalStrengthChanged";
       
   537         }
       
   538         if (!systemDbusConnection.connect(service, servicePath, "com.nokia.csd.CSNet.NetworkOperator", "OperatorChanged",
       
   539                                          this, SLOT(slotOperatorChanged(const QString&,const QString&)))) {
       
   540             qDebug() << "unable to connect (OperatorChanged";
       
   541         }
       
   542         if (!systemDbusConnection.connect(service, servicePath, "com.nokia.csd.CSNet.NetworkOperator", "OperatorNameChanged",
       
   543                                          this, SLOT(slotOperatorNameChanged(const QString&)))) {
       
   544             qDebug() << "unable to connect OperatorNameChanged";
       
   545         }
       
   546         if (!systemDbusConnection.connect(service, servicePath, "com.nokia.csd.CSNet.NetworkRegistration", "RegistrationChanged",
       
   547                                          this, SLOT(slotRegistrationChanged(const QString&)))) {
       
   548             qDebug() << "unable to connect RegistrationChanged";
       
   549         }
       
   550         if (!systemDbusConnection.connect(service, servicePath, "com.nokia.csd.CSNet.NetworkCell", "CellChanged",
       
   551                                          this, SLOT(slotCellChanged(const QString&,int,int)))) {
       
   552             qDebug() << "unable to connect CellChanged";
       
   553         }
       
   554     #else
       
   555     /* Maemo 5 */
   463     QDBusInterface connectionInterface("com.nokia.phone.net",
   556     QDBusInterface connectionInterface("com.nokia.phone.net",
   464                                        "/com/nokia/phone/net",
   557                                        "/com/nokia/phone/net",
   465                                        "Phone.Net",
   558                                        "Phone.Net",
   466                                        systemDbusConnection);
   559                                        systemDbusConnection);
   467     if (!connectionInterface.isValid()) {
   560     if (!connectionInterface.isValid()) {
   538                               "com.nokia.icd",
   631                               "com.nokia.icd",
   539                               QLatin1String("status_changed"),
   632                               QLatin1String("status_changed"),
   540                               this, SLOT(icdStatusChanged(QString,QString,QString,QString))) ) {
   633                               this, SLOT(icdStatusChanged(QString,QString,QString,QString))) ) {
   541         qWarning() << "unable to connect to icdStatusChanged";
   634         qWarning() << "unable to connect to icdStatusChanged";
   542     }
   635     }
       
   636     #endif /* Maemo 5 */
       
   637 
   543     if(!systemDbusConnection.connect("com.nokia.bme",
   638     if(!systemDbusConnection.connect("com.nokia.bme",
   544                               "/com/nokia/bme/signal",
   639                               "/com/nokia/bme/signal",
   545                               "com.nokia.bme.signal",
   640                               "com.nokia.bme.signal",
   546                               QLatin1String("charger_connected"),
   641                               QLatin1String("charger_connected"),
   547                               this, SLOT(usbCableAction())) ) {
   642                               this, SLOT(usbCableAction())) ) {
   569         qWarning() << "unable to connect to bluetoothNetworkStatusCheck (2)";
   664         qWarning() << "unable to connect to bluetoothNetworkStatusCheck (2)";
   570     }
   665     }
   571 #endif
   666 #endif
   572 }
   667 }
   573 
   668 
   574 void QSystemNetworkInfoPrivate::cellNetworkSignalStrengthChanged(uchar var1, uchar)
   669 #if defined(Q_WS_MAEMO_6)
       
   670 // Slots only available in Maemo6
       
   671 
       
   672 void QSystemNetworkInfoPrivate::slotSignalStrengthChanged(int percent, int /*dbm*/)
   575 {
   673 {
   576     QSystemNetworkInfo::NetworkMode mode = QSystemNetworkInfo::UnknownMode;
   674     QSystemNetworkInfo::NetworkMode mode = QSystemNetworkInfo::UnknownMode;
   577     cellSignalStrength = var1;
   675     cellSignalStrength = percent;
   578 
   676 
   579     if (radioAccessTechnology == 1)
   677     if (radioAccessTechnology == 1)
   580         mode = QSystemNetworkInfo::GsmMode;
   678         mode = QSystemNetworkInfo::GsmMode;
   581     if (radioAccessTechnology == 2)
   679     if (radioAccessTechnology == 2)
   582         mode = QSystemNetworkInfo::WcdmaMode;
   680         mode = QSystemNetworkInfo::WcdmaMode;
   583 
   681 
   584     if (mode != QSystemNetworkInfo::UnknownMode)
   682     if (mode != QSystemNetworkInfo::UnknownMode)
   585         emit networkSignalStrengthChanged(mode, cellSignalStrength);
   683         emit networkSignalStrengthChanged(mode, cellSignalStrength);
   586 }
   684 }
   587 
   685 
   588 void QSystemNetworkInfoPrivate::networkModeChanged(int newRadioAccessTechnology)
   686 void QSystemNetworkInfoPrivate::slotOperatorChanged(const QString &mnc, const QString &mcc)
   589 {
   687 {
   590     QSystemNetworkInfo::NetworkMode newMode = QSystemNetworkInfo::UnknownMode;
   688     if (currentMCC != mcc) {
   591     radioAccessTechnology = newRadioAccessTechnology;
   689         currentMCC = mcc;
   592 
   690         emit currentMobileCountryCodeChanged(currentMCC);
   593     if (radioAccessTechnology == 1)
   691     }
   594         newMode = QSystemNetworkInfo::GsmMode;
   692     if (currentMNC != mnc) {
   595     if (radioAccessTechnology == 2)
   693         currentMNC = mnc;
   596         newMode = QSystemNetworkInfo::WcdmaMode;
   694         emit currentMobileNetworkCodeChanged(currentMNC);
   597 
   695     }
   598     if (newMode != QSystemNetworkInfo::UnknownMode)
   696 }
   599         emit networkModeChanged(newMode);
   697 
   600 }
   698 void QSystemNetworkInfoPrivate::slotOperatorNameChanged(const QString &name)
   601 
       
   602 void QSystemNetworkInfoPrivate::operatorNameChanged(uchar, QString name, QString, uint, uint)
       
   603 {
   699 {
   604     currentOperatorName = name;
   700     currentOperatorName = name;
   605     if (radioAccessTechnology == 1)
   701     if (radioAccessTechnology == 1)
   606         emit networkNameChanged(QSystemNetworkInfo::GsmMode, currentOperatorName);
   702         emit networkNameChanged(QSystemNetworkInfo::GsmMode, currentOperatorName);
   607     if (radioAccessTechnology == 2)
   703     if (radioAccessTechnology == 2)
   608         emit networkNameChanged(QSystemNetworkInfo::WcdmaMode, currentOperatorName);
   704         emit networkNameChanged(QSystemNetworkInfo::WcdmaMode, currentOperatorName);
   609 }
   705 }
   610 
   706 
   611 void QSystemNetworkInfoPrivate::registrationStatusChanged(uchar var1, ushort var2, uint var3, uint var4, uint var5, uchar, uchar)
   707 void QSystemNetworkInfoPrivate::slotRegistrationChanged(const QString &status)
   612 {
   708 {
   613     int newCellNetworkStatus = var1;
   709     int newCellNetworkStatus = -1;
   614     int newLac = var2;
   710 
   615     int newCellId = var3;
   711     if (status ==  "Home") {
   616     QString newMobileCountryCode;
   712         newCellNetworkStatus = QSystemNetworkInfo::HomeNetwork;
   617     QString newMobileNetworkCode;
   713     } else if (status == "Roaming") {
   618     newMobileCountryCode.setNum(var4);
   714         newCellNetworkStatus = QSystemNetworkInfo::Roaming;
   619     newMobileNetworkCode.setNum(var5);
   715     } else if (status == "Searching") {
       
   716         newCellNetworkStatus = QSystemNetworkInfo::Searching;
       
   717     } else if (status == "Offline" || status == "NoSim" || status == "PowerOff" || status == "PowerSave" || status == "NoCoverage") {
       
   718         newCellNetworkStatus = QSystemNetworkInfo::NoNetworkAvailable;
       
   719     } else if (status == "Rejected") {
       
   720         newCellNetworkStatus = QSystemNetworkInfo::Denied;
       
   721     } else {
       
   722         newCellNetworkStatus = QSystemNetworkInfo::UndefinedStatus;
       
   723     }
   620 
   724 
   621     if (currentCellNetworkStatus != newCellNetworkStatus) {
   725     if (currentCellNetworkStatus != newCellNetworkStatus) {
   622         currentCellNetworkStatus = newCellNetworkStatus;
   726         currentCellNetworkStatus = newCellNetworkStatus;
   623         if (radioAccessTechnology == 1)
   727         if (radioAccessTechnology == 1)
   624             emit networkStatusChanged(QSystemNetworkInfo::GsmMode,
   728             emit networkStatusChanged(QSystemNetworkInfo::GsmMode,
   625                                       networkStatus(QSystemNetworkInfo::GsmMode));
   729                                       networkStatus(QSystemNetworkInfo::GsmMode));
   626         if (radioAccessTechnology == 2)
   730         if (radioAccessTechnology == 2)
   627             emit networkStatusChanged(QSystemNetworkInfo::WcdmaMode,
   731             emit networkStatusChanged(QSystemNetworkInfo::WcdmaMode,
   628                                       networkStatus(QSystemNetworkInfo::WcdmaMode));
   732                                       networkStatus(QSystemNetworkInfo::WcdmaMode));
   629     }
   733     }
       
   734 }
       
   735 
       
   736 void QSystemNetworkInfoPrivate::slotCellChanged(const QString &type, int id, int lac)
       
   737 {
       
   738     QSystemNetworkInfo::NetworkMode mode = QSystemNetworkInfo::UnknownMode;
       
   739     int newRadioAccessTechnology = 0;
       
   740     if (type == "GSM") {
       
   741         mode = QSystemNetworkInfo::GsmMode;
       
   742         newRadioAccessTechnology = 1;
       
   743     } else if (type == "WCDMA") {
       
   744         mode = QSystemNetworkInfo::WcdmaMode;
       
   745         newRadioAccessTechnology = 2;
       
   746     }
       
   747 
       
   748     if (newRadioAccessTechnology != radioAccessTechnology) {
       
   749         radioAccessTechnology = newRadioAccessTechnology;
       
   750         emit networkModeChanged(mode);
       
   751     }
       
   752     if (currentCellId != id) {
       
   753         currentCellId = id;
       
   754     }
       
   755     if (currentLac != lac) {
       
   756         currentLac = lac;
       
   757     }
       
   758 }
       
   759 
       
   760 #endif /* Maemo 6 */
       
   761 
       
   762 #if defined(Q_WS_MAEMO_5)
       
   763 // Slots only available in Maemo5
       
   764 
       
   765 void QSystemNetworkInfoPrivate::cellNetworkSignalStrengthChanged(uchar var1, uchar)
       
   766 {
       
   767     QSystemNetworkInfo::NetworkMode mode = QSystemNetworkInfo::UnknownMode;
       
   768     cellSignalStrength = var1;
       
   769 
       
   770     if (radioAccessTechnology == 1)
       
   771         mode = QSystemNetworkInfo::GsmMode;
       
   772     if (radioAccessTechnology == 2)
       
   773         mode = QSystemNetworkInfo::WcdmaMode;
       
   774 
       
   775     if (mode != QSystemNetworkInfo::UnknownMode)
       
   776         emit networkSignalStrengthChanged(mode, cellSignalStrength);
       
   777 }
       
   778 
       
   779 void QSystemNetworkInfoPrivate::networkModeChanged(int newRadioAccessTechnology)
       
   780 {
       
   781     QSystemNetworkInfo::NetworkMode newMode = QSystemNetworkInfo::UnknownMode;
       
   782     radioAccessTechnology = newRadioAccessTechnology;
       
   783 
       
   784     if (radioAccessTechnology == 1)
       
   785         newMode = QSystemNetworkInfo::GsmMode;
       
   786     if (radioAccessTechnology == 2)
       
   787         newMode = QSystemNetworkInfo::WcdmaMode;
       
   788 
       
   789     if (newMode != QSystemNetworkInfo::UnknownMode)
       
   790         emit networkModeChanged(newMode);
       
   791 }
       
   792 
       
   793 void QSystemNetworkInfoPrivate::operatorNameChanged(uchar, QString name, QString, uint, uint)
       
   794 {
       
   795     currentOperatorName = name;
       
   796     if (radioAccessTechnology == 1)
       
   797         emit networkNameChanged(QSystemNetworkInfo::GsmMode, currentOperatorName);
       
   798     if (radioAccessTechnology == 2)
       
   799         emit networkNameChanged(QSystemNetworkInfo::WcdmaMode, currentOperatorName);
       
   800 }
       
   801 
       
   802 void QSystemNetworkInfoPrivate::registrationStatusChanged(uchar var1, ushort var2, uint var3, uint var4, uint var5, uchar, uchar)
       
   803 {
       
   804     int newCellNetworkStatus = var1;
       
   805     int newLac = var2;
       
   806     int newCellId = var3;
       
   807     QString newMobileCountryCode;
       
   808     QString newMobileNetworkCode;
       
   809     newMobileCountryCode.setNum(var4);
       
   810     newMobileNetworkCode.setNum(var5);
       
   811 
       
   812     if (currentCellNetworkStatus != newCellNetworkStatus) {
       
   813         currentCellNetworkStatus = newCellNetworkStatus;
       
   814         if (radioAccessTechnology == 1)
       
   815             emit networkStatusChanged(QSystemNetworkInfo::GsmMode,
       
   816                                       networkStatus(QSystemNetworkInfo::GsmMode));
       
   817         if (radioAccessTechnology == 2)
       
   818             emit networkStatusChanged(QSystemNetworkInfo::WcdmaMode,
       
   819                                       networkStatus(QSystemNetworkInfo::WcdmaMode));
       
   820     }
   630     if (currentLac != newLac) {
   821     if (currentLac != newLac) {
   631         currentLac = newLac;
   822         currentLac = newLac;
   632     }
   823     }
   633     if (currentCellId != newCellId) {
   824     if (currentCellId != newCellId) {
   634         currentCellId = newCellId;
   825         currentCellId = newCellId;
   648     if (var2 == "WLAN_INFRA") {
   839     if (var2 == "WLAN_INFRA") {
   649         emit networkStatusChanged(QSystemNetworkInfo::WlanMode,
   840         emit networkStatusChanged(QSystemNetworkInfo::WlanMode,
   650                                   networkStatus(QSystemNetworkInfo::WlanMode));
   841                                   networkStatus(QSystemNetworkInfo::WlanMode));
   651     }
   842     }
   652 }
   843 }
       
   844 
       
   845 #endif /* Maemo 5 */
   653 
   846 
   654 void QSystemNetworkInfoPrivate::usbCableAction()
   847 void QSystemNetworkInfoPrivate::usbCableAction()
   655 {
   848 {
   656     if (currentEthernetSignalStrength != networkSignalStrength(QSystemNetworkInfo::EthernetMode)) {
   849     if (currentEthernetSignalStrength != networkSignalStrength(QSystemNetworkInfo::EthernetMode)) {
   657         currentEthernetSignalStrength = networkSignalStrength(QSystemNetworkInfo::EthernetMode);
   850         currentEthernetSignalStrength = networkSignalStrength(QSystemNetworkInfo::EthernetMode);
   815     return QSystemDeviceInfo::UnknownProfile;
  1008     return QSystemDeviceInfo::UnknownProfile;
   816 }
  1009 }
   817 
  1010 
   818 QString QSystemDeviceInfoPrivate::imei()
  1011 QString QSystemDeviceInfoPrivate::imei()
   819 {
  1012 {
   820  #if !defined(QT_NO_DBUS)
  1013 #if !defined(QT_NO_DBUS)
   821     QDBusInterface connectionInterface("com.nokia.phone.SIM",
  1014     #if defined(Q_WS_MAEMO_6)
       
  1015         QString dBusService = "com.nokia.csd.Info";
       
  1016     #else
       
  1017         /* Maemo 5 */
       
  1018         QString dBusService = "com.nokia.phone.SIM";
       
  1019     #endif
       
  1020     QDBusInterface connectionInterface(dBusService,
   822                                        "/com/nokia/csd/info",
  1021                                        "/com/nokia/csd/info",
   823                                        "com.nokia.csd.Info",
  1022                                        "com.nokia.csd.Info",
   824                                         QDBusConnection::systemBus());
  1023                                         QDBusConnection::systemBus());
   825     if(!connectionInterface.isValid()) {
       
   826         qWarning() << "interfacenot valid";
       
   827     }
       
   828 
       
   829     QDBusReply< QString > reply = connectionInterface.call("GetIMEINumber");
  1024     QDBusReply< QString > reply = connectionInterface.call("GetIMEINumber");
   830     return reply.value();
  1025     return reply.value();
   831 
  1026 #endif
   832 #endif
  1027     return "";
   833         return "Not Available";
       
   834 }
  1028 }
   835 
  1029 
   836 QString QSystemDeviceInfoPrivate::imsi()
  1030 QString QSystemDeviceInfoPrivate::imsi()
   837 {
  1031 {
       
  1032 #if defined(Q_WS_MAEMO_6)
       
  1033     /* Maemo 6 */
       
  1034     #if !defined(QT_NO_DBUS)
       
  1035         QDBusInterface connectionInterface("com.nokia.csd.SIM",
       
  1036                                            "/com/nokia/csd/sim",
       
  1037                                            "com.nokia.csd.SIM.Identity",
       
  1038                                            QDBusConnection::systemBus());
       
  1039         QDBusReply< QString > reply = connectionInterface.call("GetIMSI");
       
  1040         return reply.value();
       
  1041     #endif
       
  1042     return "";
       
  1043 #else
       
  1044     /* Maemo 5 */
   838     return GConfItem("/system/nokia/location/sim_imsi").value().toString();
  1045     return GConfItem("/system/nokia/location/sim_imsi").value().toString();
       
  1046 #endif
   839 }
  1047 }
   840 
  1048 
   841 QSystemDeviceInfo::SimStatus QSystemDeviceInfoPrivate::simStatus()
  1049 QSystemDeviceInfo::SimStatus QSystemDeviceInfoPrivate::simStatus()
   842 {
  1050 {
   843     GConfItem locationValues("/system/nokia/location");
  1051     QSystemDeviceInfo::SimStatus simStatus = QSystemDeviceInfo::SimNotAvailable;
   844     const QStringList locationKeys = locationValues.listEntries();
  1052     QString imsi = QSystemDeviceInfoPrivate::imsi();
   845     QStringList result;
  1053     if (imsi.length() > 0) {
   846     int count = 0;
  1054         simStatus = QSystemDeviceInfo::SingleSimAvailable;
   847     foreach (const QString str, locationKeys) {
  1055     }
   848         if (str.contains("sim_imsi"))
  1056     return simStatus;
   849             count++;
       
   850     }
       
   851 
       
   852     if(count == 1) {
       
   853         return QSystemDeviceInfo::SingleSimAvailable;
       
   854     } else if (count == 2) {
       
   855         return QSystemDeviceInfo::DualSimAvailable;
       
   856     }
       
   857     return QSystemDeviceInfo::SimNotAvailable;
       
   858 }
  1057 }
   859 
  1058 
   860 bool QSystemDeviceInfoPrivate::isDeviceLocked()
  1059 bool QSystemDeviceInfoPrivate::isDeviceLocked()
   861 {
  1060 {
   862 #if !defined(QT_NO_DBUS)
  1061 #if !defined(QT_NO_DBUS)