From: sangrae.kim Date: Thu, 16 Jun 2016 14:45:50 +0000 (+0900) Subject: [HAM] fix the wrong code about option dictionary param X-Git-Tag: submit/tizen/20160617.040012~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F75%2F75175%2F2;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [HAM] fix the wrong code about option dictionary param Change-Id: I7538d58a6bcf174af023a9e556971af3ff426b34 Signed-off-by: sangrae.kim --- diff --git a/src/humanactivitymonitor/humanactivitymonitor_api.js b/src/humanactivitymonitor/humanactivitymonitor_api.js index fd442d97..412f0c59 100755 --- a/src/humanactivitymonitor/humanactivitymonitor_api.js +++ b/src/humanactivitymonitor/humanactivitymonitor_api.js @@ -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');