}
tizen.humanactivitymonitor.start("WRIST_UP", onchangedCB)</pre>
+
+<p>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 <span style="font-family: Courier New,Courier,monospace">start()</span> method, option, can be used to specify this information:</p>
+
+<pre class="prettyprint">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);</pre>
</li>
<li>When the a heart-rate monitor (HRM) is enabled, you can get the current data using the <span style="font-family: Courier New,Courier,monospace">getHumanActivityData()</span> method of the <span style="font-family: Courier New,Courier,monospace">HumanActivityMonitorManager</span> interface:
<li>Define an event handler for sensor data changes by implementing the <span style="font-family: Courier New,Courier,monospace">SensorDataSuccessCallback</span> interface (in <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/sensor.html#SensorDataSuccessCallback">mobile</a> and <a href="../../../../../org.tizen.web.apireference/html/device_api/wearable/tizen/sensor.html#SensorDataSuccessCallback">wearable</a> applications):
<pre class="prettyprint">function onchangedCB(sensorData)
{
- console.log("value of pressure is: " + sensorData.pressure);
+ console.log("Light sensor data: " + sensorData.lightLevel);
}
</pre>
</li>
<li>Register a change listener to be called when the sensor data changes.
-<p>To register a change listener, use the <span style="font-family: Courier New,Courier,monospace">setChangeListener()</span> method of the <span style="font-family: Courier New,Courier,monospace">Sensor</span> interface (in <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/sensor.html#Sensor">mobile</a> and <a href="../../../../../org.tizen.web.apireference/html/device_api/wearable/tizen/sensor.html#Sensor">wearable</a> applications).</p>
+<p>To register a change listener, use the <span style="font-family: Courier New,Courier,monospace">setChangeListener()</span> method of the <span style="font-family: Courier New,Courier,monospace">Sensor</span> interface (in <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/sensor.html#Sensor">mobile</a> and <a href="../../../../../org.tizen.web.apireference/html/device_api/wearable/tizen/sensor.html#Sensor">wearable</a> applications).</p>
<p>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 <span style="font-family: Courier New,Courier,monospace">interval</span> to 100 results in approximately 10 events being send every second.</p>
-<pre class="prettyprint">var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
+<pre class="prettyprint">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);</pre>
+lightSensor.setChangeListener(onchangedCB, 500);
+lightSensor.start(onsuccessCB);</pre>
The default value of <span style="font-family: Courier New,Courier,monospace">interval</span> parameter is 100. If you do not pass an <span style="font-family: Courier New,Courier,monospace">interval</span> value, a default one will be used:
<pre class="prettyprint">var lightSensor = tizen.sensorservice.getDefaultSensor("LIGHT");
}
// use the default interval value (100 ms):
-proximitySensor.setChangeListener(onchangedCB);
+lightSensor.setChangeListener(onchangedCB);
-proximitySensor.start(onsuccessCB);</pre>
+lightSensor.start(onsuccessCB);</pre>
</li>
<li>To stop receiving notifications on sensor data changes, use the <span style="font-family: Courier New,Courier,monospace">unsetChangeListener()</span> method of the Sensor interface.
-<pre class="prettyprint">proximitySensor.unsetChangeListener();</pre>
+<pre class="prettyprint">lightSensor.unsetChangeListener();</pre>
</li>
</ol>
<pre class="webidl prettyprint"> enum ActivityRecognitionType { "STATIONARY", "WALKING", "RUNNING", "IN_VEHICLE" };</pre>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
<div class="description">
<p>
<pre class="webidl prettyprint"> enum ActivityAccuracy { "LOW", "MEDIUM", "HIGH" };</pre>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
<div class="description">
<p>
For other types, only <b>'http://tizen.org/privilege/healthinfo'</b> should be declared.
</p>
<p><span class="remark"> Remark : </span>
- <em>option</em> is supported since Tizen 2.3.2
+ <em>option</em> is supported since Tizen 3.0
</p>
<div class="parameters">
<p><span class="param">Parameters:</span></p>
</li>
<li class="param">
<span class="name">option</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
- The option to set the period and the interval for several human activity types since Tizen 2.3.2<br>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<br>By default, this parameter is set to null.
</li>
</ul>
</div>
</pre></div>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
<div class="description">
<p>
</pre></div>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
<div class="description">
<p>
};</pre>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
<div class="attributes">
<h4>Dictionary members</h4>
<dt class="member" id="HumanActivityMonitorOption::callbackInterval"><span class="attrName">long? callbackInterval</span></dt>
<dd>
<div class="brief">
- The <em>callbackInterval</em> in milliseconds (ms) at which human activity data will be sent to the Web Application since Tizen 2.3.2<br>For the GPS type, <em>callbackInterval</em> can be between 120000ms and 600000ms inclusive, however, if it is null or zero, it is set by the default value of 120000ms.<br>For the HRM type, <em>callbackInterval</em> can be between 10ms and 1000ms inclusive, however, if it is null or zero, it is set set by the default value of 100ms.<br>For other activity types, <em>callbackInterval</em> will be ignored.
+ The <em>callbackInterval</em> in milliseconds (ms) at which human activity data will be sent to the Web Application since Tizen 3.0<br>For the GPS type, <em>callbackInterval</em> can be between 120000ms and 600000ms inclusive, however, if it is null or zero, it is set by the default value of 120000ms.<br>For the HRM type, <em>callbackInterval</em> can be between 10ms and 1000ms inclusive, however, if it is null or zero, it is set set by the default value of 100ms.<br>For other activity types, <em>callbackInterval</em> will be ignored.
</div>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
</dd>
<dt class="member" id="HumanActivityMonitorOption::sampleInterval"><span class="attrName">long? sampleInterval</span></dt>
</div>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
</dd>
</dl>
};</pre>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
<div class="attributes">
</div>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
</li>
<li class="attribute" id="HumanActivityRecognitionData::timestamp">
</div>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
</li>
<li class="attribute" id="HumanActivityRecognitionData::accuracy">
</div>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
</li>
</ul>
The start() method must be called to turn on the sensor, or the sensor data will not change.
</p>
</div>
-<p><span class="remark">Remark: </span><em>interval</em> is supported since Tizen 2.3.2</p>
+<p><span class="remark">Remark: </span><em>interval</em> is supported since Tizen 3.0</p>
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<ul>
<pre class="webidl prettyprint"> enum ActivityRecognitionType { "STATIONARY", "WALKING", "RUNNING", "IN_VEHICLE" };</pre>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
<div class="description">
<p>
<pre class="webidl prettyprint"> enum ActivityAccuracy { "LOW", "MEDIUM", "HIGH" };</pre>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
<div class="description">
<p>
For other types, only <b>'http://tizen.org/privilege/healthinfo'</b> should be declared.
</p>
<p><span class="remark"> Remark : </span>
- <em>option</em> is supported since Tizen 2.3.2
+ <em>option</em> is supported since Tizen 3.0
</p>
<div class="parameters">
<p><span class="param">Parameters:</span></p>
</li>
<li class="param">
<span class="name">option</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
- The option to set the period and the interval for several human activity types since Tizen 2.3.2<br>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<br>By default, this parameter is set to null.
</li>
</ul>
</div>
</pre></div>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
<div class="description">
<p>
</pre></div>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
<div class="description">
<p>
};</pre>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
<div class="attributes">
<h4>Dictionary members</h4>
<dt class="member" id="HumanActivityMonitorOption::callbackInterval"><span class="attrName">long? callbackInterval</span></dt>
<dd>
<div class="brief">
- The <em>callbackInterval</em> in milliseconds (ms) at which human activity data will be sent to the Web Application since Tizen 2.3.2<br>For the GPS type, <em>callbackInterval</em> can be between 120000ms and 600000ms inclusive, however, if it is null or zero, it is set by the default value of 120000ms.<br>For the HRM type, <em>callbackInterval</em> can be between 10ms and 1000ms inclusive, however, if it is null or zero, it is set set by the default value of 100ms.<br>For other activity types, <em>callbackInterval</em> will be ignored.
+ The <em>callbackInterval</em> in milliseconds (ms) at which human activity data will be sent to the Web Application since Tizen 3.0<br>For the GPS type, <em>callbackInterval</em> can be between 120000ms and 600000ms inclusive, however, if it is null or zero, it is set by the default value of 120000ms.<br>For the HRM type, <em>callbackInterval</em> can be between 10ms and 1000ms inclusive, however, if it is null or zero, it is set set by the default value of 100ms.<br>For other activity types, <em>callbackInterval</em> will be ignored.
</div>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
</dd>
<dt class="member" id="HumanActivityMonitorOption::sampleInterval"><span class="attrName">long? sampleInterval</span></dt>
</div>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
</dd>
</dl>
};</pre>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
<div class="attributes">
</div>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
</li>
<li class="attribute" id="HumanActivityRecognitionData::timestamp">
</div>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
</li>
<li class="attribute" id="HumanActivityRecognitionData::accuracy">
</div>
<p><span class="version">
Since: </span>
- 2.3.2
+ 3.0
</p>
</li>
</ul>
The start() method must be called to turn on the sensor, or the sensor data will not change.
</p>
</div>
-<p><span class="remark">Remark: </span><em>interval</em> is supported since Tizen 2.3.2</p>
+<p><span class="remark">Remark: </span><em>interval</em> is supported since Tizen 3.0</p>
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<ul>