updateValue
method to supply the value we want to track and do the check.
ValueConfiguration
are read by the agent Kernel
from the systemConf.json
file and stored until a agent (Monitor or Recorder) connects to the agent Kernel
.
Identification
, 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:
ValueConfigurationDouble
to store a double.ValueConfigurationString
to store a string.ValueConfigurationDoubleInterval
to store an interval of double.ValueConfigurationBoolean
to store a boolean.ValueConfigurationThreshold
to store a custom object representing a comparison to a value.ValueConfigurationZone
to store a zone from a map.ValueConfiguration
to store a more complex value.
The handleValueConfiguration
method is given two arguments:
cmd
is the full configuration command received by the agent.header
is the same command but pre-parsed with the following variable :
valid
A boolean at true if the command was formatted the right way. False otherwise.uuid
Agent UUID.cvUuid
The UUID of the configuration value that is associated with the value.name
Name of the configuration value.type
Type of value that should be used by Agents to determine how to handle the value.params
The unparsed value to be handled by the Agent.ValueConfiguration
object returned by handleValueConfiguration
is then added into the Agent variable _valueConfigurations
.
handleValueConfiguration
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 :
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.sampleMonitorValueConf
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.handleValueConfiguration
that is called when receiving a value configuration from the agent Kernel
.
handleValueConfiguration
, it only prints the value configuration.D-UUID
, sends the signal with CV-UUID
and stops.
sampleIntervalMonitor
demonstrates how to create a Configurable-by-Value Monitor that notifies the core of an event of interest for the speed-interval
field name.speed-interval
configurable-by-value named conditions and uses the CV-UUID
provided by agent Kernel
in system configuration during its exchanges.signalOn()
or signalOff()
with the CV-UUID
sampleRecorderValueConf
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.
camera
configurable-by-value.R-UUID
.SV-UUID
.