[SystemInfo] Added ADS property. 04/91604/2
authorTomasz Marciniak <t.marciniak@samsung.com>
Mon, 10 Oct 2016 09:57:51 +0000 (11:57 +0200)
committerTomasz Marciniak <t.marciniak@samsung.com>
Mon, 10 Oct 2016 13:04:17 +0000 (15:04 +0200)
[Verification] Code compiles.

Change-Id: I16494361f81ab119d72d6a9c6602e966398a00a3
Signed-off-by: Tomasz Marciniak <t.marciniak@samsung.com>
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);