VitroIO SDK
Software development kit for Vitro Shard.
|
Class is responsible for cycling readings of measurement data using registered sensors. More...
#include <measurement_api.h>
Public Types | |
typedef Callback< void(SensorParameterValue *, int)> | OnNewValuesCallback |
Type defines signature of callback function which is to be called when a new measurement values are read. More... | |
Public Member Functions | |
MeasurementApi (EventQueue *targetQueue, uint32_t eventQueueSize=VITROIO_MEASUREMENT_API_DEFAULT_EVENT_QUEUE_SIZE) | |
Contructor chains an internal event queue to the targetQueue . More... | |
MeasurementApi (osPriority priority=osPriorityNormal, uint32_t eventQueueSize=VITROIO_MEASUREMENT_API_DEFAULT_EVENT_QUEUE_SIZE) | |
Contructor creates internal event loop using thread with priority priority . More... | |
~MeasurementApi () | |
Destructor frees resources and stops event loop. More... | |
bool | isValid () const |
Function allows to check whether the object is in valid state. More... | |
bool | registerSensor (AbstractSensorInterface *sensorIf) |
Function registers sensor from which the measurement data is to be read. More... | |
void | setPollTime (unsigned int seconds) |
Function sets interval between readings of measurement values. More... | |
void | setOnNewValuesCallback (OnNewValuesCallback callback) |
Function sets callback which will be called when the new values are read. More... | |
void | startMeasurements () |
Function starts cycling reading of measurement values. More... | |
void | stopMeasurements () |
Function stops reading of measurements values. More... | |
Class is responsible for cycling readings of measurement data using registered sensors.
The class uses an event loop for handling events. The event queue can be managed by external queue specified by user or by internal queue with thread of specified priority.
MaxParams | Specifies maximum number of sensors parameters that can be handled |
typedef Callback<void(SensorParameterValue*, int)> vitroio::sdk::MeasurementApi< MaxParams >::OnNewValuesCallback |
Type defines signature of callback function which is to be called when a new measurement values are read.
|
explicit |
Contructor chains an internal event queue to the targetQueue
.
There is not guarantee that the object is in valid state. User should call isValid() method to determine if the object was initialized successfully. When the object is in invalid state, the behaviour is undefined.
The contructor uses mbed::EventQueue::chain method for connection to targetQueue
.
targetQueue
must be run before usage of this class (construction of the object can be done earlier).targetQueue | External event queue to which the internal queue is to be chained |
eventQueueSize | Size of internal event queue |
|
explicit |
Contructor creates internal event loop using thread with priority priority
.
There is not guarantee that the object is in valid state. User should call isValid() method to determine if the object was initialized successfully. When the object is in invalid state, the behaviour is undefined.
priority | Priority of thread for handling internal event queue |
eventQueueSize | Size of internal event queue |
vitroio::sdk::MeasurementApi< MaxParams >::~MeasurementApi | ( | ) |
Destructor frees resources and stops event loop.
bool vitroio::sdk::MeasurementApi< MaxParams >::isValid | ( | ) | const |
Function allows to check whether the object is in valid state.
bool vitroio::sdk::MeasurementApi< MaxParams >::registerSensor | ( | AbstractSensorInterface * | sensorIf | ) |
Function registers sensor from which the measurement data is to be read.
sensorIf | Pointer to sensor interface to register |
MaxParams
. void vitroio::sdk::MeasurementApi< MaxParams >::setOnNewValuesCallback | ( | OnNewValuesCallback | callback | ) |
Function sets callback which will be called when the new values are read.
void vitroio::sdk::MeasurementApi< MaxParams >::setPollTime | ( | unsigned int | seconds | ) |
Function sets interval between readings of measurement values.
seconds | Interval in seconds |
void vitroio::sdk::MeasurementApi< MaxParams >::startMeasurements | ( | ) |
Function starts cycling reading of measurement values.
void vitroio::sdk::MeasurementApi< MaxParams >::stopMeasurements | ( | ) |
Function stops reading of measurements values.