plugin
0.1.0
|
The available templates are:
template_source.cpp
for implementing source pluginstemplate_sink.cpp
for implementing sink pluginstemplate_filter.cpp
for implementing filter pluginsUse these files as a starting point for your own plugins.
The followings are example plugins of little practucalu use, but they are good for learning the basics of plugin development.
clock
: a source that provides clock valuesechoj
: a filter that echoes the input messagerandom
: a source that provides random valuesto_console
: a sink that prints the input message to the consoletwice
: a filter that duplicates the input messageThis acts as a source plugin, which reads messages from an MQTT broker and sends them to the MADS broker.
Note that the plugin only subscribes to the topic as specified in the configuration file and does not publish any messages.
The frequency of messages depends on when they are received from the MQTT broker. The plugin will send the messages to the MADS broker as soon as they are received.
The accepted parameters are:
The MQTT broker must be running on the same address that has been set into the Siemens MindSphere settings. The root publishing topic (e.g. capture
) is defined in the settings of the Siemens MindSphere application, while each acquisition procedure defined in the Edge internal webapp will append a unique identifier to the root topic (e.g. capture/mads
). So, you typically want to subscribe to capture/#
to get all the messages.
This acts as a source plugin, which reads messages from a serial port (typically connected to an Arduino) and sends them to the MADS broker.
The frequency of messages depends on the configuration of the Arduino board. The plugin will send the messages to the MADS broker as soon as they are received from the Arduino board. In turn, this frequency can be set in the configuration file (cfg_cmd
parameter).
The accepted parameters are:
The cfg_cmd
parameter is used to configure the Arduino board. The default value is 40p
, which sets the Arduino board to send a message every 40 ms.
This acts as a filter plugin, which calculates the running average of the input values.
The accepted parameters are:
It searches for a field in the message payload having the name specified in the field
parameter. the data field must be a dictionary. of numerical values, e.g.:
The plugin will calculate the average of all the values in the dictionary and store it in a new field, whose name is specified in the out_field
parameter: