From 68e560d47ee1a0cd61b2ee4c4d5e7609a8eec76e Mon Sep 17 00:00:00 2001 From: Jakub Skowron Date: Wed, 27 Apr 2016 12:03:49 +0200 Subject: [PATCH] [HAM] Widl updated, additional description for GPS batch feature Change-Id: Iaa51fcec393e18b482e6e450337ebe3608daad6a Signed-off-by: Piotr Kosko Signed-off-by: Jakub Skowron --- org.tizen.guides/html/web/tizen/system/ham_w.htm | 18 ++++---- .../html/web/tizen/system/ham_tutorial_w.htm | 49 ++++++++++++---------- .../mobile/tizen/humanactivitymonitor.html | 41 +++++++++++++++++- .../wearable/tizen/humanactivitymonitor.html | 26 +++++++++++- 4 files changed, 102 insertions(+), 32 deletions(-) diff --git a/org.tizen.guides/html/web/tizen/system/ham_w.htm b/org.tizen.guides/html/web/tizen/system/ham_w.htm index cd3a652..932e333 100644 --- a/org.tizen.guides/html/web/tizen/system/ham_w.htm +++ b/org.tizen.guides/html/web/tizen/system/ham_w.htm @@ -22,9 +22,9 @@ @@ -34,18 +34,22 @@

Tizen enables you to access the human activity data from various sensors on the device.

-

The Human Activity Monitor API is optional for both Tizen mobile and wearable profiles, which means that it may not be supported in all mobile and wearable devices. The Human Activity Monitor API is partly supported on the Tizen Emulators (only heart-rate monitoring).

- +

The Human Activity Monitor API is optional for both Tizen mobile and wearable profiles, which means that it may not be supported in all mobile and wearable devices. The Human Activity Monitor API is partly supported on the Tizen Emulators (only heart-rate monitoring).

+

The main features of the Human Activity Monitor API include:

The supported monitor types and their capabilities are listed in the following table.

- +
@@ -82,7 +86,7 @@
Table: Human activity monitors and capabilities

When the pedometer, HRM, GPS and sleep monitor sensors are started, a change callback is invoked when data changes. Use the getHumanActivityData() method to get current data.

-

The GPS sensor provides both the current value and a short history of last recorded GPS positions.

+

The GPS sensor provides both the current value and a short history of last recorded GPS positions. GPS sensor supports sampling intervals, which could be used to create more power efficient applications.

The accumulative pedometer sensor does not have to be started by your application as long as step counting is enabled by any other application or the system. Listener registered with the setAccumulativePedometerListener() method is called when accumulative counters are changed.

The wrist up sensor is notified when the relevant gesture is performed. The sensor must be enabled using the start() method. An event listener invoked when the gesture is detected. This sensor does not provide any data.

diff --git a/org.tizen.tutorials/html/web/tizen/system/ham_tutorial_w.htm b/org.tizen.tutorials/html/web/tizen/system/ham_tutorial_w.htm index 9ef10d2..815f87a 100644 --- a/org.tizen.tutorials/html/web/tizen/system/ham_tutorial_w.htm +++ b/org.tizen.tutorials/html/web/tizen/system/ham_tutorial_w.htm @@ -20,9 +20,10 @@

Mobile Web Wearable Web

@@ -43,13 +44,14 @@

This tutorial demonstrates how you can monitor user activity.

-

The Human Activity Monitor API is optional for both Tizen mobile and wearable profiles, which means that it may not be supported in all mobile and wearable devices. The Human Activity Monitor API is partly supported on the Tizen Emulators (only heart-rate monitoring).

+

The Human Activity Monitor API is optional for both Tizen mobile and wearable profiles, which means that it may not be supported in all mobile and wearable devices. The Human Activity Monitor API is partly supported on the Tizen Emulators (only heart-rate monitoring).

Warm-up

