From 699d31b3224a8972fa57f51b8bc78e2ed8526e08 Mon Sep 17 00:00:00 2001 From: Jakub Skowron Date: Wed, 27 Apr 2016 12:11:22 +0200 Subject: [PATCH] [HAM] Added documentation for sleep monitor. Change-Id: I04c50ac29aab6d23c7a6e303d3c440d77993d4b8 Signed-off-by: Pawel Andruszkiewicz Signed-off-by: Jakub Skowron --- org.tizen.guides/html/web/tizen/system/ham_w.htm | 6 +- .../html/web/tizen/system/ham_tutorial_w.htm | 38 +++++ .../mobile/tizen/humanactivitymonitor.html | 154 ++++++++++++++++++--- .../wearable/tizen/humanactivitymonitor.html | 124 +++++++++++++++-- 4 files changed, 293 insertions(+), 29 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 9d3c8dc..cd3a652 100644 --- a/org.tizen.guides/html/web/tizen/system/ham_w.htm +++ b/org.tizen.guides/html/web/tizen/system/ham_w.htm @@ -71,13 +71,17 @@

http://tizen.org/feature/location.batch

+ Sleep monitor +

http://tizen.org/feature/sensor.sleep_monitor

+ + Activity Recognition

http://tizen.org/feature/sensor.activity_recognition

-

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

