32 : id(id), period(period)
40 return left->getSamplingPeriod() < right->getSamplingPeriod();
46 [&](std::pair<AbstractSensor*, SensorInfo> s)
47 { return s.first == sensor; });
49 elem->second.isEnabled = isEnabled;
51 static_cast<void*
>(sensor), elem->second.isEnabled);
57 s.second.isEnabled =
true;
63 s.second.isEnabled =
false;
71 if (s.second.isEnabled && s.second.isInitialized)
73 sampleSensor(s.first);
75 if (s.second.callback)
90 if (it->first == sensor)
94 static_cast<void*
>(sensor));
100 std::chrono::nanoseconds period)
110 sensors.push_back(make_pair(sensor, sensorInfo));
#define LOG_ERR(logger,...)
#define LOG_DEBUG(logger,...)
Base abstract class for sensor drivers.
Virtual sensor sampler class.
unsigned int getNumSensors()
SensorSampler(uint8_t id, std::chrono::nanoseconds period)
std::vector< std::pair< AbstractSensor *, SensorInfo > > sensors
void disableAllSensors()
Disable sampling for all the sensors.
static bool compareByPeriod(SensorSampler *left, SensorSampler *right)
const SensorInfo getSensorInfo(AbstractSensor *sensor)
void enableAllSensors()
Enable sampling for all the sensors.
void toggleSensor(AbstractSensor *sensor, bool isEnabled)
Enabled or disable a sensor.
std::chrono::nanoseconds getSamplingPeriod()
void sampleAndCallback()
For each sensor, sample it and call the corresponding callback.
SimpleSensorSampler(uint8_t id, std::chrono::nanoseconds period)
void sampleSensor(AbstractSensor *s) override
Perform the update of all the sensors in the sampler.
void addSensor(AbstractSensor *sensor, SensorInfo sensorInfo) override
Add a sensor to the sensors map.
This file includes all the types the logdecoder script will decode.
Sensors information struct needed by the SensorManager.