[Systeminfo] Fix camera property of SystemInfoCameraFlash
authorPawel Kaczmarek <p.kaczmarek3@samsung.com>
Fri, 21 Aug 2015 08:07:35 +0000 (10:07 +0200)
committerPawel Kaczmarek <p.kaczmarek3@samsung.com>
Fri, 21 Aug 2015 08:07:35 +0000 (10:07 +0200)
[Verification]
TCT SystemInfoCameraFlash_camera_attribute should pass

Change-Id: I681d8cc6b037c3a815c27d00946a42c0e8381aa1
Signed-off-by: Pawel Kaczmarek <p.kaczmarek3@samsung.com>
src/systeminfo/systeminfo_api.js

index 9bee0166154d66cb3bc1abe86b2d0bc3e69827cc..32aa6556ee9a7c6717a0a179e32b4edaa0623e06 100644 (file)
@@ -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) {