Skip to content
Alex Robenko edited this page Sep 1, 2024 · 3 revisions

MQTT-SN Client Filter Plugin for the CommsChampion Tools

As a prerequisite please read How to Use CommsChampion Tools wiki page first.

Plugin Configuration

The CC MQTT-SN Client Filter plugin is expected to be listed in the "Filter" list of the available plugins.

image: available mqttsn filter plugin

Select socket such as "CC UDP/IP Socket" and configure it accordingly. The MQTT-SN filter plugin is also expected to be configured as needed.

image: udp config

To enable reception of the messages the MQTT-SN protocol requires subscription to relevant topics. To do so click on "Add Subscribe" button and fill in subscription details. Note that it is possible to configure either topic string or pre-defined topic ID.

image: subscribe config

When the CommsChampion Tools are going to be used to publish messages to the gateway as well then there is a need to provide publish topic / QoS configuration. The plugin configuration allows setting the default values. Similar to subscription it is possible to update either topic string or predefined topic ID.

image: publish config

Connecting

When the plugins are applied there is a need to connect the UPD/IP socket to the gateway.

image: connect socket

When the socket is connected the filter plugin sends appropriate CONNECT AND SUBSCRIBE MQTT-SN messages in the background to allow the reception of the messages. If no error pop-up message appeared then the connection is established and the tool is ready to send / receive messages.

Any messages that the gateway sends to the tool get processed by the filter and the payload is delivered to the protocol plugin for processing. As the result the reported protocol messages get displayed in the "All Messages" area.

Publishing

The CommsChampion Tools allow selection and configuration of the application protocol message to be sent.

image: publish preparation

When the message is sent, it can be viewed in the "All Messages" area. When selected and the "Extra Info" display is chosen, the used MQTT-SN publish topic and QoS values can be viewed.

image: publish info

It is possible to override the default configuration of the message to be sent out by preparing the JSON object of the "Extra Info" using just properties than need to be overridden. To override the default publish topic use mqttsn.topic property. To override default publish topic ID use mqttsn.topic_id property. To override the default publish QoS value, use mqttsn.qos property.

image: publish override

The result of the overriding can be visible when viewing the details of the sent message

image: publish override result

There are some other overrides possible. To send the retained message use mqttsn.retained property:

{
    "mqttsn.retained": true
}

In general, the tooltip of the filter plugin contains a list of supported message overriding properties that can be used to apply custom configuration on outgoing message.

image: publish override tooltip

Handling Topics Containing Protocol Message ID

The MQTT-SN Client Filter Plugin communicates only message payload to the protocol plugin. In cases that some topic element contains the message ID, there is a need to implement a separate filter plugin which will analyse the reported topic from the message properties and will modify the raw data forwarded to the protocol plugin accordingly (such as prefixing it with the appropriate numeric message ID).

In the opposite direction (sending the message) such filter plugin will have to strip the message ID prefix from the raw data received from the protocol plugin before forwarding it to the MQTT-SN Client Filter Plugin and set the mqttsn.topic property to the appropriate value.