From: Tomasz Marciniak Date: Mon, 10 Oct 2016 09:57:51 +0000 (+0200) Subject: [SystemInfo] Added ADS property. X-Git-Tag: submit/tizen/20161012.102024~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cc424855cb5fba3347d9b4af5d483ee22006ede5;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [SystemInfo] Added ADS property. [Verification] Code compiles. Change-Id: I16494361f81ab119d72d6a9c6602e966398a00a3 Signed-off-by: Tomasz Marciniak --- diff --git a/src/systeminfo/systeminfo_api.js b/src/systeminfo/systeminfo_api.js index dad6383e..d6b9634d 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 33b639dc..8a0fef8f 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 c18078a7..d16116f5 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);