platform_hardware_tequila_c.../libsensor/SensorEventQueue.cpp
Sebastiano Barezzi aea5a5fba5 compat: Add libsensor -> libsensorndkbridge wrapper
Change-Id: I62c27463af385dc791dde64731a39e9ebadfd587
2023-09-25 16:58:58 +00:00

34 lines
1,015 B
C++

/*
* Copyright (C) 2023 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "SensorEventQueue.h"
namespace android {
SensorEventQueue::SensorEventQueue(ASensorEventQueue* aSensorEventQueue)
: mASensorEventQueue(aSensorEventQueue) {}
ssize_t SensorEventQueue::read(ASensorEvent* events, size_t numEvents) {
return ASensorEventQueue_getEvents(mASensorEventQueue, events, numEvents);
}
status_t SensorEventQueue::waitForEvent() const {
return OK;
}
status_t SensorEventQueue::enableSensor(Sensor const* sensor) const {
return ASensorEventQueue_enableSensor(mASensorEventQueue, sensor->getASensorRef());
}
status_t SensorEventQueue::disableSensor(Sensor const* sensor) const {
return ASensorEventQueue_disableSensor(mASensorEventQueue, sensor->getASensorRef());
}
status_t SensorEventQueue::setEventRate(Sensor const* sensor, nsecs_t ns) const {
return ASensorEventQueue_setEventRate(mASensorEventQueue, sensor->getASensorRef(), ns);
}
} // namespace android