+

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 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 bab81c3..9ef10d2 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 @@ -25,6 +25,7 @@
  • Retrieving Data
  • Receiving Notifications on Pedometer Data Changes
  • Activity Recognition
  • +
  • Sleep Monitor
  • Related Info

    Prerequisites

    @@ -202,7 +204,43 @@ try { +

    Sleep monitor

    +

    This tutorial shows how to use the monitor which detects whether or not user is asleep:

    +
      +
    1. To enable the monitor and start collecting data, use the start() method of the HumanActivityMonitorManager interface (in mobile and wearable applications): +
      +function onchangedCB(sleepInfo)
      +{
      +   console.log("Sleep status: " + sleepInfo.status);
      +   console.log("Timestamp: " + sleepInfo.timestamp + " milliseconds");
      +}
      +
      +tizen.humanactivitymonitor.start("SLEEP_MONITOR", onchangedCB);
      +
      +
    2. +
    3. When the sleep monitor is enabled, you can get the current data using the getHumanActivityData() method of the HumanActivityMonitorManager interface: +
      +function onsuccessCB(sleepInfo)
      +{
      +   console.log("Sleep status: " + sleepInfo.status);
      +   console.log("Timestamp: " + sleepInfo.timestamp + " milliseconds");
      +}
      +
      +function onerrorCB(error)
      +{
      +   console.log("Error occurred: " + error.message);
      +}
      +
      +tizen.humanactivitymonitor.getHumanActivityData("SLEEP_MONITOR", onsuccessCB, onerrorCB);
      +
      +
    4. +
    5. To disable the monitor when it is no longer required, use the stop() method of the HumanActivityMonitorManager interface: +
      +tizen.humanactivitymonitor.stop("SLEEP_MONITOR");
      +
      +
    6. +
    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 d12fb5f..7f9e203 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 @@ -33,13 +33,20 @@ For more information about how to use Human Activity Monitor API, see
  • 1. Type Definitions
  • @@ -62,11 +69,13 @@ For more information about how to use Human Activity Monitor API, see HumanActivityGPSInfoArray -
  • 2.10. HumanActivityMonitorOption +
  • 2.10. HumanActivitySleepMonitorData +
  • +
  • 2.11. HumanActivityMonitorOption
  • -
  • 2.11. HumanActivityRecognitionData +
  • 2.12. HumanActivityRecognitionData
  • -
  • 2.12. HumanActivityMonitorSuccessCallback +
  • 2.13. HumanActivityMonitorSuccessCallback
  • @@ -89,13 +98,15 @@ For more information about how to use Human Activity Monitor API, see HumanActivityMonitorManager -void getHumanActivityData (HumanActivityType type, HumanActivityMonitorSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    - void start (HumanActivityType type, optional HumanActivityMonitorSuccessCallback? changedCallback, optional HumanActivityMonitorOption? option)
    - void stop (HumanActivityType type)
    - void setAccumulativePedometerListener (HumanActivityMonitorSuccessCallback changeCallback)
    - void unsetAccumulativePedometerListener ()
    - long addActivityRecognitionListener (ActivityRecognitionType type, HumanActivityMonitorSuccessCallback listener, optional ErrorCallback? errorCallback)
    - void removeActivityRecognitionListener (long listenerId, optional ErrorCallback? errorCallback) + +
    void getHumanActivityData (HumanActivityType type, HumanActivityMonitorSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    +
    void start (HumanActivityType type, optional HumanActivityMonitorSuccessCallback? changedCallback, optional HumanActivityMonitorOption? option)
    +
    void stop (HumanActivityType type)
    +
    void setAccumulativePedometerListener (HumanActivityMonitorSuccessCallback changeCallback)
    +
    void unsetAccumulativePedometerListener ()
    +
    long addActivityRecognitionListener (ActivityRecognitionType type, HumanActivityMonitorSuccessCallback listener, optional ErrorCallback? errorCallback)
    +
    void removeActivityRecognitionListener (long listenerId, optional ErrorCallback? errorCallback)
    + StepDifference @@ -126,6 +137,10 @@ For more information about how to use Human Activity Monitor API, see HumanActivitySleepMonitorData + + + HumanActivityMonitorOption @@ -135,7 +150,7 @@ For more information about how to use Human Activity Monitor API, see HumanActivityMonitorSuccessCallback -void onsuccess (optional HumanActivityData? humanactivitydata) +
    void onsuccess (optional HumanActivityData? humanactivitydata)
    @@ -146,7 +161,7 @@ For more information about how to use Human Activity Monitor API, see Specifies the supported human activity monitor types. -
        enum HumanActivityType { "PEDOMETER", "WRIST_UP", "HRM", "GPS" };
    +
        enum HumanActivityType { "PEDOMETER", "WRIST_UP", "HRM", "GPS", "SLEEP_MONITOR" };

    Since: 2.3 @@ -164,8 +179,13 @@ 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)
  • +

    Remark : + SLEEP_MONITOR is supported since Tizen 3.0 +

    1.2. PedometerStepStatus

    @@ -238,6 +258,41 @@ HIGH - High accuracy
    +
    +

    1.5. SleepStatus

    +
    + Specifies the sleep monitor user's sleep status. +
    +
        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
    + 
    +
    +

    2. Interfaces

    @@ -1275,8 +1330,50 @@ When a user takes off the watch device, the heartRate is set to -3. When a user
    +
    +

    2.10. HumanActivitySleepMonitorData

    +
    + The HumanActivitySleepMonitorData interface represents sleep monitor data. +
    +
        [NoInterfaceObject] interface HumanActivitySleepMonitorData : HumanActivityData {
    +
    +        readonly attribute SleepStatus status;
    +
    +        readonly attribute long timestamp;
    +    };
    +

    + Since: + 3.0 +

    + +
    +

    Attributes

    +
      +
    • + readonly +SleepStatus status
      + The sleep status. +
      +

      + Since: + 3.0 +

      +
    • +
    • + readonly +long timestamp
      + The time when the sleep status is recognized. Epoch time in milliseconds. +
      +

      + Since: + 3.0 +

      +
    • +
    +
    +
    -

    2.10. HumanActivityMonitorOption

    +

    2.11. HumanActivityMonitorOption

    The HumanActivityMonitorOption dictionary contains options, such as the callbackInterval and the sampleInterval, to use with start().
    @@ -1317,7 +1414,7 @@ When a user takes off the watch device, the heartRate is set to -3. When a user
    -

    2.11. HumanActivityRecognitionData

    +

    2.12. HumanActivityRecognitionData

    The HumanActivityRecognitionData interface represents a activity recognition data.
    @@ -1371,7 +1468,7 @@ When a user takes off the watch device, the heartRate is set to -3. When a user
    -

    2.12. HumanActivityMonitorSuccessCallback

    +

    2.13. HumanActivityMonitorSuccessCallback

    The HumanActivityMonitorSuccessCallback interface is a callback interface that is invoked when new human activity data is available.
    @@ -1464,13 +1561,21 @@ To guarantee that the activity information tracking application runs on a device

  • http://tizen.org/feature/sensor.activity_recognition
  • +
    +

    +

    +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: +

    +

    +
  • http://tizen.org/feature/sensor.sleep_monitor
  • +

    For more information, see Application Filtering.

    4. Full WebIDL

    module HumanActivityMonitor {
     
    -    enum HumanActivityType { "PEDOMETER", "WRIST_UP", "HRM", "GPS" };
    +    enum HumanActivityType { "PEDOMETER", "WRIST_UP", "HRM", "GPS", "SLEEP_MONITOR" };
     
         enum PedometerStepStatus { "NOT_MOVING", "WALKING", "RUNNING" };
     
    @@ -1478,6 +1583,8 @@ To guarantee that the activity information tracking application runs on a device
     
         enum ActivityAccuracy { "LOW", "MEDIUM", "HIGH" };
     
    +    enum SleepStatus { "ASLEEP", "AWAKE", "UNKNOWN" };
    +
         [NoInterfaceObject] interface HumanActivityMonitorManagerObject {
             readonly attribute HumanActivityMonitorManager humanactivitymonitor;
         };
    @@ -1580,6 +1687,13 @@ To guarantee that the activity information tracking application runs on a device
             readonly attribute HumanActivityGPSInfo[] gpsInfo;
         };
     
    +    [NoInterfaceObject] interface HumanActivitySleepMonitorData : HumanActivityData {
    +
    +        readonly attribute SleepStatus status;
    +
    +        readonly attribute long timestamp;
    +    };
    +
         dictionary HumanActivityMonitorOption {
     
             long? callbackInterval = null;
    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 4ac09c4..b925f44 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
    @@ -45,6 +45,9 @@ For more information about how to use Human Activity Monitor API, see ActivityAccuracy
     
    +
  • + 1.5. SleepStatus +
  • 2. Interfaces
  • @@ -132,6 +137,10 @@ For more information about how to use Human Activity Monitor API, see HumanActivitySleepMonitorData + + + HumanActivityMonitorOption @@ -152,7 +161,7 @@ For more information about how to use Human Activity Monitor API, see Specifies the supported human activity monitor types. -
        enum HumanActivityType { "PEDOMETER", "WRIST_UP", "HRM", "GPS" };
    +
        enum HumanActivityType { "PEDOMETER", "WRIST_UP", "HRM", "GPS", "SLEEP_MONITOR" };

    Since: 2.3 @@ -170,8 +179,13 @@ 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)
  • +

    Remark : + SLEEP_MONITOR is supported since Tizen 3.0 +

    1.2. PedometerStepStatus

    @@ -244,6 +258,41 @@ HIGH - High accuracy
    +
    +

    1.5. SleepStatus

    +
    + Specifies the sleep monitor user's sleep status. +
    +
        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
    + 
    +
    +

    2. Interfaces

    @@ -1295,8 +1344,50 @@ When a user takes off the watch device, the heartRate is set to -3. When a user
    +
    +

    2.10. HumanActivitySleepMonitorData

    +
    + The HumanActivitySleepMonitorData interface represents sleep monitor data. +
    +
        [NoInterfaceObject] interface HumanActivitySleepMonitorData : HumanActivityData {
    +
    +        readonly attribute SleepStatus status;
    +
    +        readonly attribute long timestamp;
    +    };
    +

    + Since: + 3.0 +

    + +
    +

    Attributes

    +
      +
    • + readonly +SleepStatus status
      + The sleep status. +
      +

      + Since: + 3.0 +

      +
    • +
    • + readonly +long timestamp
      + The time when the sleep status is recognized. Epoch time in milliseconds. +
      +

      + Since: + 3.0 +

      +
    • +
    +
    +
    -

    2.10. HumanActivityMonitorOption

    +

    2.11. HumanActivityMonitorOption

    The HumanActivityMonitorOption dictionary contains options, such as the callbackInterval and the sampleInterval, to use with start().
    @@ -1340,7 +1431,7 @@ When a user takes off the watch device, the heartRate is set to -3. When a user
    -

    2.11. HumanActivityRecognitionData

    +

    2.12. HumanActivityRecognitionData

    The HumanActivityRecognitionData interface represents a activity recognition data.
    @@ -1394,7 +1485,7 @@ When a user takes off the watch device, the heartRate is set to -3. When a user
    -

    2.12. HumanActivityMonitorSuccessCallback

    +

    2.13. HumanActivityMonitorSuccessCallback

    The HumanActivityMonitorSuccessCallback interface is a callback interface that is invoked when new human activity data is available.
    @@ -1486,13 +1577,21 @@ To guarantee that the activity information tracking application runs on a device

  • http://tizen.org/feature/sensor.activity_recognition
  • +
    +

    +

    +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: +

    +

    +
  • http://tizen.org/feature/sensor.sleep_monitor
  • +

    For more information, see Application Filtering.

    4. Full WebIDL

    module HumanActivityMonitor {
     
    -    enum HumanActivityType { "PEDOMETER", "WRIST_UP", "HRM", "GPS" };
    +    enum HumanActivityType { "PEDOMETER", "WRIST_UP", "HRM", "GPS", "SLEEP_MONITOR" };
     
         enum PedometerStepStatus { "NOT_MOVING", "WALKING", "RUNNING" };
     
    @@ -1500,6 +1599,8 @@ To guarantee that the activity information tracking application runs on a device
     
         enum ActivityAccuracy { "LOW", "MEDIUM", "HIGH" };
     
    +    enum SleepStatus { "ASLEEP", "AWAKE", "UNKNOWN" };
    +
         [NoInterfaceObject] interface HumanActivityMonitorManagerObject {
             readonly attribute HumanActivityMonitorManager humanactivitymonitor;
         };
    @@ -1601,6 +1702,13 @@ To guarantee that the activity information tracking application runs on a device
             readonly attribute HumanActivityGPSInfo[] gpsInfo;
         };
     
    +    [NoInterfaceObject] interface HumanActivitySleepMonitorData : HumanActivityData {
    +
    +        readonly attribute SleepStatus status;
    +
    +        readonly attribute long timestamp;
    +    };
    +
         dictionary HumanActivityMonitorOption {
     
             long? callbackInterval = null;
    -- 
    2.7.4