Define the ISensorsCallback
The ISensorsCallback will be used to push notifications into the
sensors framework, such as when dynamic sensors are connected.
Bug: 111070257
Test: Compiles
Change-Id: I681e6de341a80016983a3ab7fa45284ee9104918
diff --git a/sensors/2.0/ISensors.hal b/sensors/2.0/ISensors.hal
index 24454b4..2a57251 100644
--- a/sensors/2.0/ISensors.hal
+++ b/sensors/2.0/ISensors.hal
@@ -22,6 +22,7 @@
import @1.0::Result;
import @1.0::SensorInfo;
import @1.0::SharedMemInfo;
+import @2.0::ISensorsCallback;
interface ISensors {
/**
@@ -59,8 +60,11 @@
activate(int32_t sensorHandle, bool enabled) generates (Result result);
/**
- * Initialize the Fast Message Queues (FMQ) that are used to send data
- * between the framework and the HAL.
+ * Initialize the Sensors HAL's Fast Message Queues (FMQ) and callback.
+ *
+ * The Fast Message Queues (FMQ) that are used to send data between the
+ * framework and the HAL. The callback is used by the HAL to notify the
+ * framework of asynchronous events, such as a dynamic sensor connection.
*
* The Event FMQ is used to transport sensor events from the HAL to the
* framework. The Event FMQ is created using the eventQueueDescriptor.
@@ -81,6 +85,9 @@
* unprocessed WAKE_UP events and release its wake_lock if the current
* count of unprocessed WAKE_UP events is zero.
*
+ * The ISensorsCallback is used by the HAL to notify the framework of
+ * asynchronous events, such as a dynamic sensor connection.
+ *
* The name of any wake_lock acquired by the Sensors HAL for WAKE_UP events
* must begin with "SensorsHAL_WAKEUP".
*
@@ -90,14 +97,14 @@
* released.
*
* If either the Event FMQ or the Wake Lock FMQ is already initialized when
- * initializeMessageQueues is invoked, then both existing FMQs must be
- * discarded and the new descriptors must be used to create new FMQs within
- * the HAL. The number of outstanding WAKE_UP events should also be reset to
- * zero, and any outstanding wake_locks held as a result of WAKE_UP events
- * should be released.
+ * initialize is invoked, then both existing FMQs must be discarded and the
+ * new descriptors must be used to create new FMQs within the HAL. The
+ * number of outstanding WAKE_UP events should also be reset to zero, and
+ * any outstanding wake_locks held as a result of WAKE_UP events should be
+ * released.
*
- * initializeMessageQueues must be thread safe and prevent concurrent calls
- * to initializeMessageQueues from simultaneously modifying state.
+ * initialize must be thread safe and prevent concurrent calls
+ * to initialize from simultaneously modifying state.
*
* @param eventQueueDescriptor Fast Message Queue descriptor that is used to
* create the Event FMQ which is where sensor events are written. The
@@ -107,14 +114,18 @@
* create the Wake Lock FMQ which is where wake_lock events are read
* from. The descriptor is obtained from the framework's FMQ that is
* used to write wake_lock events.
+ * @param sensorsCallback sensors callback that receives asynchronous data
+ * from the Sensors HAL.
* @return result OK on success; BAD_VALUE if descriptor is invalid (such
* as null)
*/
@entry
@callflow(next = {"getSensorsList"})
- initializeMessageQueues(fmq_sync<Event> eventQueueDescriptor,
- fmq_sync<uint32_t> wakeLockDescriptor)
- generates (Result result);
+ initialize(fmq_sync<Event> eventQueueDescriptor,
+ fmq_sync<uint32_t> wakeLockDescriptor,
+ ISensorsCallback sensorsCallback)
+ generates
+ (Result result);
/**
* Sets a sensor’s parameters, including sampling frequency and maximum