MultiHal 2.0 - proxying api calls helper methods
Create getSubHalForSensorHandle method which will get the proper subhal
pointer by getting the subhal list index from the first byte of the
sensor handle. Create the zeroOutFirstByte static helper method that
will return a version of the sensor handle without the first byte when
passed a handle.
Test: Tested compilation.
Bug: 136511617
Change-Id: I7d07003e1903aa1d8abaf904b778248c7b352653
diff --git a/sensors/2.0/multihal/HalProxy.cpp b/sensors/2.0/multihal/HalProxy.cpp
index 80d7296..964f589 100644
--- a/sensors/2.0/multihal/HalProxy.cpp
+++ b/sensors/2.0/multihal/HalProxy.cpp
@@ -218,6 +218,14 @@
return Return<void>();
}
+ISensorsSubHal* HalProxy::getSubHalForSensorHandle(uint32_t sensorHandle) {
+ return mSubHalList[static_cast<size_t>(sensorHandle >> 24)];
+}
+
+uint32_t HalProxy::zeroOutFirstByte(uint32_t num) {
+ return num & 0x00FFFFFF;
+}
+
} // namespace implementation
} // namespace V2_0
} // namespace sensors