summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStan Rokita <srok@google.com>2019-09-10 15:07:59 -0700
committerStan Rokita <srok@google.com>2019-09-11 07:43:22 -0700
commit4b4c7b744db68a297c192be417d2ab4b1128e717 (patch)
tree7ce975926f982a0279ec752298e291336a304db1
parent1638531dfbb242a48cd59441a8bab1b0b484f9b9 (diff)
downloadplatform_hardware_interfaces-4b4c7b744db68a297c192be417d2ab4b1128e717.tar.gz
platform_hardware_interfaces-4b4c7b744db68a297c192be417d2ab4b1128e717.tar.bz2
platform_hardware_interfaces-4b4c7b744db68a297c192be417d2ab4b1128e717.zip
MultiHal 2.0 - activate, batch, flush methods of HalProxy
These three methods of HalProxy simply call the apropriate ISensors methods of the subhal pointed to by sensorHandle. Test: Loaded onto device and observed no crashing. Bug: 136511617 Change-Id: If90652554ea18c22b24aead0074ab9847eae0a4f
-rw-r--r--sensors/2.0/multihal/HalProxy.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/sensors/2.0/multihal/HalProxy.cpp b/sensors/2.0/multihal/HalProxy.cpp
index 964f5893aa..dcdccac2be 100644
--- a/sensors/2.0/multihal/HalProxy.cpp
+++ b/sensors/2.0/multihal/HalProxy.cpp
@@ -123,9 +123,9 @@ Return<Result> HalProxy::setOperationMode(OperationMode /* mode */) {
return Result::INVALID_OPERATION;
}
-Return<Result> HalProxy::activate(int32_t /* sensorHandle */, bool /* enabled */) {
- // TODO: Proxy API call to appropriate sub-HAL.
- return Result::INVALID_OPERATION;
+Return<Result> HalProxy::activate(int32_t sensorHandle, bool enabled) {
+ return getSubHalForSensorHandle(sensorHandle)
+ ->activate(zeroOutFirstByte(sensorHandle), enabled);
}
Return<Result> HalProxy::initialize(
@@ -163,15 +163,14 @@ Return<Result> HalProxy::initialize(
return result;
}
-Return<Result> HalProxy::batch(int32_t /* sensorHandle */, int64_t /* samplingPeriodNs */,
- int64_t /* maxReportLatencyNs */) {
- // TODO: Proxy API call to appropriate sub-HAL.
- return Result::INVALID_OPERATION;
+Return<Result> HalProxy::batch(int32_t sensorHandle, int64_t samplingPeriodNs,
+ int64_t maxReportLatencyNs) {
+ return getSubHalForSensorHandle(sensorHandle)
+ ->batch(zeroOutFirstByte(sensorHandle), samplingPeriodNs, maxReportLatencyNs);
}
-Return<Result> HalProxy::flush(int32_t /* sensorHandle */) {
- // TODO: Proxy API call to appropriate sub-HAL.
- return Result::INVALID_OPERATION;
+Return<Result> HalProxy::flush(int32_t sensorHandle) {
+ return getSubHalForSensorHandle(sensorHandle)->flush(zeroOutFirstByte(sensorHandle));
}
Return<Result> HalProxy::injectSensorData(const Event& /* event */) {