Generate events for default Sensors 2.0
Adds the ability for default Sensors 2.0 implementation to generate
sensor events.
Bug: 111070257
Test: Builds
Change-Id: I98f04dbac5370cc6fc3be43468ba43b6476b4515
diff --git a/sensors/2.0/default/Sensors.h b/sensors/2.0/default/Sensors.h
index 64ee5c5..f543935 100644
--- a/sensors/2.0/default/Sensors.h
+++ b/sensors/2.0/default/Sensors.h
@@ -43,7 +43,7 @@
using ::android::hardware::Return;
using ::android::hardware::Void;
-struct Sensors : public ISensors {
+struct Sensors : public ISensors, public ISensorsEventCallback {
using Event = ::android::hardware::sensors::V1_0::Event;
using OperationMode = ::android::hardware::sensors::V1_0::OperationMode;
using RateLevel = ::android::hardware::sensors::V1_0::RateLevel;
@@ -80,6 +80,8 @@
Return<void> configDirectReport(int32_t sensorHandle, int32_t channelHandle, RateLevel rate,
configDirectReport_cb _hidl_cb) override;
+ void postEvents(const std::vector<Event>& events) override;
+
private:
/**
* Utility function to delete the Event Flag
@@ -113,6 +115,11 @@
* A map of the available sensors
*/
std::map<int32_t, std::shared_ptr<Sensor>> mSensors;
+
+ /**
+ * Lock to protect writes and reads to the FMQs
+ */
+ std::mutex mLock;
};
} // namespace implementation