diff options
Diffstat (limited to 'sensorhal/hubconnection.h')
-rw-r--r-- | sensorhal/hubconnection.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sensorhal/hubconnection.h b/sensorhal/hubconnection.h index 20d3c326..77b5fe1d 100644 --- a/sensorhal/hubconnection.h +++ b/sensorhal/hubconnection.h @@ -32,6 +32,8 @@ #include "hubdefs.h" #include "ring.h" +#define WAKELOCK_NAME "sensorHal" + namespace android { struct HubConnection : public Thread { @@ -57,6 +59,11 @@ struct HubConnection : public Thread { void queueFlush(int handle); void queueData(int handle, void *data, size_t length); + bool isWakeEvent(int32_t sensor); + void releaseWakeLockIfAppropriate(); + ssize_t getWakeEventCount(); + ssize_t decrementWakeEventCount(); + ssize_t read(sensors_event_t *ev, size_t size); void setActivityCallback(ActivityEventHandler *eventHandler); @@ -72,6 +79,11 @@ protected: private: typedef uint32_t rate_q10_t; // q10 means lower 10 bits are for fractions + bool mWakelockHeld; + int32_t mWakeEventCount; + + void protectIfWakeEvent(int32_t sensor); + static inline uint64_t period_ns_to_frequency_q10(nsecs_t period_ns) { return 1024000000000ULL / period_ns; } |