HumanActivityMonitor API
The following human activity monitor functionality is provided:
- Set up callbacks for data change notification
- Get current human activity monitor data
- Record and read human activity data
- Recognize activities and gestures
The gesture recognition API allows applications to be notified and react when the user performs different types of gestures, for example, when the device was tapped, shaken up, picked up or moved along axis.
The activity recognition API allows applications to be notified and react when a user activity is recognized, for example, the user starts to run, walk or is in moving vehicle.
For more information about how to use Human Activity Monitor API, see Human Activity Monitor Guide.
Since: 2.3
Table of Contents
- 1. Type Definitions
- 1.1. HumanActivityType
- 1.2. HumanActivityRecorderType
- 1.3. PedometerStepStatus
- 1.4. ActivityRecognitionType
- 1.5. ActivityAccuracy
- 1.6. SleepStatus
- 1.7. GestureType
- 1.8. GestureEvent
- 2. Interfaces
- 2.1. HumanActivityMonitorManagerObject
- 2.2. HumanActivityMonitorManager
- 2.3. StepDifference
- 2.4. HumanActivityRecorderOption
- 2.5. HumanActivityRecorderQuery
- 2.6. HumanActivityData
- 2.7. HumanActivityPedometerData
- 2.8. HumanActivityAccumulativePedometerData
- 2.9. HumanActivityHRMData
- 2.10. HumanActivityGPSInfo
- 2.11. HumanActivityGPSInfoArray
- 2.12. HumanActivitySleepMonitorData
- 2.13. HumanActivitySleepDetectorData
- 2.14. HumanActivityStressMonitorData
- 2.15. HumanActivityMonitorOption
- 2.16. HumanActivityRecognitionData
- 2.17. HumanActivityRecorderData
- 2.18. HumanActivityRecorderPedometerData
- 2.19. HumanActivityRecorderHRMData
- 2.20. HumanActivityRecorderSleepMonitorData
- 2.21. HumanActivityRecorderPressureData
- 2.22. GestureData
- 2.23. StressMonitorDataRange
- 2.24. HumanActivityMonitorSuccessCallback
- 2.25. HumanActivityReadRecorderSuccessCallback
- 2.26. GestureRecognitionCallback
- 2.27. StressMonitorCallback
- 3. Related Feature
- 4. Full WebIDL
Summary of Interfaces and Methods
1. Type Definitions
1.1. HumanActivityType
enum HumanActivityType { "PEDOMETER", "WRIST_UP", "HRM", "GPS", "SLEEP_MONITOR", "SLEEP_DETECTOR", "STRESS_MONITOR" };
Deprecated. WRIST_UP is deprecated since Tizen 4.0. Use GestureType and addGestureRecognitionListener to monitor WRIST_UP gesture.
Since: 2.3
The human activity monitor types defined by this enumerator are:
- PEDOMETER - Pedometer data
- WRIST_UP - Wrist up gesture
- HRM - Heart rate monitor (Heart rate and RR interval)
- GPS - GPS information (latitude, longitude and speed)
- SLEEP_MONITOR - Sleep monitor (sleep state)
- SLEEP_DETECTOR - Sleep detector (sleep status)
- STRESS_MONITOR - Stress monitor (stress score)
Remark: SLEEP_MONITOR is supported since Tizen 3.0
Remark: SLEEP_DETECTOR and STRESS_MONITOR are supported since Tizen 5.0
1.2. HumanActivityRecorderType
enum HumanActivityRecorderType { "PEDOMETER", "HRM", "SLEEP_MONITOR", "PRESSURE" };
Since: 2.3.2
The human activity recorder types defined by this enumerator are:
- PEDOMETER - Pedometer recorder type
- HRM - Heart rate monitor (Heart rate)
- SLEEP_MONITOR - Sleep monitor (sleep state)
- PRESSURE - Pressure sensor
1.3. PedometerStepStatus
enum PedometerStepStatus { "NOT_MOVING", "WALKING", "RUNNING", "UNKNOWN" };
Since: 2.3
- NOT_MOVING - The user remains stationary
- WALKING - The user is walking
- RUNNING - The user is running
- UNKNOWN - The user's movement type is uncertain
Remark: UNKNOWN is supported since Tizen 2.3.2
1.4. ActivityRecognitionType
enum ActivityRecognitionType { "STATIONARY", "WALKING", "RUNNING", "IN_VEHICLE" };
Since: 2.3.2
The activity recognition types defined by this enumerator are:
- STATIONARY - The stationary activity recognition type
- WALKING - The walking activity recognition type
- RUNNING - The running activity recognition type
- IN_VEHICLE - The in-vehicle activity recognition type
1.5. ActivityAccuracy
enum ActivityAccuracy { "LOW", "MEDIUM", "HIGH" };
Since: 2.3.2
The activity accuracy defined by this enumerator are:
- LOW - Low accuracy
- MEDIUM - Medium accuracy
- HIGH - High accuracy
1.6. SleepStatus
enum SleepStatus { "ASLEEP", "AWAKE", "UNKNOWN" };
Since: 3.0
- ASLEEP - The user is asleep
- AWAKE - The user is awake
- UNKNOWN - Sleep status could not be determined
Code example:
function onchangedCB(sleepInfo) { console.log("Sleep status: " + sleepInfo.status); console.log("Timestamp: " + sleepInfo.timestamp); } tizen.humanactivitymonitor.start("SLEEP_MONITOR", onchangedCB);
Output example:
Sleep status: ASLEEP Timestamp: 1456735296123
1.7. GestureType
enum GestureType { "GESTURE_DOUBLE_TAP", "GESTURE_MOVE_TO_EAR", "GESTURE_NO_MOVE", "GESTURE_PICK_UP", "GESTURE_SHAKE", "GESTURE_SNAP", "GESTURE_TILT", "GESTURE_TURN_FACE_DOWN", "GESTURE_WRIST_UP" };
Since: 4.0
- GESTURE_DOUBLE_TAP - The display of the mobile device is tapped twice
- GESTURE_MOVE_TO_EAR - The mobile device is moved near to an ear
- GESTURE_NO_MOVE - The mobile device is being stopped for a while
- GESTURE_PICK_UP - The mobile device is picked up
- GESTURE_SHAKE - The mobile device is quickly moved back and forth
- GESTURE_SNAP - The mobile device is moved along an axis and back
- GESTURE_TILT - The mobile device is tilted
- GESTURE_TURN_FACE_DOWN - The mobile device is flipped from face to back
- GESTURE_WRIST_UP - The wearable device is moved and faced up
1.8. GestureEvent
enum GestureEvent { "GESTURE_EVENT_DETECTED", "GESTURE_SHAKE_DETECTED", "GESTURE_SHAKE_FINISHED", "GESTURE_SNAP_X_NEGATIVE", "GESTURE_SNAP_X_POSITIVE", "GESTURE_SNAP_Y_NEGATIVE", "GESTURE_SNAP_Y_POSITIVE", "GESTURE_SNAP_Z_NEGATIVE", "GESTURE_SNAP_Z_POSITIVE" };
Since: 4.0
- GESTURE_EVENT_DETECTED - The gesture is detected
- GESTURE_SHAKE_DETECTED - Shake gesture is detected
- GESTURE_SHAKE_FINISHED - Shake gesture is finished
- GESTURE_SNAP_X_NEGATIVE - [-X] snap is detected
- GESTURE_SNAP_X_POSITIVE - [+X] snap is detected
- GESTURE_SNAP_Y_NEGATIVE - [-Y] snap is detected
- GESTURE_SNAP_Y_POSITIVE - [+Y] snap is detected
- GESTURE_SNAP_Z_NEGATIVE - [-Z] snap is detected
- GESTURE_SNAP_Z_POSITIVE - [+Z] snap is detected
2. Interfaces
2.1. HumanActivityMonitorManagerObject
[NoInterfaceObject] interface HumanActivityMonitorManagerObject { readonly attribute HumanActivityMonitorManager humanactivitymonitor; };
Tizen implements HumanActivityMonitorManagerObject;
Since: 2.3
Attributes
-
readonly
HumanActivityMonitorManager humanactivitymonitorObject representing a exif manager.
Since: 2.3
2.2. HumanActivityMonitorManager
[NoInterfaceObject] interface HumanActivityMonitorManager { void getHumanActivityData(HumanActivityType type, HumanActivityMonitorSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void start(HumanActivityType type, optional HumanActivityMonitorSuccessCallback? changedCallback, optional ErrorCallback? errorCallback, optional HumanActivityMonitorOption? option) raises(WebAPIException); void stop(HumanActivityType type) raises(WebAPIException); void setAccumulativePedometerListener(HumanActivityMonitorSuccessCallback changeCallback) raises(WebAPIException); void unsetAccumulativePedometerListener() raises(WebAPIException); long addActivityRecognitionListener(ActivityRecognitionType type, HumanActivityMonitorSuccessCallback listener, optional ErrorCallback? errorCallback) raises(WebAPIException); void removeActivityRecognitionListener(long listenerId, optional ErrorCallback? errorCallback); void startRecorder(HumanActivityRecorderType type, optional HumanActivityRecorderOption option) raises(WebAPIException); void stopRecorder(HumanActivityRecorderType type) raises(WebAPIException); void readRecorderData(HumanActivityRecorderType type, HumanActivityRecorderQuery? query, HumanActivityReadRecorderSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); boolean isGestureSupported(GestureType type) raises(WebAPIException); long addGestureRecognitionListener(GestureType type, GestureRecognitionCallback listener, optional ErrorCallback? errorCallback, optional boolean? alwaysOn) raises(WebAPIException); void removeGestureRecognitionListener(long watchId) raises(WebAPIException); long addStressMonitorChangeListener(StressMonitorDataRange[] ranges, StressMonitorCallback listener) raises(WebAPIException); void removeStressMonitorChangeListener(long watchId) raises(WebAPIException); };
Since: 2.3
Methods
-
getHumanActivityData
-
Gets the current human activity data for certain human activity types.
void getHumanActivityData(HumanActivityType type, HumanActivityMonitorSuccessCallback successCallback, optional ErrorCallback? errorCallback);
Since: 2.3
The start() method should be called to turn on the sensor before calling the getHumanActivityData() method. If not, ServiceNotAvailableError occurs.
If the given type is not supported on a device, NotSupportedError is thrown.
The ErrorCallback method is launched with these error types:
- ServiceNotAvailableError: If the getHumanActivityData() method is called without previously calling the start() method
Privilege level: public
Privilege: http://tizen.org/privilege/healthinfo
Remark: getHumanActivityData() method can only be used with the HRM and PEDOMETER types.
Remark: This function may fail if it is called before the sensor is ready. In case of interval-driven sensors, it is recommended to call the function after at least one sensor event is delivered. Otherwise, applications can retry to call this function to be sure that the sensor is ready.
Parameters:
- type: Human activity data type to read (HRM or PEDOMETER).
- successCallback: Callback method to be invoked when the human activity data has been read.
- errorCallback [optional] [nullable]: Callback method to be invoked when an error occurs.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if registering the success callback fails because of an unknown error.
with error type NotSupportedError, if the given type is not supported on a device or by this method.
with error type SecurityError, if the application does not have the privilege to use this function.
Code example:
function onsuccessCB(pedometerInfo) { console.log("Step status: " + pedometerInfo.stepStatus); console.log("Cumulative total step count: " + pedometerInfo.cumulativeTotalStepCount); } function onerrorCB(error) { console.log("Error occurs, name: " + error.name + ", message: " + error.message); } function onchangedCB(pedometerdata) { console.log("From now on, you will be notified when the pedometer data changes"); /* To get the current data information. */ tizen.humanactivitymonitor.getHumanActivityData("PEDOMETER", onsuccessCB, onerrorCB); } tizen.humanactivitymonitor.start("PEDOMETER", onchangedCB);
Output example:
From now on, you will be notified when the pedometer data changes. Step status: WALKING Cumulative total step count: 100
-
start
-
Starts a sensor and registers a change listener to be called when new human activity data for a given human activity type is available.
void start(HumanActivityType type, optional HumanActivityMonitorSuccessCallback? changedCallback, optional ErrorCallback? errorCallback, optional HumanActivityMonitorOption? option);
Since: 2.3
The ErrorCallback method is launched with these error types:
- ServiceNotAvailableError - If the human activity service is not available. For the GPS type, if the GPS function is disabled by the user in the location settings, it is not possible to receive notifications when the GPS value changes.
Privilege level: public
Privilege: http://tizen.org/privilege/healthinfo
Remark: When the CPU is in the power saving mode, the WRIST_UP event might not occur even though <tizen:setting background-support="enable" /> is declared in the config.xml file.
Remark: The "http://tizen.org/privilege/location" privilege is required for only the GPS type. That means that both "http://tizen.org/privilege/healthinfo" and "http://tizen.org/privilege/location" should be declared in config.xml file for the GPS type. For other types, only "http://tizen.org/privilege/healthinfo" should be declared.
Remark: errorCallback and option are supported since Tizen 2.3.2.
Parameters:
-
type:
Human activity type to register a listener for.
- Conditional privilege: For using GPS value, privilege http://tizen.org/privilege/location (public level) is needed since Tizen 2.3.
-
changedCallback [optional] [nullable]:
Callback method to be invoked when new human activity data is available
Note that the listener is not called for the successful start of a human activity sensor. - errorCallback [optional] [nullable]: Callback method to be invoked when an error occurs.
-
option [optional] [nullable]:
The option to set the period and the interval for several human activity types
By default, this parameter is set to null.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if registering the listener fails because of an unknown error.
with error type NotSupportedError, if the given type is not supported on a device.
with error type SecurityError, if the application does not have the privilege to use this function.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
Code example:
function onchangedCB(pedometerInfo) { console.log("Step status: " + pedometerInfo.stepStatus); console.log("Cumulative total step count: " + pedometerInfo.cumulativeTotalStepCount); } tizen.humanactivitymonitor.start("PEDOMETER", onchangedCB);
Output example:
Step status: WALKING Cumulative total step count: 100
Code example:
function onchangedCB(info) { var gpsInfo = info.gpsInfo; for (var index = 0; index < gpsInfo.length; index++) { console.log("latitude: " + gpsInfo[index].latitude); console.log("longitude: " + gpsInfo[index].longitude); } } function onerrorCB(error) { console.log("Error occurred, name: " + error.name + ", message: " + error.message); } try { tizen.humanactivitymonitor.start( "GPS", onchangedCB, onerrorCB, {callbackInterval: 150000, sampleInterval: 1000}); } catch (err) { console.log(err.name + ": " + err.message); }
-
stop
-
Stops the sensor and unregisters a previously registered listener for available human activity data.
void stop(HumanActivityType type);
Since: 2.3
Privilege level: public
Privilege: http://tizen.org/privilege/healthinfo
Remark: The "http://tizen.org/privilege/location" privilege is required for only the GPS type. That means that both "http://tizen.org/privilege/healthinfo" and "http://tizen.org/privilege/location" should be declared in config.xml file for the GPS type. For other types, only "http://tizen.org/privilege/healthinfo" should be declared.
Parameters:
-
type:
Human activity type to unregister the listener for.
- Conditional privilege: For using GPS value, privilege http://tizen.org/privilege/location (public level) is needed since Tizen 2.3.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if unregistering the listener fails because of an unknown error.
with error type NotSupportedError, if the given type is not supported on a device.
with error type SecurityError, if the application does not have the privilege to use this function.
Code example:
tizen.humanactivitymonitor.stop("PEDOMETER");
-
type:
Human activity type to unregister the listener for.
-
setAccumulativePedometerListener
-
Starts the sensor and registers a listener to be called when new accumulative pedometer data is available.
void setAccumulativePedometerListener(HumanActivityMonitorSuccessCallback changeCallback);
Since: 2.3
Note that the setAccumulativePedometerListener() method does not need to call the sensor's start() method.
Privilege level: public
Privilege: http://tizen.org/privilege/healthinfo
Parameters:
-
changeCallback:
Callback method to be invoked when new accumulative pedometer data is available
Callback is invoked with HumanActivityAccumulativePedometerData as an argument.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if registering the listener fails because of an unknown error.
with error type NotSupportedError, if the pedometer sensor is not supported on a device.
with error type SecurityError, if the application does not have the privilege to call this method.
Code example:
function onchangedCB(pedometerInfo) { console.log("Step status: " + pedometerInfo.stepStatus); console.log("Accumulative total step count: " + pedometerInfo.accumulativeTotalStepCount); } tizen.humanactivitymonitor.setAccumulativePedometerListener(onchangedCB);
Output example:
Step status: WALKING Accumulative total step count: 100
-
changeCallback:
Callback method to be invoked when new accumulative pedometer data is available
-
unsetAccumulativePedometerListener
-
Stops the sensor and unregisters a previously registered listener for the accumulative pedometer data.
void unsetAccumulativePedometerListener();
Since: 2.3
Calling this function has no effect if listener is not set.
Privilege level: public
Privilege: http://tizen.org/privilege/healthinfo
Exceptions:
- WebAPIException
with error type UnknownError, if unregistering the listener fails because of an unknown error.
with error type SecurityError, if the application does not have the privilege to call this method.
Code example:
tizen.humanactivitymonitor.unsetAccumulativePedometerListener();
- WebAPIException
-
addActivityRecognitionListener
-
Registers a listener that is to be called when the activity is recognized.
long addActivityRecognitionListener(ActivityRecognitionType type, HumanActivityMonitorSuccessCallback listener, optional ErrorCallback? errorCallback);
Since: 2.3.2
The ErrorCallback method is launched with this error type:
- AbortError: If the system operation was aborted.
Parameters:
- type: Human activity recognition type to recognize.
- listener: Callback method to be invoked when new human activity data is recognized.
- errorCallback [optional] [nullable]: Callback method to be invoked when an error occurs.
Return value:
-
long:
ID of the listener that can be used to remove the listener later.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type NotSupportedError, if the activity type for recognition is not supported on a device.
Code example:
function errorCallback(error) { console.log(error.name + ": " + error.message); } function listener(info) { console.log("type: " + info.type); console.log("timestamp: " + info.timestamp); console.log("accuracy: " + info.accuracy); } try { var listenerId = tizen.humanactivitymonitor.addActivityRecognitionListener("WALKING", listener, errorCallback); } catch (error) { console.log(error.name + ": " + error.message); }
Output example:
type: WALKING timestamp: 1456735296123 accuracy: MEDIUM
-
removeActivityRecognitionListener
-
Unsubscribes from receiving notifications when the activity is recognized.
void removeActivityRecognitionListener(long listenerId, optional ErrorCallback? errorCallback);
Since: 2.3.2
Calling this function has no effect if there is no listener with given id.
The ErrorCallback method is launched with this error type:
- AbortError: If the system operation was aborted.
Parameters:
- listenerId: An ID that identifies the listener.
- errorCallback [optional] [nullable]: Callback method to be invoked when an error occurs.
Code example:
var listenerId; function errorCallback(error) { console.log(error.name + ": " + error.message); } function listener(info) { console.log("type: " + info.type); console.log("timestamp: " + info.timestamp); console.log("accuracy: " + info.accuracy); tizen.humanactivitymonitor.removeActivityRecognitionListener(listenerId, errorCallback); } try { listenerId = tizen.humanactivitymonitor.addActivityRecognitionListener("WALKING", listener, errorCallback); } catch (error) { console.log(error.name + ": " + error.message); }
Output example:
type: WALKING timestamp: 1456735296123 accuracy: MEDIUM
-
startRecorder
-
Starts recording human activity data for a given human activity type.
void startRecorder(HumanActivityRecorderType type, optional HumanActivityRecorderOption option);
Since: 2.3.2
Privilege level: public
Privilege: http://tizen.org/privilege/healthinfo
Parameters:
- type: Human activity type to record.
- option [optional]: The option to set an interval and a period for retention.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to use this function.
with error type NotSupportedError, if the human activity recorder type is not supported.
with error type AbortError, if the system operation was aborted.
with error type ServiceNotAvailableError, if the human activity recorder type is already started by any application of a package.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
Code example:
var type = "PRESSURE"; var options = { retentionPeriod: 1 /* 1 hour. */ }; try { tizen.humanactivitymonitor.startRecorder(type, options); } catch (err) { console.log(err.name + ": " + err.message); }
-
stopRecorder
-
Stops recording human activity data for a given human activity type.
void stopRecorder(HumanActivityRecorderType type);
Since: 2.3.2
Parameters:
- type: Human activity type to stop recording.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type NotSupportedError, if the human activity recorder type is not supported.
with error type AbortError, if the system operation was aborted.
Code example:
var type = "PRESSURE"; try { tizen.humanactivitymonitor.startRecorder(type); /* Do something. */ tizen.humanactivitymonitor.stopRecorder(type); } catch (err) { console.log(err.name + ": " + err.message); }
-
readRecorderData
-
Reads the recorded human activity data with some query.
void readRecorderData(HumanActivityRecorderType type, HumanActivityRecorderQuery? query, HumanActivityReadRecorderSuccessCallback successCallback, optional ErrorCallback? errorCallback);
Since: 2.3.2
If another application has recorded data for a particular human activity type, your application can read that data. Therefore, you can use this method to read without calling startRecorder().
The ErrorCallback method is launched with these error types:
- AbortError: If the system operation was aborted while reading data asynchronously.
- NotFoundError: If no recorder data is available.
Privilege level: public
Privilege: http://tizen.org/privilege/healthinfo
Parameters:
- type: Human activity type to record.
- query [nullable]: The query to use.
- successCallback: Callback method to be invoked when recorded human activity data is successfully read.
- errorCallback [optional] [nullable]: Callback method to be invoked when an error occurs.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to use this function.
with error type NotSupportedError, if the human activity recorder type is not supported.
with error type AbortError, if the system operation was aborted when it is requested to read data.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
Code example:
function onerror(error) { console.log(error.name + ": " + error.message); } function onread(data) { for (var idx = 0; idx < data.length; ++idx) { console.log("startTime: " + data[idx].startTime); console.log("endTime: " + data[idx].endTime); console.log("calories: " + data[idx].calorie); } } var type = "PEDOMETER"; var query = {}; try { tizen.humanactivitymonitor.readRecorderData(type, query, onread, onerror); } catch (err) { console.log(err.name + ": " + err.message); }
Output example:
startTime: 1420311755 endTime: 1420313238 calories: 24.83
-
isGestureSupported
-
Checks if gesture type is supported on a device.
boolean isGestureSupported(GestureType type);
Since: 4.0
This function allows to check whether a gesture type is supported on the current device. Some gestures may not be supported on some devices because of lack necessary sensors.
Parameters:
- type: Gesture type to check if it is supported on a device.
Return value:
-
boolean:
true if the given gesture type is supported.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if input parameter is not compatible with the expected type.
with error type AbortError, if any error occurs.
Code example:
try { var isSupported = tizen.humanactivitymonitor.isGestureSupported("GESTURE_PICK_UP"); console.log("GESTURE_PICK_UP is " + (isSupported ? "supported" : "not supported")); } catch (error) { console.log("Error " + error.name + ": " + error.message); }
Output example:
GESTURE_PICK_UP is supported.
-
addGestureRecognitionListener
-
Adds a listener to be invoked when given gesture type is detected.
long addGestureRecognitionListener(GestureType type, GestureRecognitionCallback listener, optional ErrorCallback? errorCallback, optional boolean? alwaysOn);
Since: 4.0
The ErrorCallback method is launched with this error type:
- AbortError: If the system operation was aborted.
Parameters:
- type: The gesture type to be monitored.
- listener: Listener to be called when gesture is detected or an error occurred.
- errorCallback [optional] [nullable]: Callback method to be invoked when an error occurs.
-
alwaysOn [optional] [nullable]:
The option of the monitored gesture mode. If it is set to false system may try to reduce power consumption, for example by stopping detecting gestures when display is turned off.
If it is set to true power-saving functionality is off. Default value is false.
Return value:
-
long:
The watch ID used to remove the listener.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type NotSupportedError, if the gesture recognition is not supported.
with error type IOError, if adding listener failed.
Code example:
function listener(data) { console.log("Received " + data.event + " event on " + new Date(data.timestamp * 1000) + " for " + data.type + " type"); } function errorCallback(error) { console.log(error.name + ": " + error.message); } try { var listenerId = tizen.humanactivitymonitor.addGestureRecognitionListener( "GESTURE_SHAKE", listener, errorCallback, true); console.log("Listener with id " + listenerId + " has been added"); } catch (error) { console.log("Error " + error.name + ": " + error.message); }
Output example:
Listener with id 1 has been added Received GESTURE_SHAKE_DETECTED event on Thu Sep 01 2016 14:33:56 GMT+0200 (CEST) for GESTURE_SHAKE type
-
removeGestureRecognitionListener
-
Removes listener with the given id.
void removeGestureRecognitionListener(long watchId);
Since: 4.0
Calling this function has no effect if there is no listener with given id.
Parameters:
- watchId: The ID of the registered listener.
Exceptions:
- WebAPIException
with error type AbortError, if system error occurs while removing listener.
Code example:
function listener(data) { console.log("Received " + data.event + " event on " + new Date(data.timestamp * 1000) + " for " + data.type + " type"); } function errorCallback(error) { console.log(error.name + ": " + error.message); } try { var listenerId = tizen.humanactivitymonitor.addGestureRecognitionListener( "GESTURE_SHAKE", listener, errorCallback); tizen.humanactivitymonitor.removeGestureRecognitionListener(listenerId); console.log("Listener with id " + listenerId + " has been removed"); } catch (error) { console.log("Error " + error.name + ": " + error.message); }
Output example:
Listener with id 1 has been removed
-
addStressMonitorChangeListener
-
Adds a listener to be invoked when returned value enters into defined range (the range is changed).
long addStressMonitorChangeListener(StressMonitorDataRange[] ranges, StressMonitorCallback listener);
Since: 5.0
listener is called whenever value returned from STRESS_MONITOR enters into defined range.
For example:
Registered ranges:
Label min max Normal 10 15 Stress Alarm 15 17 Returning value:
Value Action Comments 9 No Action Out of range 11 Normal Within the range 10-15 12 No Action Already in range 15 Stress Alarm Within the range 15-17 17 No Action Out of range 18 No Action Out of range 10 Normal Within the range 10-15 Privilege level: public
Privilege: http://tizen.org/privilege/healthinfo
Remark: Note that the addStressMonitorListener() method needs to call the sensor's start() method.
Remark: min value in StressMonitorDataRange is included into defined range. max value in StressMonitorDataRange is excluded from defined range.
Parameters:
- ranges: List of defined ranges.
- listener: Listener to be called when gesture is detected or an error occurred.
Return value:
-
long:
The watch ID used to remove the listener.
Exceptions:
- WebAPIException
with error type NotSupportedError, if the stress monitor is not supported.
with error type SecurityError, if the application does not have the privilege to use this function.
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
Code example:
var listenerId; function listener(label) { console.log("Stress level: " + label); } var ranges = [ new tizen.StressMonitorDataRange("Normal", 10, 15), new tizen.StressMonitorDataRange("Stress Alarm", 15, 17) ]; try { listenerId = tizen.humanactivitymonitor.addStressMonitorChangeListener(ranges, listener); } catch (error) { console.log(error.name + ": " + error.message); }
Output example:
/* Value returned from STRESS_MONITOR - 9. */ /* Value returned from STRESS_MONITOR - 11. */ Stress level: Normal /* Value returned from STRESS_MONITOR - 12. */ /* Value returned from STRESS_MONITOR - 15. */ Stress level: Stress Alarm /* Value returned from STRESS_MONITOR - 17. */ /* Value returned from STRESS_MONITOR - 18. */ /* Value returned from STRESS_MONITOR - 10. */ Stress level: Normal
-
removeStressMonitorChangeListener
-
Removes listener with the given id.
void removeStressMonitorChangeListener(long watchId);
Since: 5.0
Calling this function has no effect if there is no listener with given id.
Parameters:
- watchId: The ID of the registered listener.
Exceptions:
- WebAPIException
with error type AbortError, if system error occurs while removing listener.
Code example:
var listenerId; function listener(label) { console.log("Stress level: " + label); } var ranges = [ new tizen.StressMonitorDataRange("Normal", 10, 15), new tizen.StressMonitorDataRange("Stress Alarm", 15, 17) ]; try { listenerId = tizen.humanactivitymonitor.addStressMonitorChangeListener(ranges, listener); tizen.humanactivitymonitor.removeStressMonitorChangeListener(listenerId); console.log("Listener with id " + listenerId + " has been removed"); } catch (error) { console.log(error.name + ": " + error.message); }
Output example:
Listener with id 1 has been removed
2.3. StepDifference
[NoInterfaceObject] interface StepDifference { readonly attribute long stepCountDifference; readonly attribute long timestamp; };
Since: 2.3
Attributes
-
readonly
long stepCountDifferenceCount difference between the steps.
Since: 2.3
-
readonly
long timestampTimestamp in seconds.
Since: 2.3
2.4. HumanActivityRecorderOption
dictionary HumanActivityRecorderOption { long interval; long retentionPeriod; };
Since: 2.3.2
Code example:
var option = {interval: 10, retentionPeriod: 1};
Dictionary members
- long interval
-
Interval in minutes at which human activity recorder data will be recorded.
For the HRM type, the interval can be between 10 and 1440 (1 day) inclusive.
If interval is not specified, it is set to the default value of 1440 minutes (1 day).
For other human activity recorder types, interval will be ignored.Since: 2.3.2
Remark: The specified interval is only a suggested interval between sensor measurements. You will get at least one sensor measurement within the interval you specify, but the actual interval between sensor measurements can be affected by other applications and the system. To reduce the system overhead, it is recommended to set the longest interval that you can, because the system usually chooses the shortest interval among all intervals specified.
- long retentionPeriod
-
Retention period in hours for which human activity recorder data should be retained.
The retentionPeriod can be between 1 and 744 (31 days) inclusive.
If retentionPeriod is not specified, it is set to the default value of 1 hour.Since: 2.3.2
2.5. HumanActivityRecorderQuery
dictionary HumanActivityRecorderQuery { long startTime; long endTime; long anchorTime; long interval; };
Since: 2.3.2
Dictionary members
- long startTime
-
The start time of the data to be queried. Epoch time in seconds.
The startTime should be greater than or equal to zero.
If startTime is not specified, it is set to the default value of 1 day ago.Since: 2.3.2
- long endTime
-
The end time of the date to be queried. Epoch time in seconds.
The endTime should be greater than startTime.
If endTime is not specified, it is set to the current time.Since: 2.3.2
- long anchorTime
-
The anchor point to slice the read data. Epoch time in seconds.
For the PEDOMETER and PRESSURE type, the anchorTime can only be used.
The anchorTime should be greater than or equal to zero.
If anchorTime is not specified, it will be set to the endTime.The interval will extend away from the anchorTime in both directions. The exact date does not matter for the anchorTime. This is because the anchorTime is used in combination with the interval. For example, the anchorTime can be 1:00 am, January 1, 2000 or 1:00 am, August 15, 2010 with a 1 day interval. In both cases, the anchorTime will be 1:00 am internally.
Since: 2.3.2
Code example:
function onerror(error) { console.log(error.name + ": " + error.message); } function onread(data) { for (var idx = 0; idx < data.length; ++idx) { console.log("*** " + idx); console.log("max pressure: " + data[idx].max); console.log("min pressure: " + data[idx].min); console.log("average: " + data[idx].average); } } var type = "PRESSURE"; var now = new Date(); var startTime = now.setDate(now.getDate() - 4); var anchorTime = new Date(2000, 1, 2, 6).getTime(); var query = { startTime: startTime / 1000, anchorTime: anchorTime / 1000, interval: 1440 /* 1 day. */ }; try { tizen.humanactivitymonitor.readRecorderData(type, query, onread, onerror); } catch (err) { console.log(err.name + ": " + err.message); }
Output example:
*** 0 max pressure: 1013.00 min pressure: 930.00 average: 980.00 *** 1 max pressure: 1012.00 min pressure: 954.00 average: 986.00 *** 2 max pressure: 950.00 min pressure: 904.00 average: 932.00 *** 3 max pressure: 1012.00 min pressure: 920.00 average: 942.00 *** 4 max pressure: 1012.00 min pressure: 1005.00 average: 1008.00
- long interval
-
Interval in minutes at which human activity recorder data will be read.
The interval should be greater than or equal to zero.
For the PEDOMETER and PRESSURE type, if interval is not specified, it is set to the difference between endTime and startTime.
For the PRESSURE type, if it is set to zero, all raw data recorded from startTime to endTime will be returned.
For other recorder types, interval will be ignored.
Since: 2.3.2
2.6. HumanActivityData
[NoInterfaceObject] interface HumanActivityData { };
Since: 2.3
2.7. HumanActivityPedometerData
[NoInterfaceObject] interface HumanActivityPedometerData : HumanActivityData { readonly attribute PedometerStepStatus stepStatus; readonly attribute double speed; readonly attribute double walkingFrequency; readonly attribute double cumulativeDistance; readonly attribute double cumulativeCalorie; readonly attribute double cumulativeTotalStepCount; readonly attribute double cumulativeWalkStepCount; readonly attribute double cumulativeRunStepCount; readonly attribute StepDifference[] stepCountDifferences; };
Since: 2.3
Attributes
-
readonly
PedometerStepStatus stepStatusThe current movement type.
Since: 2.3
-
readonly
double speedCurrent speed in km/h.
Since: 2.3
-
readonly
double walkingFrequencyStep count per second.
Since: 2.3
-
readonly
double cumulativeDistanceCumulative distance traveled since the last start() method call in meters.
Since: 2.3
-
readonly
double cumulativeCalorieCumulative calories burnt since the last start() method call in kcal.
Since: 2.3
-
readonly
double cumulativeTotalStepCountCumulative walking and running step count since the last start() method call.
The value is the sum of cumulativeWalkStepCount and cumulativeRunStepCount.
Since: 2.3
-
readonly
double cumulativeWalkStepCountCumulative walking step count since the last start() method call.
Since: 2.3
-
readonly
double cumulativeRunStepCountCumulative running step count since the last start() method call.
Since: 2.3
-
readonly
StepDifference[]
stepCountDifferencesArray of the StepDifference.
Since: 2.3
2.8. HumanActivityAccumulativePedometerData
[NoInterfaceObject] interface HumanActivityAccumulativePedometerData : HumanActivityData { readonly attribute PedometerStepStatus stepStatus; readonly attribute double speed; readonly attribute double walkingFrequency; readonly attribute double accumulativeDistance; readonly attribute double accumulativeCalorie; readonly attribute double accumulativeTotalStepCount; readonly attribute double accumulativeWalkStepCount; readonly attribute double accumulativeRunStepCount; readonly attribute StepDifference[] stepCountDifferences; };
Since: 2.3
Attributes
-
readonly
PedometerStepStatus stepStatusCurrent movement type.
Since: 2.3
-
readonly
double speedCurrent speed in km/h.
Since: 2.3
-
readonly
double walkingFrequencyStep count per second.
Since: 2.3
-
readonly
double accumulativeDistanceAccumulative distance traveled since the device boot in meters.
Since: 2.3
-
readonly
double accumulativeCalorieAccumulative calories burnt since the device boot in kcal.
Since: 2.3
-
readonly
double accumulativeTotalStepCountAccumulative walking and running step count since the device boot.
The value is the sum of accumulativeWalkStepCount and accumulativeRunStepCount.
Since: 2.3
-
readonly
double accumulativeWalkStepCountAccumulative walking step count since the device boot.
Since: 2.3
-
readonly
double accumulativeRunStepCountAccumulative running step count since the device boot.
Since: 2.3
-
readonly
StepDifference[]
stepCountDifferencesArray of the StepDifference.
Since: 2.3
2.9. HumanActivityHRMData
[NoInterfaceObject] interface HumanActivityHRMData : HumanActivityData { readonly attribute long heartRate; readonly attribute long rRInterval; };
Since: 2.3
Attributes
-
readonly
long heartRateHeart rate in beats per minute. When a user takes off the watch device, the heartRate is set to -3. When a user shakes the watch, the heartRate is set to -2.
Since: 2.3
-
readonly
long rRIntervalPeak-to-peak interval in millisecond(s).
Since: 2.3
2.10. HumanActivityGPSInfo
[NoInterfaceObject] interface HumanActivityGPSInfo { readonly attribute double latitude; readonly attribute double longitude; readonly attribute double altitude; readonly attribute double speed; readonly attribute long errorRange; readonly attribute long timestamp; };
Since: 2.3
Attributes
-
readonly
double latitudeAn attribute to indicate the user's latitude in degrees.
Since: 2.3
-
readonly
double longitudeAn attribute to indicate the user's longitude in degrees.
Since: 2.3
-
readonly
double altitudeAn attribute to indicate the user's altitude in meters.
Since: 2.3
-
readonly
double speedAn attribute to indicate the speed in km/h.
Since: 2.3
-
readonly
long errorRangeAn attribute to indicate the error range of the user's position in meters.
Since: 2.3
-
readonly
long timestampAn attribute to indicate timestamp in seconds.
Since: 2.3
2.11. HumanActivityGPSInfoArray
[NoInterfaceObject] interface HumanActivityGPSInfoArray : HumanActivityData { readonly attribute HumanActivityGPSInfo[] gpsInfo; };
Since: 2.3
Attributes
-
readonly
HumanActivityGPSInfo[]
gpsInfoAn attribute to indicate the array of GPS information.
Since: 2.3
2.12. HumanActivitySleepMonitorData
[NoInterfaceObject] interface HumanActivitySleepMonitorData : HumanActivityData { readonly attribute SleepStatus status; readonly attribute long long timestamp; };
Since: 3.0
Remark: If the device's display is off, multiple callbacks consisting of sleep monitor data are all invoked at once at a device specific interval. There is a callback for each minute in the interval. For example, if the device's interval is 20 minutes, 20 callbacks will be invoked every 20 minutes. When the display is turned on, all callbacks which have not been invoked are invoked and the callback is invoked every one minute from then on. Therefore, if the display is turned on at 25 minutes, five callbacks will be invoked.
Attributes
-
readonly
SleepStatus statusThe sleep status.
Since: 3.0
-
readonly
long long timestampThe time when the sleep status is recognized. Epoch time in milliseconds.
Since: 3.0
2.13. HumanActivitySleepDetectorData
[NoInterfaceObject] interface HumanActivitySleepDetectorData : HumanActivityData { readonly attribute SleepStatus status; };
Since: 5.0
Attributes
-
readonly
SleepStatus statusSleep state (can be UNKNOWN, ASLEEP and AWAKE).
Since: 5.0
2.14. HumanActivityStressMonitorData
[NoInterfaceObject] interface HumanActivityStressMonitorData : HumanActivityData { readonly attribute long stressScore; };
Since: 5.0
Attributes
-
readonly
long stressScoreValue returned from STRESS_MONITOR. It's a RR-interval.
Since: 5.0
2.15. HumanActivityMonitorOption
dictionary HumanActivityMonitorOption { long callbackInterval; long sampleInterval; };
Since: 2.3.2
Dictionary members
- long callbackInterval
-
The interval in milliseconds (ms) at which human activity data will be sent to the Web Application.
For the GPS type, callbackInterval should be greater than or equal to the sampleInterval. The maximum permissible value for callbackInterval is device specific. If callbackInterval is not specified or zero, it is set to the default value of 150000ms. The callbackInterval will be ignored when the display is on. Instead, The callbackInterval will be set to the sampleInterval.
For the HRM type, callbackInterval can be between 10ms and 1000ms inclusive, however, if it not specified or zero, it is set by the default value of 100ms.
For other activity types, callbackInterval will be ignored.Since: 2.3.2
Remark: The specified interval is only a suggested interval between sensor measurements. You will get at least one sensor measurement within the interval you specify, but the actual interval between sensor measurements can be affected by other applications and the system. To reduce the system overhead, it is recommended to set the longest interval that you can, because the system usually chooses the shortest interval among all intervals specified.
- long sampleInterval
-
GPS information sampling interval in milliseconds (ms)
For the GPS type, sampleInterval should be greater than or equal to 1000ms. The maximum permissible value for sampleInterval is device specific. If sampleInterval is not specified or zero, it is set to the the default value of 1000ms.
For other activity types, sampleInterval will be ignored.Since: 2.3.2
2.16. HumanActivityRecognitionData
[NoInterfaceObject] interface HumanActivityRecognitionData : HumanActivityData { readonly attribute ActivityRecognitionType type; readonly attribute long timestamp; readonly attribute ActivityAccuracy accuracy; };
Since: 2.3.2
Attributes
-
readonly
ActivityRecognitionType typeThe type of activity.
Since: 2.3.2
-
readonly
long timestampThe time when the activity is recognized. Epoch time in seconds.
Since: 2.3.2
-
readonly
ActivityAccuracy accuracyThe degree of accuracy.
Since: 2.3.2
2.17. HumanActivityRecorderData
[NoInterfaceObject] interface HumanActivityRecorderData { readonly attribute long startTime; readonly attribute long endTime; };
Since: 2.3.2
Attributes
-
readonly
long startTimeRecording start time of the data in this HumanActivityRecorderData object. Epoch time in seconds.
Since: 2.3.2
-
readonly
long endTimeRecording end time of the data in this HumanActivityRecorderData object. Epoch time in seconds.
Since: 2.3.2
2.18. HumanActivityRecorderPedometerData
[NoInterfaceObject] interface HumanActivityRecorderPedometerData : HumanActivityRecorderData { readonly attribute double distance; readonly attribute double calorie; readonly attribute double totalStepCount; readonly attribute double walkStepCount; readonly attribute double runStepCount; };
Since: 2.3.2
Attributes
-
readonly
double distanceDistance traveled from startTime to endTime in meters.
Since: 2.3.2
-
readonly
double calorieCalories burnt from startTime to endTime in kcal.
Since: 2.3.2
-
readonly
double totalStepCountWalking and running step count from startTime to endTime. The value is the sum of walkingStepCount and runningStepCount.
Since: 2.3.2
-
readonly
double walkStepCountWalking step count from startTime to endTime.
Since: 2.3.2
-
readonly
double runStepCountRunning step count from startTime to endTime.
Since: 2.3.2
2.19. HumanActivityRecorderHRMData
[NoInterfaceObject] interface HumanActivityRecorderHRMData : HumanActivityRecorderData { readonly attribute long heartRate; };
Since: 2.3.2
Attributes
-
readonly
long heartRateHeart rate in beats per minute.
Since: 2.3.2
2.20. HumanActivityRecorderSleepMonitorData
[NoInterfaceObject] interface HumanActivityRecorderSleepMonitorData : HumanActivityRecorderData { readonly attribute SleepStatus status; };
Since: 2.3.2
Attributes
-
readonly
SleepStatus statusThe sleep status.
Since: 2.3.2
2.21. HumanActivityRecorderPressureData
[NoInterfaceObject] interface HumanActivityRecorderPressureData : HumanActivityRecorderData { readonly attribute double? max; readonly attribute double? min; readonly attribute double? average; };
Since: 2.3.2
Attributes
-
readonly
double max [nullable]Max pressure in hectopascal (hPa).
Since: 2.3.2
-
readonly
double min [nullable]Min pressure in hectopascal (hPa).
Since: 2.3.2
-
readonly
double average [nullable]Average pressure in hectopascal (hPa).
Since: 2.3.2
2.22. GestureData
[NoInterfaceObject] interface GestureData { readonly attribute GestureType type; readonly attribute GestureEvent event; readonly attribute long timestamp; readonly attribute double? x; readonly attribute double? y; };
Since: 4.0
Attributes
-
readonly
GestureType typeIdentifier of gesture type.
Since: 4.0
-
readonly
GestureEvent eventEvent type related to the detected gesture.
Since: 4.0
-
readonly
long timestampTime when gesture was detected. Epoch time in seconds.
Since: 4.0
-
readonly
double x [nullable]Tilt degree on X-axis. It is used only for GESTURE_TILT type. For other gesture types it is set to null.
Since: 4.0
-
readonly
double y [nullable]Tilt degree on Y-axis. It is used only for GESTURE_TILT type. For other gesture types it is set to null.
Since: 4.0
2.23. StressMonitorDataRange
[Constructor(optional DOMString label, optional unsigned long min, optional unsigned long max)] interface StressMonitorDataRange { attribute DOMString label; attribute unsigned long min; attribute unsigned long max; };
Since: 5.0
Constructors
Attributes
-
DOMString labelName of range. Default value is "";
Since: 5.0
-
unsigned long minMinimum value of range. Default value is 0.
Since: 5.0
-
unsigned long maxMaximum value of range. If max is undefined it means that this value represents infinity. Default value is undefined.
Since: 5.0
2.24. HumanActivityMonitorSuccessCallback
[Callback=FunctionOnly, NoInterfaceObject] interface HumanActivityMonitorSuccessCallback { void onsuccess(optional HumanActivityData? humanactivitydata); };
Since: 2.3
Methods
-
onsuccess
-
Called when there is new human activity data available.
void onsuccess(optional HumanActivityData? humanactivitydata);
Since: 2.3
Parameters:
-
humanactivitydata [optional] [nullable]:
New human activity data
Note that null is passed for the WRIST_UP type.
-
humanactivitydata [optional] [nullable]:
New human activity data
2.25. HumanActivityReadRecorderSuccessCallback
[Callback=FunctionOnly, NoInterfaceObject] interface HumanActivityReadRecorderSuccessCallback { void onsuccess(HumanActivityRecorderData[] humanactivitydata); };
Since: 2.3.2
Methods
-
onsuccess
-
Called when recorded human activity data is successfully read.
void onsuccess(HumanActivityRecorderData[] humanactivitydata);
Since: 2.3.2
Parameters:
- humanactivitydata: Recorded human activity data.
2.26. GestureRecognitionCallback
[Callback=FunctionOnly, NoInterfaceObject] interface GestureRecognitionCallback { void onsuccess(GestureData data); };
Since: 4.0
Methods
-
onsuccess
-
Called when a gesture is detected.
void onsuccess(GestureData data);
Since: 4.0
Parameters:
- data: GestureData which contains information about detected gesture.
2.27. StressMonitorCallback
[Callback=FunctionOnly, NoInterfaceObject] interface StressMonitorCallback { void onsuccess(DOMString label); };
Since: 5.0
Methods
-
onsuccess
-
Called when value returned from STRESS_MONITOR is within registered range.
void onsuccess(DOMString label);
Since: 5.0
Parameters:
- label: Name of the registered range in StressMonitorDataRange.
3. Related Feature
To guarantee that the Human Activity Monitor application runs on a device which supports this API, declare the following feature requirements in the config file:
To guarantee that the pedometer application runs on a device with pedometer, declare the following feature requirements in the config file:
To guarantee that the wrist-up gesture recognition application runs on a device with wrist up, declare the following feature requirements in the config file:
To guarantee that the gesture recognition application runs on a device with gesture recognition feature, declare the following feature requirement in the config file:
To guarantee that the Heart Rate Monitor application runs on a device with heart rate monitor, declare the following feature requirements in the config file:
To guarantee that the GPS batch information tracking application runs on a device with GPS batch feature, declare the following feature requirements in the config file:
To guarantee that the activity information tracking application runs on a device with activity recognition feature, declare the following feature requirements in the config file:
To guarantee that the human sleep state tracking application runs on a device with sleep monitor feature, declare the following feature requirements in the config file:
To guarantee that the barometer (pressure) sensor application runs on a device with a barometric (pressure) sensor, declare the following feature requirement in the config file:
To guarantee that the stress monitor vector sensor application runs on a device with a stress monitor, declare the below feature requirements in the config file.
4. Full WebIDL
module HumanActivityMonitor { enum HumanActivityType { "PEDOMETER", "HRM", "GPS", "SLEEP_MONITOR", "SLEEP_DETECTOR", "STRESS_MONITOR" }; enum HumanActivityRecorderType { "PEDOMETER", "HRM", "SLEEP_MONITOR", "PRESSURE" }; enum PedometerStepStatus { "NOT_MOVING", "WALKING", "RUNNING", "UNKNOWN" }; enum ActivityRecognitionType { "STATIONARY", "WALKING", "RUNNING", "IN_VEHICLE" }; enum ActivityAccuracy { "LOW", "MEDIUM", "HIGH" }; enum SleepStatus { "ASLEEP", "AWAKE", "UNKNOWN" }; enum GestureType { "GESTURE_DOUBLE_TAP", "GESTURE_MOVE_TO_EAR", "GESTURE_NO_MOVE", "GESTURE_PICK_UP", "GESTURE_SHAKE", "GESTURE_SNAP", "GESTURE_TILT", "GESTURE_TURN_FACE_DOWN", "GESTURE_WRIST_UP" }; enum GestureEvent { "GESTURE_EVENT_DETECTED", "GESTURE_SHAKE_DETECTED", "GESTURE_SHAKE_FINISHED", "GESTURE_SNAP_X_NEGATIVE", "GESTURE_SNAP_X_POSITIVE", "GESTURE_SNAP_Y_NEGATIVE", "GESTURE_SNAP_Y_POSITIVE", "GESTURE_SNAP_Z_NEGATIVE", "GESTURE_SNAP_Z_POSITIVE" }; dictionary HumanActivityRecorderOption { long interval; long retentionPeriod; }; dictionary HumanActivityRecorderQuery { long startTime; long endTime; long anchorTime; long interval; }; dictionary HumanActivityMonitorOption { long callbackInterval; long sampleInterval; }; Tizen implements HumanActivityMonitorManagerObject; [NoInterfaceObject] interface HumanActivityMonitorManagerObject { readonly attribute HumanActivityMonitorManager humanactivitymonitor; }; [NoInterfaceObject] interface HumanActivityMonitorManager { void getHumanActivityData(HumanActivityType type, HumanActivityMonitorSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void start(HumanActivityType type, optional HumanActivityMonitorSuccessCallback? changedCallback, optional ErrorCallback? errorCallback, optional HumanActivityMonitorOption? option) raises(WebAPIException); void stop(HumanActivityType type) raises(WebAPIException); void setAccumulativePedometerListener(HumanActivityMonitorSuccessCallback changeCallback) raises(WebAPIException); void unsetAccumulativePedometerListener() raises(WebAPIException); long addActivityRecognitionListener(ActivityRecognitionType type, HumanActivityMonitorSuccessCallback listener, optional ErrorCallback? errorCallback) raises(WebAPIException); void removeActivityRecognitionListener(long listenerId, optional ErrorCallback? errorCallback); void startRecorder(HumanActivityRecorderType type, optional HumanActivityRecorderOption option) raises(WebAPIException); void stopRecorder(HumanActivityRecorderType type) raises(WebAPIException); void readRecorderData(HumanActivityRecorderType type, HumanActivityRecorderQuery? query, HumanActivityReadRecorderSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); boolean isGestureSupported(GestureType type) raises(WebAPIException); long addGestureRecognitionListener(GestureType type, GestureRecognitionCallback listener, optional ErrorCallback? errorCallback, optional boolean? alwaysOn) raises(WebAPIException); void removeGestureRecognitionListener(long watchId) raises(WebAPIException); long addStressMonitorChangeListener(StressMonitorDataRange[] ranges, StressMonitorCallback listener) raises(WebAPIException); void removeStressMonitorChangeListener(long watchId) raises(WebAPIException); }; [NoInterfaceObject] interface StepDifference { readonly attribute long stepCountDifference; readonly attribute long timestamp; }; [NoInterfaceObject] interface HumanActivityData { }; [NoInterfaceObject] interface HumanActivityPedometerData : HumanActivityData { readonly attribute PedometerStepStatus stepStatus; readonly attribute double speed; readonly attribute double walkingFrequency; readonly attribute double cumulativeDistance; readonly attribute double cumulativeCalorie; readonly attribute double cumulativeTotalStepCount; readonly attribute double cumulativeWalkStepCount; readonly attribute double cumulativeRunStepCount; readonly attribute StepDifference[] stepCountDifferences; }; [NoInterfaceObject] interface HumanActivityAccumulativePedometerData : HumanActivityData { readonly attribute PedometerStepStatus stepStatus; readonly attribute double speed; readonly attribute double walkingFrequency; readonly attribute double accumulativeDistance; readonly attribute double accumulativeCalorie; readonly attribute double accumulativeTotalStepCount; readonly attribute double accumulativeWalkStepCount; readonly attribute double accumulativeRunStepCount; readonly attribute StepDifference[] stepCountDifferences; }; [NoInterfaceObject] interface HumanActivityHRMData : HumanActivityData { readonly attribute long heartRate; readonly attribute long rRInterval; }; [NoInterfaceObject] interface HumanActivityGPSInfo { readonly attribute double latitude; readonly attribute double longitude; readonly attribute double altitude; readonly attribute double speed; readonly attribute long errorRange; readonly attribute long timestamp; }; [NoInterfaceObject] interface HumanActivityGPSInfoArray : HumanActivityData { readonly attribute HumanActivityGPSInfo[] gpsInfo; }; [NoInterfaceObject] interface HumanActivitySleepMonitorData : HumanActivityData { readonly attribute SleepStatus status; readonly attribute long long timestamp; }; [NoInterfaceObject] interface HumanActivitySleepDetectorData : HumanActivityData { readonly attribute SleepStatus status; }; [NoInterfaceObject] interface HumanActivityStressMonitorData : HumanActivityData { readonly attribute long stressScore; }; [NoInterfaceObject] interface HumanActivityRecognitionData : HumanActivityData { readonly attribute ActivityRecognitionType type; readonly attribute long timestamp; readonly attribute ActivityAccuracy accuracy; }; [NoInterfaceObject] interface HumanActivityRecorderData { readonly attribute long startTime; readonly attribute long endTime; }; [NoInterfaceObject] interface HumanActivityRecorderPedometerData : HumanActivityRecorderData { readonly attribute double distance; readonly attribute double calorie; readonly attribute double totalStepCount; readonly attribute double walkStepCount; readonly attribute double runStepCount; }; [NoInterfaceObject] interface HumanActivityRecorderHRMData : HumanActivityRecorderData { readonly attribute long heartRate; }; [NoInterfaceObject] interface HumanActivityRecorderSleepMonitorData : HumanActivityRecorderData { readonly attribute SleepStatus status; }; [NoInterfaceObject] interface HumanActivityRecorderPressureData : HumanActivityRecorderData { readonly attribute double? max; readonly attribute double? min; readonly attribute double? average; }; [NoInterfaceObject] interface GestureData { readonly attribute GestureType type; readonly attribute GestureEvent event; readonly attribute long timestamp; readonly attribute double? x; readonly attribute double? y; }; [Constructor(optional DOMString label, optional unsigned long min, optional unsigned long max)] interface StressMonitorDataRange { attribute DOMString label; attribute unsigned long min; attribute unsigned long max; }; [Callback=FunctionOnly, NoInterfaceObject] interface HumanActivityMonitorSuccessCallback { void onsuccess(optional HumanActivityData? humanactivitydata); }; [Callback=FunctionOnly, NoInterfaceObject] interface HumanActivityReadRecorderSuccessCallback { void onsuccess(HumanActivityRecorderData[] humanactivitydata); }; [Callback=FunctionOnly, NoInterfaceObject] interface GestureRecognitionCallback { void onsuccess(GestureData data); }; [Callback=FunctionOnly, NoInterfaceObject] interface StressMonitorCallback { void onsuccess(DOMString label); }; };