diff options
Diffstat (limited to 'en/devices/sensors/hal-interface.html')
-rw-r--r-- | en/devices/sensors/hal-interface.html | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/en/devices/sensors/hal-interface.html b/en/devices/sensors/hal-interface.html index d229e731..b04686e7 100644 --- a/en/devices/sensors/hal-interface.html +++ b/en/devices/sensors/hal-interface.html @@ -23,7 +23,7 @@ -<p>The HAL interface, declared in <a href="/devices/halref/sensors_8h.html">sensors.h</a>, represents the interface between the Android <a href="sensor-stack.html#framework">framework</a> and the hardware-specific software. A HAL implementation must define each +<p>The HAL interface, declared in <a href="https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/sensors.h">sensors.h</a>, represents the interface between the Android <a href="sensor-stack.html#framework">framework</a> and the hardware-specific software. A HAL implementation must define each function declared in sensors.h. The main functions are:</p> <ul> <li><code>get_sensors_list</code> - Returns the list of all sensors. </li> @@ -46,9 +46,9 @@ <li><code>sensor_t</code></li> <li><code>sensors_event_t</code></li> </ul> -<p>In addition to the sections below, see <a href="/devices/halref/sensors_8h.html">sensors.h</a> for more information on those types.</p> +<p>In addition to the sections below, see <a href="https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/sensors.h">sensors.h</a> for more information on those types.</p> <h2 id="get_sensors_list_list">get_sensors_list(list)</h2> -<pre>int (*get_sensors_list)(struct sensors_module_t* module, struct sensor_t +<pre class="prettyprint">int (*get_sensors_list)(struct sensors_module_t* module, struct sensor_t const** list);</pre> <p>Provides the list of sensors implemented by the HAL. See <a href="#sensor_t">sensor_t</a> for details on how the sensors are defined.</p> <p>The order in which the sensors appear in the list is the order in which the @@ -59,7 +59,7 @@ <code>getDefaultSensor(int sensorType, bool wakeUp)</code>.</p> <p>This function returns the number of sensors in the list.</p> <h2 id="activate_sensor_true_false">activate(sensor, true/false)</h2> -<pre>int (*activate)(struct sensors_poll_device_t *dev, int sensor_handle, int +<pre class="prettyprint">int (*activate)(struct sensors_poll_device_t *dev, int sensor_handle, int enabled);</pre> <p>Activates or deactivates a sensor.</p> <p><code>sensor_handle</code> is the handle of the sensor to activate/deactivate. A sensor’s @@ -79,7 +79,7 @@ and succeeds.</p> <p>This function returns 0 on success and a negative error number otherwise.</p> <h2 id="batch_sensor_flags_sampling_period_maximum_report_latency">batch(sensor, flags, sampling period, maximum report latency)</h2> -<pre> +<pre class="prettyprint"> int (*batch)( struct sensors_poll_device_1* dev, int sensor_handle, @@ -180,7 +180,7 @@ int (*batch)( <p>See <a href="batching.html">Batching</a> for more details on sensor batching, including behaviors in suspend mode and out of suspend mode.</p> <h2 id="setdelay_sensor_sampling_period">setDelay(sensor, sampling period)</h2> -<pre> +<pre class="prettyprint"> int (*setDelay)( struct sensors_poll_device_t *dev, int sensor_handle, @@ -191,7 +191,7 @@ int (*setDelay)( <code>sampling_period_ns</code> parameter.</p> <p>In HAL version 1.0, setDelay was used instead of batch to set <a href="#sampling_period_ns">sampling_period_ns</a>.</p> <h2 id="flush_sensor">flush(sensor)</h2> -<pre>int (*flush)(struct sensors_poll_device_1* dev, int sensor_handle);</pre> +<pre class="prettyprint">int (*flush)(struct sensors_poll_device_1* dev, int sensor_handle);</pre> <p>Add a <a href="#metadata_flush_complete_events">flush complete event</a> to the end of the hardware FIFO for the specified sensor and flushes the FIFO; those events are delivered as usual (i.e.: as if the maximum reporting latency had expired) and removed from the FIFO.</p> @@ -213,7 +213,7 @@ int (*setDelay)( <p>This function returns 0 on success, <code>-EINVAL</code> if the specified sensor is a one-shot sensor or wasn’t enabled, and a negative error number otherwise.</p> <h2 id="poll">poll()</h2> -<pre>int (*poll)(struct sensors_poll_device_t *dev, sensors_event_t* data, int +<pre class="prettyprint">int (*poll)(struct sensors_poll_device_t *dev, sensors_event_t* data, int count);</pre> <p>Returns an array of sensor data by filling the <code>data</code> argument. This function must block until events are available. It will return the number of events read @@ -239,7 +239,7 @@ int (*setDelay)( <code>HAL_MODULE_INFO_SYM</code> of this type to expose the <a href="#get_sensors_list_list">get_sensors_list</a> function. See the definition of <code>sensors_module_t</code> in <a - href="/devices/halref/sensors_8h.html">sensors.h</a> and the + href="https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/sensors.h">sensors.h</a> and the definition of <code>hw_module_t</code> for more information.</p> <h2 id="sensors_poll_device_t_sensors_poll_device_1_t">sensors_poll_device_t / sensors_poll_device_1_t</h2> <p><code>sensors_poll_device_1_t</code> contains the rest of the methods defined above: @@ -267,7 +267,7 @@ non-official sensor types, <code>type</code> must start with <code>SENSOR_TYPE_D <em>Cool-product</em> team at Fictional-Company could use <code>stringType=”com.fictional_company.cool_product.unicorn_detector”</code>. The <code>stringType</code> is used to uniquely identify non-official sensors types. See <a - href="/devices/halref/sensors_8h.html">sensors.h</a> for more + href="https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/sensors.h">sensors.h</a> for more information on types and string types.</p> <p><strong>requiredPermission:</strong> A string representing the permission that applications must possess to see the sensor, register to it and receive its data. An empty string @@ -343,7 +343,7 @@ important fields of <code>sensors_event_t</code>:</p> <code>elapsedRealtimeNano</code> clock, as the sensor clock drifts.</p> <p><strong>data and overlapping fields:</strong> The values measured by the sensor. The meaning and units of those fields are specific to each sensor type. See <a - href="/devices/halref/sensors_8h.html">sensors.h</a> and the + href="https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/sensors.h">sensors.h</a> and the definition of the different <a href="sensor-types.html">Sensor types</a> for a description of the data fields. For some sensors, the accuracy of the readings is also reported as part of the data, through a <code>status</code> field. This |