From 8dd8516b54fe1a149f73e64713c6738aa0087db5 Mon Sep 17 00:00:00 2001 From: Pawel Wasowski Date: Mon, 17 Oct 2016 12:46:43 +0200 Subject: [PATCH] Add guide for SensorHardwareInfo PS3: [LB] Reviewed Change-Id: I217cfc01bc7487cb37d60c34328b452951a55869 Signed-off-by: Pawel Wasowski --- .../html/web/sensors/device_sensors_w.htm | 42 +++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/org.tizen.guides/html/web/sensors/device_sensors_w.htm b/org.tizen.guides/html/web/sensors/device_sensors_w.htm index 0b00113..479930b 100644 --- a/org.tizen.guides/html/web/sensors/device_sensors_w.htm +++ b/org.tizen.guides/html/web/sensors/device_sensors_w.htm @@ -29,6 +29,7 @@

Related Info

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

@@ -120,6 +123,7 @@

Task in Mobile Applications

@@ -195,7 +199,7 @@ proximitySensor.stop();

Receiving Notifications on Sensor Data Changes

-

Learning how to register a change event handler for sensor data enables your application to react to changes without the need to check current values constantly.

+

Learning how to register a change event handler for sensor data enables your application to react to changes without the need to check current values constantly:

    @@ -264,6 +268,42 @@ lightSensor.unsetChangeListener();
+

Obtaining Sensor Hardware Information

+ +

Learning how to retrieve information about the sensor hardware enables your application to know the sensor's technical limits:

+ +
    + +
  1. Define a success callback for handling a SensorHardwareInfo object (in mobile and wearable applications). You can also define an optional error callback. +
    +function onsuccessCB(hwInfo)
    +{
    +   console.log("name: " + hwInfo.name);
    +   console.log("type: " + hwInfo.type);
    +   console.log("vendor: " + hwInfo.vendor);
    +   console.log("minValue: " + hwInfo.minValue);
    +   console.log("maxValue: " + hwInfo.maxValue);
    +   console.log("resolution: " + hwInfo.resolution);
    +   console.log("minInterval: " + hwInfo.minInterval);
    +   console.log("maxBatchCount: " + hwInfo.maxBatchCount);
    +}
    +
    +function onerrorCB(error)
    +{
    +   console.log("An error occurred: " + error.message);
    +}
    +
    +
  2. + +
  3. Call the getSensorHardwareInfo() method of an existing Sensor object to obtain its hardware information as the SensorHardwareInfo object: +
    +var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
    +
    +proximitySensor.getSensorHardwareInfo(onsuccessCB, onerrorCB);
    +
    +
  4. +
+ -- 2.7.4