diff options
author | Clay Murphy <claym@google.com> | 2014-06-11 21:38:32 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-06-11 21:38:32 +0000 |
commit | e751014022d7e9095fd15e2d18787d5f9caa0e3a (patch) | |
tree | 4ff3621f53305cc2d8d15ef8eaa4239254f62a4d | |
parent | 1f4d2c456926898e6b376a99fe150c15d22b1fa7 (diff) | |
parent | a1e248f68a8cc442a44c133de8bc6a73756a878f (diff) | |
download | source.android.com-e751014022d7e9095fd15e2d18787d5f9caa0e3a.tar.gz |
am a1e248f6: am 622ff910: am 7875f63e: Merge "Docs: Adding example of period_ns to on-change entry."
* commit 'a1e248f68a8cc442a44c133de8bc6a73756a878f':
Docs: Adding example of period_ns to on-change entry.
-rw-r--r-- | src/devices/sensors/base_triggers.jd | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/devices/sensors/base_triggers.jd b/src/devices/sensors/base_triggers.jd index 1d2bd78a..81d25477 100644 --- a/src/devices/sensors/base_triggers.jd +++ b/src/devices/sensors/base_triggers.jd @@ -28,16 +28,25 @@ page.title=Base sensors and trigger modes <p>Sensors can report events in different ways called trigger modes; each sensor type has one and only one trigger mode associated to it. Four trigger modes exist:</p> + <h3 id="continuous">Continuous</h3> <p>Events are reported at a constant rate defined by setDelay(). Example sensors using the continuous trigger mode are accelerometers and gyroscopes.</p> + <h3 id="on-change">On-change</h3> -<p>Events are reported only if the sensor's value has changed. setDelay() is used - to set a lower limit to the reporting period, meaning the minimum time between - consecutive events. Activating the sensor also triggers an event. The HAL must - return an event immediately when an on-change sensor is activated. Example - sensors using the on-change trigger mode are the step counter and proximity - sensor types.</p> +<p>Events are reported only if the sensor's value has changed. Activating the +sensor also triggers an event, meaning the HAL must return an event immediately +when an on-change sensor is activated. Example sensors using the on-change +trigger mode are the step counter and proximity sensor types.</p> + +<p>Here is how the <code>period_ns</code> parameter affects setDelay(...) and +batch(...). The <code>period_ns</code> parameter is used to set a lower limit +to the reporting period, meaning the minimum time between consecutive events. +Here is an example: If activating the step counter with period_ns = 10 seconds, +walking for 1 minute, and then not walking for 1 minute, the events will +be generated every 10 seconds during the first minute, and no event will be +generated in the second minute.</p> + <h3 id="one-shot">One-shot</h3> <p>Upon detection of an event, the sensor deactivates itself and then sends a single event. Order matters to avoid race conditions. No other event is sent |