From d28347fd0c13cbcc24a4ff06689a3b53808e83bb Mon Sep 17 00:00:00 2001 From: "taekeun.kang" Date: Wed, 2 Mar 2016 10:01:10 +0900 Subject: [PATCH] [WebDeviceAPI] update guide, tutorial and reference for HAM, Sensor Change-Id: I2a783650cd5c8765206b56c987147590ff70ab30 Signed-off-by: taekeun.kang --- .../html/web/tizen/system/ham_tutorial_w.htm | 16 +++++++++++++ .../html/web/tizen/system/sensor_tutorial_w.htm | 20 ++++++++-------- .../mobile/tizen/humanactivitymonitor.html | 28 +++++++++++----------- .../html/device_api/mobile/tizen/sensor.html | 2 +- .../wearable/tizen/humanactivitymonitor.html | 28 +++++++++++----------- .../html/device_api/wearable/tizen/sensor.html | 2 +- 6 files changed, 56 insertions(+), 40 deletions(-) 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 fa390eb..84ca19e 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 @@ -86,6 +86,22 @@ 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:

+ +
var myCallbackInterval = 240000;
+var mySampleInterval = 10000;
+
+function onchangedCB(gpsInfo)
+{
+   console.log("this callback will be called every " + myCallbackInterval + " milliseconds");
+   console.log("the gpsInfo will include the information of the GPS that is collected every " + mySampleInterval + " millisenconds");
+}
+
+var option = {"callbackInterval": myCallbackInterval,
+              "sampleInterval": mySampleInterval};
+};
+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: diff --git a/org.tizen.tutorials/html/web/tizen/system/sensor_tutorial_w.htm b/org.tizen.tutorials/html/web/tizen/system/sensor_tutorial_w.htm index fb3ae96..a1606b5 100644 --- a/org.tizen.tutorials/html/web/tizen/system/sensor_tutorial_w.htm +++ b/org.tizen.tutorials/html/web/tizen/system/sensor_tutorial_w.htm @@ -123,28 +123,28 @@ lightSensor.start(onsuccessCB);
  • Define an event handler for sensor data changes by implementing the SensorDataSuccessCallback interface (in mobile and wearable applications):
    function onchangedCB(sensorData)
     {
    -   console.log("value of pressure is: " + sensorData.pressure);
    +   console.log("Light sensor data: " + sensorData.lightLevel);
     }
     
  • Register a change listener to be called when the sensor data changes. -

    To register a change listener, use the setChangeListener() method of the Sensor interface (in mobile and wearable applications).

    +

    To register a change listener, use the setChangeListener() method of the Sensor interface (in mobile and wearable applications).

    This command requires two parameters. The first one is a handle to the callback method, which will be invoked for every incoming event. The second argument determines the amount of time (in milliseconds) passing between two consecutive events. Valid values are integers in range <10, 1000> inclusively. For example, setting an interval to 100 results in approximately 10 events being send every second.

    -
    var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
    +
    var lightSensor = tizen.sensorservice.getDefaultSensor("LIGHT");
     
     function onsuccessCB()
     {
    -   console.log("proximity sensor start");
    +   console.log("Light sensor service has started successfully.");
     }
     
     function onchangedCB(sensorData)
     {
    -   console.log("proximity distance: " + sensorData.proximityState);
    +   console.log("Light sensor data: " + sensorData.lightLevel);
     }
     
    -proximitySensor.setChangeListener(onchangedCB, 500);
    -proximitySensor.start(onsuccessCB);
    +lightSensor.setChangeListener(onchangedCB, 500); +lightSensor.start(onsuccessCB);
    The default value of interval parameter is 100. If you do not pass an interval value, a default one will be used:
    var lightSensor = tizen.sensorservice.getDefaultSensor("LIGHT");
     
    @@ -159,15 +159,15 @@ function onchangedCB(sensorData)
     }
     
     // use the default interval value (100 ms):
    -proximitySensor.setChangeListener(onchangedCB);
    +lightSensor.setChangeListener(onchangedCB);
     
    -proximitySensor.start(onsuccessCB);
    +lightSensor.start(onsuccessCB);
  • To stop receiving notifications on sensor data changes, use the unsetChangeListener() method of the Sensor interface. -
    proximitySensor.unsetChangeListener();
    +
    lightSensor.unsetChangeListener();
  • 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 dea0ebf..02c1019 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 @@ -196,7 +196,7 @@ RUNNING - The user is running
        enum ActivityRecognitionType { "STATIONARY", "WALKING", "RUNNING", "IN_VEHICLE" };

    Since: - 2.3.2 + 3.0

    @@ -222,7 +222,7 @@ IN_VEHICLE - The in-vehicle activity recognition type

        enum ActivityAccuracy { "LOW", "MEDIUM", "HIGH" };

    Since: - 2.3.2 + 3.0

    @@ -427,7 +427,7 @@ That means that both 'http://tizen.org/privilege/healthinfo' and 'http For other types, only 'http://tizen.org/privilege/healthinfo' should be declared.

    Remark : - option is supported since Tizen 2.3.2 + option is supported since Tizen 3.0

    Parameters:

    @@ -442,7 +442,7 @@ For other types, only 'http://tizen.org/privilege/healthinfo' should be d
  • option [optional] [nullable]: - The option to set the period and the interval for several human activity types since Tizen 2.3.2
    By default, this parameter is set to null. + The option to set the period and the interval for several human activity types since Tizen 3.0
    By default, this parameter is set to null.
  • @@ -673,7 +673,7 @@ Note that the setAccumulativePedometerListener() method does not need to call th

    Since: - 2.3.2 + 3.0

    @@ -747,7 +747,7 @@ The ErrorCallback method is launched with this error type:

    Since: - 2.3.2 + 3.0

    @@ -1288,7 +1288,7 @@ When a user takes off the watch device, the heartRate is set to -3. When a user };

    Since: - 2.3.2 + 3.0

    Dictionary members

    @@ -1296,11 +1296,11 @@ When a user takes off the watch device, the heartRate is set to -3. When a user
    long? callbackInterval
    - The callbackInterval in milliseconds (ms) at which human activity data will be sent to the Web Application since Tizen 2.3.2
    For the GPS type, callbackInterval can be between 120000ms and 600000ms inclusive, however, if it is null or zero, it is set by the default value of 120000ms.
    For the HRM type, callbackInterval can be between 10ms and 1000ms inclusive, however, if it is null or zero, it is set set by the default value of 100ms.
    For other activity types, callbackInterval will be ignored. + The callbackInterval in milliseconds (ms) at which human activity data will be sent to the Web Application since Tizen 3.0
    For the GPS type, callbackInterval can be between 120000ms and 600000ms inclusive, however, if it is null or zero, it is set by the default value of 120000ms.
    For the HRM type, callbackInterval can be between 10ms and 1000ms inclusive, however, if it is null or zero, it is set set by the default value of 100ms.
    For other activity types, callbackInterval will be ignored.

    Since: - 2.3.2 + 3.0

    long? sampleInterval
    @@ -1310,7 +1310,7 @@ When a user takes off the watch device, the heartRate is set to -3. When a user

    Since: - 2.3.2 + 3.0

    @@ -1331,7 +1331,7 @@ When a user takes off the watch device, the heartRate is set to -3. When a user };

    Since: - 2.3.2 + 3.0

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

    Since: - 2.3.2 + 3.0

  • @@ -1354,7 +1354,7 @@ When a user takes off the watch device, the heartRate is set to -3. When a user
  • Since: - 2.3.2 + 3.0

  • @@ -1364,7 +1364,7 @@ When a user takes off the watch device, the heartRate is set to -3. When a user
  • Since: - 2.3.2 + 3.0

    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/sensor.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/sensor.html index 942d751..d0d7fcd 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/sensor.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/sensor.html @@ -532,7 +532,7 @@ Note that the setChangeListener() method only registers the listener. The start() method must be called to turn on the sensor, or the sensor data will not change.

    -

    Remark: interval is supported since Tizen 2.3.2

    +

    Remark: interval is supported since Tizen 3.0

    Parameters:

      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 7423831..71b6c3e 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 @@ -196,7 +196,7 @@ RUNNING - The user is running
          enum ActivityRecognitionType { "STATIONARY", "WALKING", "RUNNING", "IN_VEHICLE" };

      Since: - 2.3.2 + 3.0

      @@ -222,7 +222,7 @@ IN_VEHICLE - The in-vehicle activity recognition type

          enum ActivityAccuracy { "LOW", "MEDIUM", "HIGH" };

      Since: - 2.3.2 + 3.0

      @@ -427,7 +427,7 @@ That means that both 'http://tizen.org/privilege/healthinfo' and 'http For other types, only 'http://tizen.org/privilege/healthinfo' should be declared.

      Remark : - option is supported since Tizen 2.3.2 + option is supported since Tizen 3.0

      Parameters:

      @@ -442,7 +442,7 @@ For other types, only 'http://tizen.org/privilege/healthinfo' should be d
    • option [optional] [nullable]: - The option to set the period and the interval for several human activity types since Tizen 2.3.2
      By default, this parameter is set to null. + The option to set the period and the interval for several human activity types since Tizen 3.0
      By default, this parameter is set to null.
    @@ -673,7 +673,7 @@ Note that the setAccumulativePedometerListener() method does not need to call th

    Since: - 2.3.2 + 3.0

    @@ -747,7 +747,7 @@ The ErrorCallback method is launched with this error type:

    Since: - 2.3.2 + 3.0

    @@ -1288,7 +1288,7 @@ When a user takes off the watch device, the heartRate is set to -3. When a user };

    Since: - 2.3.2 + 3.0

    Dictionary members

    @@ -1296,11 +1296,11 @@ When a user takes off the watch device, the heartRate is set to -3. When a user
    long? callbackInterval
    - The callbackInterval in milliseconds (ms) at which human activity data will be sent to the Web Application since Tizen 2.3.2
    For the GPS type, callbackInterval can be between 120000ms and 600000ms inclusive, however, if it is null or zero, it is set by the default value of 120000ms.
    For the HRM type, callbackInterval can be between 10ms and 1000ms inclusive, however, if it is null or zero, it is set set by the default value of 100ms.
    For other activity types, callbackInterval will be ignored. + The callbackInterval in milliseconds (ms) at which human activity data will be sent to the Web Application since Tizen 3.0
    For the GPS type, callbackInterval can be between 120000ms and 600000ms inclusive, however, if it is null or zero, it is set by the default value of 120000ms.
    For the HRM type, callbackInterval can be between 10ms and 1000ms inclusive, however, if it is null or zero, it is set set by the default value of 100ms.
    For other activity types, callbackInterval will be ignored.

    Since: - 2.3.2 + 3.0

    long? sampleInterval
    @@ -1310,7 +1310,7 @@ When a user takes off the watch device, the heartRate is set to -3. When a user

    Since: - 2.3.2 + 3.0

    @@ -1331,7 +1331,7 @@ When a user takes off the watch device, the heartRate is set to -3. When a user };

    Since: - 2.3.2 + 3.0

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

    Since: - 2.3.2 + 3.0

  • @@ -1354,7 +1354,7 @@ When a user takes off the watch device, the heartRate is set to -3. When a user
  • Since: - 2.3.2 + 3.0

  • @@ -1364,7 +1364,7 @@ When a user takes off the watch device, the heartRate is set to -3. When a user

    Since: - 2.3.2 + 3.0

  • diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/sensor.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/sensor.html index 068805c..22577ba 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/sensor.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/sensor.html @@ -532,7 +532,7 @@ Note that the setChangeListener() method only registers the listener. The start() method must be called to turn on the sensor, or the sensor data will not change.

    -

    Remark: interval is supported since Tizen 2.3.2

    +

    Remark: interval is supported since Tizen 3.0

    Parameters:

      -- 2.7.4