|
|
@ -83,8 +83,8 @@ void Sensor::batch(int32_t samplingPeriodNs) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Sensor::activate(bool enable) { |
|
|
|
void Sensor::activate(bool enable) { |
|
|
|
|
|
|
|
std::lock_guard<std::mutex> lock(mRunMutex); |
|
|
|
if (mIsEnabled != enable) { |
|
|
|
if (mIsEnabled != enable) { |
|
|
|
std::unique_lock<std::mutex> lock(mRunMutex); |
|
|
|
|
|
|
|
mIsEnabled = enable; |
|
|
|
mIsEnabled = enable; |
|
|
|
mWaitCV.notify_all(); |
|
|
|
mWaitCV.notify_all(); |
|
|
|
} |
|
|
|
} |
|
|
@ -158,8 +158,8 @@ std::vector<Event> Sensor::readEvents() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Sensor::setOperationMode(OperationMode mode) { |
|
|
|
void Sensor::setOperationMode(OperationMode mode) { |
|
|
|
|
|
|
|
std::lock_guard<std::mutex> lock(mRunMutex); |
|
|
|
if (mMode != mode) { |
|
|
|
if (mMode != mode) { |
|
|
|
std::unique_lock<std::mutex> lock(mRunMutex); |
|
|
|
|
|
|
|
mMode = mode; |
|
|
|
mMode = mode; |
|
|
|
mWaitCV.notify_all(); |
|
|
|
mWaitCV.notify_all(); |
|
|
|
} |
|
|
|
} |
|
|
|