Become familiar with the Human Activity Monitor API basics by learning about:

  • Retrieving Data

    Start the data collection and get monitor data.

  • +
  • Using user-defined intervals

    Define intervals for building more power efficient applications.

  • Receiving Notifications on Pedometer Data Changes

    Track the changes in the step count.

  • Activity Recognition

    Recognizes activity and its accurance.

  • Sleep monitor

    Detects whether or not user is asleep.

  • @@ -94,7 +96,28 @@ tizen.humanactivitymonitor.start("HRM", onchangedCB); tizen.humanactivitymonitor.start("WRIST_UP", onchangedCB) -

    If a human activity type allows setting the interval at which data is sent to the application or setting the sampling interval, the last parameter of the start() method, option, can be used to specify this information:

    +
  • When the a heart-rate monitor (HRM) is enabled, you can get the current data using the getHumanActivityData() method of the HumanActivityMonitorManager interface: +
    function onsuccessCB(hrmInfo)
    +{
    +   console.log("Heart rate: " + hrmInfo.heartRate);
    +}
    +function onerrorCB(error)
    +{
    +   console.log("Error occurred: " + error.message);
    +}
    +tizen.humanactivitymonitor.getHumanActivityData("HRM", onsuccessCB, onerrorCB);
    +
  • + +
  • To disable HAM when it is no longer required, use the stop() method of the HumanActivityMonitorManager interface: +
    tizen.humanactivitymonitor.stop("HRM");
    +
  • + + +

    Using user-defined intervals

    + +

    Human Activity API allows user to choose own intervals for collecting samples in specified range. +Such functionality could be used to build more power efficient applications, which collects data (less often device gathers data -> less energy is used). Developer could change interval according to state of device, e.g. when display is turned off, then sampling interval could be less. +If a human activity type allows setting the interval at which data is sent to the application or setting the sampling interval, the last parameter of the start() method, option, can be used to specify this information:

    var myCallbackInterval = 240000;
     var mySampleInterval = 10000;
    @@ -111,23 +134,7 @@ var option = {"callbackInterval": myCallbackInterval,
     tizen.humanactivitymonitor.start("GPS", onchangedCB, option);
    -
  • When the a heart-rate monitor (HRM) is enabled, you can get the current data using the getHumanActivityData() method of the HumanActivityMonitorManager interface: -
    function onsuccessCB(hrmInfo)
    -{
    -   console.log("Heart rate: " + hrmInfo.heartRate);
    -}
    -function onerrorCB(error)
    -{
    -   console.log("Error occurred: " + error.message);
    -}
    -tizen.humanactivitymonitor.getHumanActivityData("HRM", onsuccessCB, onerrorCB);
    -
  • -
  • To disable HAM when it is no longer required, use the stop() method of the HumanActivityMonitorManager interface: -
    tizen.humanactivitymonitor.stop("HRM");
    -
  • - -

    Receiving Notifications on Pedometer Data Changes

    Learning how to register a listener for accumulative allows you to monitor the step count maintained by the system without enabling the Pedometer sensor and the PEDOMETER monitor:

    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/humanactivitymonitor.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/humanactivitymonitor.html index 7f9e203..1542851 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/humanactivitymonitor.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/humanactivitymonitor.html @@ -389,6 +389,9 @@ The ErrorCallback method is launched with these error types: That means that both 'http://tizen.org/privilege/healthinfo' and 'http://tizen.org/privilege/location' should be declared in the config.xml file for the GPS type. For other types, only 'http://tizen.org/privilege/healthinfo' should be declared.

    +

    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:

      @@ -443,6 +446,12 @@ For other types, only 'http://tizen.org/privilege/healthinfo' should be d 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 @@ -531,6 +540,11 @@ For other types, only 'http://tizen.org/privilege/healthinfo' should be d tizen.humanactivitymonitor.start("PEDOMETER", onchangedCB); +
    +

    Output example:

     Step status : WALKING
    + Cumulative total step count : 100
    + 
    +

    Code example:

     function onchangedCB(info) {
          var gpsInfo = info.gpsInfo;
    @@ -678,6 +692,11 @@ Note that the setAccumulativePedometerListener() method does not need to call th
      tizen.humanactivitymonitor.setAccumulativePedometerListener(onchangedCB);
      
    +
    +

    Output example:

     Step status : WALKING
    + Accumulative total step count : 100
    + 
    +
    unsetAccumulativePedometerListener @@ -790,6 +809,12 @@ The ErrorCallback method is launched with this error type: } +
    +

    Output example:

     type: WALKING
    + timestamp: 1456735296123
    + accuracy: MEDIUM
    + 
    +
    removeActivityRecognitionListener @@ -848,6 +873,12 @@ The ErrorCallback method is launched with this error type: } +
    +

    Output example:

     type: WALKING
    + timestamp: 1456735296123
    + accuracy: MEDIUM
    + 
    +
    @@ -1345,7 +1376,10 @@ When a user takes off the watch device, the heartRate is set to -3. When a user 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

      @@ -1399,6 +1433,9 @@ When a user takes off the watch device, the heartRate is set to -3. When a user Since: 3.0

      +

      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
      @@ -1570,7 +1607,7 @@ To guarantee that the human sleep state tracking application runs on a device wi
    • http://tizen.org/feature/sensor.sleep_monitor

    - For more information, see Application Filtering. + For more information, see Application Filtering.

    4. Full WebIDL

    module HumanActivityMonitor {
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/humanactivitymonitor.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/humanactivitymonitor.html
    index b925f44..7b4801b 100644
    --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/humanactivitymonitor.html
    +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/humanactivitymonitor.html
    @@ -23,7 +23,7 @@ Set up callbacks for data change notification          
     Get current human activity monitor data          
             

-For more information about how to use Human Activity Monitor API, see Human Activity Monitor Guide. +For more information about how to use Human Activity Monitor API, see HumanActivityMonitor Guide.

@@ -391,6 +391,9 @@ In other types, only 'http://tizen.org/privilege/healthinfo' should be de

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.

+

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:

    @@ -445,6 +448,12 @@ In other types, only 'http://tizen.org/privilege/healthinfo' should be de 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 @@ -533,6 +542,11 @@ In other types, only 'http://tizen.org/privilege/healthinfo' should be de tizen.humanactivitymonitor.start("PEDOMETER", onchangedCB); +
+

Output example:

 Step status : WALKING
+ Cumulative total step count : 100
+ 
+

Code example:

 function onchangedCB(info) {
      var gpsInfo = info.gpsInfo;
@@ -680,6 +694,11 @@ Note that the setAccumulativePedometerListener() method does not need to call th
  tizen.humanactivitymonitor.setAccumulativePedometerListener(onchangedCB);
  
+
+

Output example:

 Step status : WALKING
+ Accumulative total step count : 100
+ 
+
unsetAccumulativePedometerListener @@ -1359,6 +1378,9 @@ When a user takes off the watch device, the heartRate is set to -3. When a user 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

@@ -1586,7 +1608,7 @@ To guarantee that the human sleep state tracking application runs on a device wi
  • http://tizen.org/feature/sensor.sleep_monitor
  • - For more information, see Application Filtering. + For more information, see Application Filtering.

    4. Full WebIDL

    module HumanActivityMonitor {
    -- 
    2.7.4