Usage
These classes can be directly used in the main method of your custom monitor. They provide anupdateValue method to supply the value we want to track and do the check.
Functional components
Origin of ValueConfigurations
AllValueConfiguration are read by the agent Kernel from the systemConf.json file and stored until a agent (Monitor or Recorder) connects to the agent Kernel.
Run-time
UponIdentification, the agent receives a ValueConfiguration message and has to parse it.
To do so, any Agent in need of value configuration should implement the method handleValueConfiguration
This method should return a pointer on an object inheriting from ValueConfiguration to store the value received in the command.
We provide a small collection of ValueConfiguration classes:
ValueConfigurationDoubleto store a double.ValueConfigurationStringto store a string.ValueConfigurationDoubleIntervalto store an interval of double.ValueConfigurationBooleanto store a boolean.ValueConfigurationThresholdto store a custom object representing a comparison to a value.ValueConfigurationZoneto store a zone from a map.
ValueConfiguration to store a more complex value.
The handleValueConfiguration method is given two arguments:
cmdis the full configuration command received by the agent.headeris the same command but pre-parsed with the following variable :validA boolean at true if the command was formatted the right way. False otherwise.uuidAgent UUID.cvUuidThe UUID of the configuration value that is associated with the value.nameName of the configuration value.typeType of value that should be used by Agents to determine how to handle the value.paramsThe unparsed value to be handled by the Agent.
ValueConfiguration object returned by handleValueConfiguration is then added into the Agent variable _valueConfigurations.
Sample of handleValueConfiguration
SeehandleValueConfiguration method in sampleIntervalMonitor.cpp:
header.type is “interval” as this Agent needs speed interval configuration.
Then we instantiate the appropriate ValueConfigurationDoubleInterval that will parse the value contained inside the header.params.
If our value configuration is valid we can return it so the agent can now use it.
Otherwise, we return nullptr.
You can now use those configurations while using your Agent :
- monitors
- recorders
You can create a method in your Monitor to determine if the Dataflow you are monitoring activate or not your Monitor.See Here we browse all When you decide the condition is no longer met, you can call
void updateValue(double inputValue) method in sampleIntervalMonitor.cpp:_valueConfigurations list and check the name to be sure it is a “interval” as our Monitor only takes intervals.We cast the ValueConfiguration in the right type (here ValueConfigurationDoubleInterval) and check the pointer is not null.From here we have access to the values of the ValueConfigurationDoubleInterval via its methods getLowValue() and getHighValue().Then we check if the given inputValue is inside one interval of a valueConfiguration. If true, it calls signalOn giving the timestamp and the uuid of the valueConfiguration (CV-XXXXX) :signalOff giving the same arguments.Samples
Here are the descriptions of our different value configurable samples:SampleMonitorValueConf
ThesampleMonitorValueConf also demonstrates a simple usage of the monitor to notify the core of an event of interest (eg. boolean transition from true to false) using the signalOnOff() method.But it overrides the Agent’s method
handleValueConfiguration that is called when receiving a value configuration from the agent Kernel.
- The sample’s implementation of
handleValueConfiguration, it only prints the value configuration. - The sample is designed to work with any configurable-by-value conditions.
D-UUID, sends the signal with CV-UUID and stops.
SampleIntervalMonitor
ThesampleIntervalMonitor demonstrates how to create a Configurable-by-Value Monitor that notifies the core of an event of interest for the speed-interval field name.This is the perfect sample to understand the Configurable-by-Value feature.
- The sample is designed to work only with
speed-intervalconfigurable-by-value named conditions and uses theCV-UUIDprovided byagent Kernelin system configuration during its exchanges. - This sample manages a state machine for every ValueConfiguration interval and change its state whenever the speed value gets in and out the interval. Once initialized, it runs as follows:
- A new speed is generated every second
- The method updateValue(speed) is called whenever a new speed is received
- It determine if the new value of speed change of state of any ValueConfiguratiion currently managed, eg. gets in and out the speed-interval passed as ValueConfiguration
- It notifies the Core of a state change calling either
signalOn()orsignalOff()with theCV-UUID
sampleRecorderValueConf
ThesampleRecorderValueConf demonstrates how to create a Configurable-by-Value Recorder that generates a file with different content based on the ValueConfiguration it is called upon in the event query.
- This sample requires this Recorder to be defined as Configurable-by-value in the configuration on Heex Cloud.
- This sample is designed to work with
cameraconfigurable-by-value.
- The recorder gets initialized, connects to Core with
R-UUID. - Then it exposes the Context Values and Event Recording Part generation to the Core for identifiers
SV-UUID. - It stops only on SIGKILL (Ctrl-C).