From: Jeongkyun Pu Date: Tue, 18 Oct 2016 06:51:29 +0000 (-0700) Subject: [SystemInfo] Added ADS property. X-Git-Tag: accepted/tizen/3.0/ivi/20161028.122958^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F87%2F92687%2F2;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [SystemInfo] Added ADS property. This reverts commit 19269471e7a640c476812384f9af22e1cca8bec8. Change-Id: If3a876c71aff92dc4856007dfe99fa185125cdd7 --- diff --git a/src/systeminfo/systeminfo_api.js b/src/systeminfo/systeminfo_api.js index dad6383..d6b9634 100644 --- a/src/systeminfo/systeminfo_api.js +++ b/src/systeminfo/systeminfo_api.js @@ -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 diff --git a/src/systeminfo/systeminfo_properties_manager.cc b/src/systeminfo/systeminfo_properties_manager.cc index 33b639d..8a0fef8 100644 --- a/src/systeminfo/systeminfo_properties_manager.cc +++ b/src/systeminfo/systeminfo_properties_manager.cc @@ -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 diff --git a/src/systeminfo/systeminfo_properties_manager.h b/src/systeminfo/systeminfo_properties_manager.h index c18078a..d16116f 100644 --- a/src/systeminfo/systeminfo_properties_manager.h +++ b/src/systeminfo/systeminfo_properties_manager.h @@ -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);