[Systeminfo] Supported second sim for CELLULAR_NETWORK
authorPiotr Kosko <p.kosko@samsung.com>
Fri, 10 Jul 2015 08:34:16 +0000 (10:34 +0200)
committerPiotr Kosko <p.kosko@samsung.com>
Fri, 10 Jul 2015 08:39:16 +0000 (10:39 +0200)
[Feature] Added support for getting CELLULAR_NETWORK properties array when
  multiple SIM cards are present.

[Verification] Code compiles without errors.
  TCT passrate 100%

Change-Id: I71951631c754af8a55bccad54542faf07a438e20
Signed-off-by: Piotr Kosko <p.kosko@samsung.com>
src/systeminfo/systeminfo-utils.cpp
src/systeminfo/systeminfo-utils.h

index 88f74331f12b5747442522665e349073a57436f8..a665847d72d5fe6a3050840e242e7a5961c34539 100644 (file)
@@ -1660,7 +1660,7 @@ PlatformResult SysteminfoUtils::GetCount(const std::string& property, unsigned l
     if (ret.IsError()) {
       count = 0;
     } else {
-      count = kDefaultPropertyCount;
+      count = sim_mgr.GetSimCount(system_info_listeners.GetTapiHandles());
     }
   } else if ("SIM" == property) {
     PlatformResult ret = CheckTelephonySupport();
@@ -1706,7 +1706,7 @@ PlatformResult SysteminfoUtils::ReportProperty(const std::string& property, int
   } else if ("ETHERNET_NETWORK" == property) {
     return ReportEthernetNetwork(res_obj);
   } else if ("CELLULAR_NETWORK" == property) {
-    return ReportCellularNetwork(res_obj);
+    return ReportCellularNetwork(res_obj, index);
   } else if ("SIM" == property) {
     return ReportSim(res_obj, index);
   } else if ("PERIPHERAL" == property) {
@@ -1740,6 +1740,8 @@ PlatformResult SysteminfoUtils::GetPropertyValue(const std::string& property, bo
       return ret;
     }
 
+    LoggerD("property name: %s", property.c_str());
+    LoggerD("available property count: %d", property_count);
     for (size_t i = 0; i < property_count; i++) {
       picojson::value result = picojson::value(picojson::object());
       picojson::object& result_obj = result.get<picojson::object>();
@@ -2519,7 +2521,7 @@ static PlatformResult FetchConnection(TapiHandle *tapi_handle, std::string* resu
   return PlatformResult(ErrorCode::NO_ERROR);
 }
 
-PlatformResult SysteminfoUtils::ReportCellularNetwork(picojson::object& out) {
+PlatformResult SysteminfoUtils::ReportCellularNetwork(picojson::object& out, unsigned long count) {
   PlatformResult ret = CheckTelephonySupport();
   if (ret.IsError()) {
     return ret;
@@ -2543,7 +2545,7 @@ PlatformResult SysteminfoUtils::ReportCellularNetwork(picojson::object& out) {
     return ret;
   }
   //gathering connection informations
-  ret = FetchConnection(system_info_listeners.GetTapiHandle(),
+  ret = FetchConnection(system_info_listeners.GetTapiHandles()[count],
                   &result_status, &result_apn, &result_ip_address, &result_ipv6_address, &result_imei);
   if (ret.IsError()) {
     return ret;
index 4aa9b28e9fac198ebbbdb849766bdd6d1ae32a1d..58e7595dba769357de29c20b0b4d0284ccef04b2 100644 (file)
@@ -99,7 +99,7 @@ class SysteminfoUtils {
   static common::PlatformResult ReportNetwork(picojson::object& out);
   static common::PlatformResult ReportWifiNetwork(picojson::object& out);
   static common::PlatformResult ReportEthernetNetwork(picojson::object& out);
-  static common::PlatformResult ReportCellularNetwork(picojson::object& out);
+  static common::PlatformResult ReportCellularNetwork(picojson::object& out, unsigned long count);
   static common::PlatformResult ReportSim(picojson::object& out, unsigned long count);
   static common::PlatformResult ReportPeripheral(picojson::object& out);
   static common::PlatformResult ReportMemory(picojson::object& out);