Monitors Implementation
Heex provides a Monitor
class that will be instancianted in your implementations to monitor the dataflow of your edge system.
The Monitor class is a generic class that can be used to monitor severals type of dataflows like boolean, string, float, integers, geographic, etc.
Do you happen to have a use case that is not covered by our ready-to-use classes ? Don’t worry, just contact us at contact@heex.io and we will work with you to provide a custom class.
Monitor Build
To integrate monitors and recorders in your project you have to build with Heex libraries. See HeexSDK integration for details.
Monitor main APIs
→ Monitor(id, serverIp, serverPort)
- Id : Monitor implementation ID, that can be retrieved on the Heex Cloud
- serverIp : IP address to contact Heex Kernel
- serverPort : Port to contact Heex Kernel
→ awaitReady() : To wait until the monitor is ready to receive data. Please ensure this function returns True before continuing.
→ updateValue(inputValue) : To update the in-memory value of your signal, and communicate with the Heex Kernel when the conditions set on the Heex Cloud are met.
→ updateValue(inputValue, timestamp) : Call updateValue with the timestamp in the form of a string.
→ updateValueBySignalName(inputValue, timestamp, signalName) : Call updateValue but only for the signal with the specified name.
These APIs are template functions, so you can use them with any type of dataflow, in particular:
- bool : boolean dataflow
- int, uint, short, long : integer dataflow
- float, double : float dataflow
- string, char* : string dataflow
- HeexGps : geographic dataflow
Monitor implementation
Let’s write a small example. The Monitor can monitor a speed dataflow in a range.
You have to include Monitor.h
Then, instantiation is done calling the constructor:
Using the awaitReady()
allows to wait until your monitor establishes a connection with the Heex Kernel.
The monitor will detect events based on the values that are sent to it, so you should call updateValue()
method with the value of your signal. It could be at regular time intervals or when the signal changes. This is highly dependant to your edge system.
To do that, use the following code:
💡 Tip: 🎉 CONGRATULATIONS!
This is it!
You don’t need to care about the bounds set in the Heex Cloud when specifying the trigger. All the checking will occur behind the scene and the Heex Agent will take care of detecting when matching conditions are met to trigger events.
ℹ️ Info: timestamp
It is recommended to call
UpdateValue
method, giving as second argument the exact timestamp of your signal value formatted in ISO 8601-1:2019. Otherwise the current system time is applied by default to your signal value.
For more information go to Timestamp Formatting page.
Monitor Samples
You can check the samples here.