diff options
author | Brian Stack <bstack@google.com> | 2018-10-23 14:29:31 -0700 |
---|---|---|
committer | Brian Stack <bstack@google.com> | 2018-11-07 13:36:11 -0800 |
commit | 1fdd1bb4db627f7ccc4436b54bc2aa379db9a759 (patch) | |
tree | cd1bd05613744fda87231d9ad98d5efe475127e8 /sensors/common/vts/utils/SensorsHidlEnvironmentBase.cpp | |
parent | 1b7796d0eb70a7036c7afd8340bd3d872c8a9e96 (diff) |
Implement VTS tests for Sensors 2.0 flush
Bug: 115969174
Test: Tests pass against default implementation
Change-Id: Icb8c3d7776b8460d502bfec251ded061f978bec9
Diffstat (limited to 'sensors/common/vts/utils/SensorsHidlEnvironmentBase.cpp')
-rw-r--r-- | sensors/common/vts/utils/SensorsHidlEnvironmentBase.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sensors/common/vts/utils/SensorsHidlEnvironmentBase.cpp b/sensors/common/vts/utils/SensorsHidlEnvironmentBase.cpp index 21c08d297c..d8b4ee0853 100644 --- a/sensors/common/vts/utils/SensorsHidlEnvironmentBase.cpp +++ b/sensors/common/vts/utils/SensorsHidlEnvironmentBase.cpp @@ -50,4 +50,18 @@ void SensorsHidlEnvironmentBase::addEvent(const Event& ev) { if (collectionEnabled) { events.push_back(ev); } + + if (mCallback != nullptr) { + mCallback->onEvent(ev); + } } + +void SensorsHidlEnvironmentBase::registerCallback(IEventCallback* callback) { + std::lock_guard<std::mutex> lock(events_mutex); + mCallback = callback; +} + +void SensorsHidlEnvironmentBase::unregisterCallback() { + std::lock_guard<std::mutex> lock(events_mutex); + mCallback = nullptr; +}
\ No newline at end of file |