[SystemInfo] Added ADS property. 87/92687/2
authorJeongkyun Pu <jk.pu@samsung.com>
Tue, 18 Oct 2016 06:51:29 +0000 (23:51 -0700)
committerJeongkyun Pu <jk.pu@samsung.com>
Tue, 18 Oct 2016 06:51:44 +0000 (23:51 -0700)
This reverts commit 19269471e7a640c476812384f9af22e1cca8bec8.

Change-Id: If3a876c71aff92dc4856007dfe99fa185125cdd7

src/systeminfo/systeminfo_api.js
src/systeminfo/systeminfo_properties_manager.cc
src/systeminfo/systeminfo_properties_manager.h

index dad6383..d6b9634 100644 (file)
@@ -42,7 +42,8 @@ var SystemInfoPropertyId = {
         SIM : 'SIM',
         PERIPHERAL : 'PERIPHERAL',
         MEMORY : 'MEMORY',
-        CAMERA_FLASH : 'CAMERA_FLASH'
+        CAMERA_FLASH : 'CAMERA_FLASH',
+        ADS : 'ADS'
 };
 
 //class SystemInfoDeviceCapability ////////////////////////////////////////////////////
@@ -708,6 +709,13 @@ function SystemInfoCameraFlash(data) {
     });
 }
 
+//class SystemInfoADS ////////////////////////////////////////////////////
+function SystemInfoADS(data) {
+    Object.defineProperties(this, {
+        id : {value: data.id, writable: false, enumerable: true},
+    });
+}
+
 SystemInfoCameraFlash.prototype.setBrightness = function(brightness) {
   var args = validator_.validateArgs(arguments, [
     {name: 'brightness', type: types_.DOUBLE}
@@ -1197,7 +1205,13 @@ var _propertyContainer = {
             constructor : SystemInfoCameraFlash,
             broadcastFunction : _systeminfoCameraFlashListenerCallback,
             signalLabel : 'SystemInfoCameraFlashChangeBroadcast'
-    }
+        },
+        'ADS' : {
+          callbacks : {}, //adding callbacks for ADS is not possible
+          constructor : SystemInfoADS,
+          broadcastFunction : function(){},
+          signalLabel : ''
+        }
 };
 
 /// It common function to be called when listener would be triggered
index 33b639d..8a0fef8 100644 (file)
@@ -181,6 +181,8 @@ PlatformResult SysteminfoPropertiesManager::ReportProperty(const std::string& pr
     return ReportMemory(res_obj);
   } else if ("CAMERA_FLASH" == property) {
     return ReportCameraFlash(res_obj, index);
+  } else if ("ADS" == property) {
+    return ReportAds(res_obj);
   }
   return LogAndCreateResult(
             ErrorCode::NOT_SUPPORTED_ERR, "Property with given id is not supported");
@@ -1229,6 +1231,19 @@ PlatformResult SysteminfoPropertiesManager::ReportCameraFlash(picojson::object*
   return PlatformResult(ErrorCode::NO_ERROR);
 }
 
+/// ADS
+PlatformResult SysteminfoPropertiesManager::ReportAds(picojson::object* out) {
+  LoggerD("Entered");
+  std::string ads_id = "";
+  PlatformResult ret = SysteminfoUtils::GetRuntimeInfoString(
+      SYSTEM_SETTINGS_KEY_ADS_ID, &ads_id);
+  if (ret.IsError()) {
+    return ret;
+  }
+
+  out->insert(std::make_pair("id", picojson::value(ads_id)));
+  return PlatformResult(ErrorCode::NO_ERROR);
+}
 
 } // namespace systeminfo
 } // namespace webapi
index c18078a..d16116f 100644 (file)
@@ -53,6 +53,7 @@ class SysteminfoPropertiesManager {
   common::PlatformResult ReportCameraFlash(picojson::object* out, unsigned long count);
   common::PlatformResult ReportMemory(picojson::object* out);
   common::PlatformResult ReportStorage(picojson::object* out);
+  common::PlatformResult ReportAds(picojson::object* out);
 
   common::PlatformResult FetchIsAutoRotation(bool* result);
   common::PlatformResult FetchStatus(std::string* result);