From e75aa14a414c721066322ece79368d340e8378b5 Mon Sep 17 00:00:00 2001 From: Pawel Kaczmarek Date: Fri, 21 Aug 2015 10:07:35 +0200 Subject: [PATCH] [Systeminfo] Fix camera property of SystemInfoCameraFlash [Verification] TCT SystemInfoCameraFlash_camera_attribute should pass Change-Id: I681d8cc6b037c3a815c27d00946a42c0e8381aa1 Signed-off-by: Pawel Kaczmarek --- src/systeminfo/systeminfo_api.js | 48 +++++++++++++++++++------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/src/systeminfo/systeminfo_api.js b/src/systeminfo/systeminfo_api.js index 9bee0166..32aa6556 100644 --- a/src/systeminfo/systeminfo_api.js +++ b/src/systeminfo/systeminfo_api.js @@ -654,7 +654,7 @@ function SystemInfoSIM(data) { }, set: function() {}, enumerable: true - }, + } }); } @@ -674,30 +674,40 @@ function SystemInfoMemory(data) { function SystemInfoCameraFlash(data) { var getBrightness = function() { - xwalk.utils.checkPrivilegeAccess(privilege_.LED); + xwalk.utils.checkPrivilegeAccess(privilege_.LED); - var result = native_.callSync('SystemInfo_getBrightness', {}); - if (native_.isSuccess(result)) { - return Converter_.toLong(native_.getResultObject(result)) / this.levels; - } - return null; - }; + var result = native_.callSync('SystemInfo_getBrightness', {}); + if (native_.isSuccess(result)) { + return Converter_.toLong(native_.getResultObject(result)) / this.levels; + } + return null; + }; var getLevels = function() { - xwalk.utils.checkPrivilegeAccess(privilege_.LED); + xwalk.utils.checkPrivilegeAccess(privilege_.LED); - var result = native_.callSync('SystemInfo_getMaxBrightness', {}); - if (native_.isSuccess(result)) { - return Converter_.toLong(native_.getResultObject(result)); - } - return null; - }; + var result = native_.callSync('SystemInfo_getMaxBrightness', {}); + if (native_.isSuccess(result)) { + return Converter_.toLong(native_.getResultObject(result)); + } + return null; + }; + + var getCamera = function() { + var camera = 'FRONT'; + // TODO: get native value for camera +// var result = native_.callSync('SystemInfo_getCamera', {}); +// if (native_.isSuccess(result)) { +// camera = native_.getResultObject(result); +// } + return camera; + }; Object.defineProperties(this, { - brightness : {get: getBrightness, enumerable: true}, - camera : {value: null, enumerable: true}, - levels : {get: getLevels, enumerable: true}, - }); + brightness: {get: getBrightness, enumerable: true}, + camera: {get: getCamera, enumerable: true}, + levels: {get: getLevels, enumerable: true} + }); } SystemInfoCameraFlash.prototype.setBrightness = function(brightness) { -- 2.34.1