From 07186af49fc5e4f8993ec8f24fe45464bd268386 Mon Sep 17 00:00:00 2001 From: "sangrae.kim" Date: Thu, 16 Jun 2016 23:45:50 +0900 Subject: [PATCH] [HAM] fix the wrong code about option dictionary param Change-Id: I7538d58a6bcf174af023a9e556971af3ff426b34 Signed-off-by: sangrae.kim --- src/humanactivitymonitor/humanactivitymonitor_api.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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'); -- 2.34.1