[HAM] fix the wrong code about option dictionary param 75/75175/2
authorsangrae.kim <sangrae.kim@samsung.com>
Thu, 16 Jun 2016 14:45:50 +0000 (23:45 +0900)
committerHyunjin Park <hj.na.park@samsung.com>
Fri, 17 Jun 2016 03:51:37 +0000 (12:51 +0900)
Change-Id: I7538d58a6bcf174af023a9e556971af3ff426b34
Signed-off-by: sangrae.kim <sangrae.kim@samsung.com>
src/humanactivitymonitor/humanactivitymonitor_api.js

index fd442d979fc9e19f3491258fa9b4335360fbbf95..412f0c59c1c1c249f75d996670d3cd5fc6c75fce 100755 (executable)
@@ -238,22 +238,24 @@ HumanActivityMonitorManager.prototype.start = function(type, changedCallback) {
     {name: 'type', type: types_.ENUM, values: Object.keys(HumanActivityType)},
     {name: 'changedCallback', type: types_.FUNCTION, optional: true, nullable: true},
     {name: 'errorCallback', type: types_.FUNCTION, optional: true, nullable: true},
-    {name : 'option', type : types_.DICTIONARY, optional : true, nullable : true}
+    {name: 'options', type : types_.DICTIONARY, optional : true, nullable : true}
   ]);
 
   var listenerId = 'HumanActivityMonitor_'  + args.type;
+  var optionsAttributes = ["callbackInterval", "sampleInterval"], options = args.options || {};
+
   var callbackInterval = null, sampleInterval = null;
 
   switch (args.type) {
   case HumanActivityType.GPS:
-    callbackInterval = !type_.isNullOrUndefined(args.option.callbackInterval) ?
+    callbackInterval = !type_.isNullOrUndefined(options[optionsAttributes[0]]) ?
         args.option.callbackInterval : 150000;
-    sampleInterval = !type_.isNullOrUndefined(args.option.sampleInterval) ?
+    sampleInterval = !type_.isNullOrUndefined(options[optionsAttributes[1]]) ?
         args.option.sampleInterval : 1000;
     break;
   case HumanActivityType.HRM:
-    callbackInterval = !type_.isNullOrUndefined(args.option.callbackInterval) ?
-        args.option.callbackInterval : 100;
+    callbackInterval = !type_.isNullOrUndefined(options[optionsAttributes[0]]) ?
+        options[optionsAttributes[0]] : 100;
     if (callbackInterval < 10 || callbackInterval > 1000) {
       throw new WebAPIException(WebAPIException.INVALID_VALUES_ERR,
                                 'callbackInterval is out of range');