Provides functionality of measurement system.
More...
|
| file | debug.h |
| | The file defines debug macros.
|
| |
Provides functionality of measurement system.
Required modules:
◆ _MEASUREMENT_API_ERROR_
| #define _MEASUREMENT_API_ERROR_ |
( |
| format, |
|
|
| ... ) |
Value:
#define _MEASUREMENT_API_MODULE_NAME_
Definition measurement_api.h:6
#define VITROIO_DEBUG_ERROR(module, format,...)
◆ _MEASUREMENT_API_INFO_
| #define _MEASUREMENT_API_INFO_ |
( |
| format, |
|
|
| ... ) |
Value:
#define VITROIO_DEBUG_INFO(module, format,...)
◆ _MEASUREMENT_API_MODULE_NAME_
| #define _MEASUREMENT_API_MODULE_NAME_ "MEASUREMENT API" |
◆ _MEASUREMENT_API_POLL_TIME_S_DEFAULT_
| #define _MEASUREMENT_API_POLL_TIME_S_DEFAULT_ 30 |
◆ _MEASUREMENT_API_WARNING_
| #define _MEASUREMENT_API_WARNING_ |
( |
| format, |
|
|
| ... ) |
Value:
#define VITROIO_DEBUG_WARNING(module, format,...)
◆ VITROIO_MEASUREMENT_API_DEFAULT_EVENT_QUEUE_SIZE
| #define VITROIO_MEASUREMENT_API_DEFAULT_EVENT_QUEUE_SIZE 2 |
◆ VITROIO_SDK_DEBUG_H
| #define VITROIO_SDK_DEBUG_H |
◆ VITROIO_SDK_MEASUREMENT_API_HPP
| #define VITROIO_SDK_MEASUREMENT_API_HPP |
◆ isValid()
template<uint32_t MaxParams>
Function allows to check whether the object is in valid state.
- Note
- This method should be called always after creation of the object.
- Returns
- Function returns true if the object is valid or false otherwise.
◆ MeasurementApi() [1/2]
template<uint32_t MaxParams>
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.
- Note
- Thread which handles
targetQueue must be run before usage of this class (construction of the object can be done earlier).
- Parameters
-
| targetQueue | External event queue to which the internal queue is to be chained |
| eventQueueSize | Size of internal event queue |
◆ MeasurementApi() [2/2]
template<uint32_t MaxParams>
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.
- Parameters
-
| priority | Priority of thread for handling internal event queue |
| eventQueueSize | Size of internal event queue |
◆ registerSensor()
template<uint32_t MaxParams>
Function registers sensor from which the measurement data is to be read.
- Parameters
-
| sensorIf | Pointer to sensor interface to register |
- Returns
- Function returns true on success or false if parameters count exceeded
MaxParams.
◆ setOnNewValuesCallback()
template<uint32_t MaxParams>
Function sets callback which will be called when the new values are read.
- Note
- Callback set by this method will be executed in another thread (event loop).
◆ setPollTime()
template<uint32_t MaxParams>
Function sets interval between readings of measurement values.
- Parameters
-
| seconds | Interval in seconds |
◆ startMeasurements()
template<uint32_t MaxParams>
Function starts cycling reading of measurement values.
- Note
- Function is not blocking. When new values are read the callback set by client will be executed in another thread.
◆ stopMeasurements()
template<uint32_t MaxParams>
Function stops reading of measurements values.
◆ ~MeasurementApi()
template<uint32_t MaxParams>
Destructor frees resources and stops event loop.