[Systeminfo] Resolved TODOs
authorPiotr Kosko <p.kosko@samsung.com>
Tue, 6 Oct 2015 13:11:17 +0000 (15:11 +0200)
committerPiotr Kosko <p.kosko@samsung.com>
Tue, 6 Oct 2015 13:11:23 +0000 (15:11 +0200)
[Feature] Support iccid of SIM cards.

[Verification] TCT passrate 100%.

Change-Id: I45c1803304b27b7f1c110659a977aad9effba48c
Signed-off-by: Piotr Kosko <p.kosko@samsung.com>
src/systeminfo/systeminfo_device_capability.cc
src/systeminfo/systeminfo_sim_details_manager.cc
src/systeminfo/systeminfo_sim_details_manager.h

index ab722d6f627f40a2634da8a0f35b400796f4f8d0..b7d9a6cb194c92bdeafb2085a1f9f2234d9be0b9 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "common/logger.h"
 
-// TODO:: hardcoded value, only for IsBluetoothAlwaysOn
+// hardcoded value, only for IsBluetoothAlwaysOn
 #define PROFILE_MOBILE 1
 
 namespace extension {
@@ -61,7 +61,7 @@ const char* kPlatformCoreVfpv3 = "vfpv3";
 
 /*API feature*/
 /*Network feature*/
-const char* kTizenFeatureBluetoothAlwaysOn = "http://tizen.org/capability/network.bluetooth.always_on"; //TODO mobile/wearable: false, tv: true
+const char* kTizenFeatureBluetoothAlwaysOn = "http://tizen.org/capability/network.bluetooth.always_on"; //hardcoded values for mobile/wearable: false, tv: true
 const char* kTizenFeatureOpenglesTextureFormat = "http://tizen.org/feature/opengles.texture_format";
 const char* kTizenFeatureCoreApiVersion = "http://tizen.org/feature/platform.core.api.version";
 const char* kTizenFeaturePlatfromCoreCpuArch = "http://tizen.org/feature/platform.core.cpu.arch";
index 5493164ffe1cca723338ee18ce00d356d7bce079..1c4cb0d77e982475530a3214e673509dfbfe931a 100644 (file)
@@ -94,6 +94,24 @@ void SimSpnValueCallback(TapiHandle */*handle*/, int result, void *data, void *u
   sim_mgr->set_spn(result_spn);
   sim_mgr->TryReturn();
 }
+
+void SimIccidValueCallback(TapiHandle */*handle*/, int result, void *data, void *user_data) {
+  LoggerD("Entered");
+  SimDetailsManager* sim_mgr = static_cast<SimDetailsManager*>(user_data);
+  TelSimAccessResult_t access_rt = static_cast<TelSimAccessResult_t>(result);
+  TelSimIccIdInfo_t *iccid_info = static_cast<TelSimIccIdInfo_t*>(data);
+
+  std::string result_iccid;
+  if (TAPI_SIM_ACCESS_SUCCESS == access_rt) {
+    result_iccid = (char *)iccid_info->icc_num;
+  } else {
+    LoggerW("Failed to retrieve iccid_: %d", access_rt);
+  }
+
+  sim_mgr->set_iccid(result_iccid);
+  sim_mgr->TryReturn();
+}
+
 } //namespace
 
 using common::PlatformResult;
@@ -148,6 +166,13 @@ PlatformResult SimDetailsManager::GatherSimInformation(TapiHandle* handle, picoj
       } else {
         LoggerE("Failed getting spn: %d", result);
       }
+
+      result = tel_get_sim_iccid(handle, SimIccidValueCallback, this);
+      if (TAPI_API_SUCCESS == result) {
+        ++to_process_;
+      } else {
+        LoggerE("Failed getting iccid: %d", result);
+      }
     }
     //prevent returning not filled result
     std::lock_guard<std::mutex> lock_sim(sim_info_mutex_);
@@ -217,8 +242,6 @@ PlatformResult SimDetailsManager::FetchSimSyncProps(TapiHandle *tapi_handle) {
     return PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get sim imsi");
   }
 
-  //TODO add code for iccid value fetching, when proper API would be ready
-  iccid_ = "";
   return PlatformResult(ErrorCode::NO_ERROR);
 }
 
@@ -289,5 +312,13 @@ void SimDetailsManager::set_spn(const std::string& spn) {
   LoggerD("SPN value: %s", this->spn_.c_str());
 };
 
+void SimDetailsManager::set_iccid(const std::string& iccid) {
+  LoggerD("Entered");
+  std::lock_guard<std::mutex> lock(sim_to_process_mutex_);
+  this->iccid_ = iccid;
+  --to_process_;
+  LoggerD("ICCID value: %s", this->iccid_.c_str());
+};
+
 } // namespace systeminfo
 } // namespace webapi
index 38def8f0c3c055a54fb684bca79c52da5494d6e3..0b6a4ed91dfc2e23560e6bb02c38c5d53e1e8472 100644 (file)
@@ -40,6 +40,7 @@ class SimDetailsManager {
   void set_operator_name(const std::string& name);
   void set_msisdn(const std::string& msisdn);
   void set_spn(const std::string& spn);
+  void set_iccid(const std::string& iccid);
 
  private:
   void ResetSimHolder(picojson::object* out);