Skip to content

Protocol management ​

1. Protocol Management Module ​

Version 2.0 adds a protocol management module to manage hardware device protocols, as shown below:

fastbee-protocol-base: the protocol parsing base module. This module is the core module that implements decoding and encoding through annotations; users do not need to care about how it is implemented.

fastbee-protocol-collect: the protocol collection module, which currently bundles decoding and encoding for JSON, modbus-rtu, and the encapsulated modbus-rtu.

Protocol management module page screenshot

2. Protocol Definition ​

Displayed on the frontend as shown below:
Protocol definition page screenshot

If you need to add a protocol in the protocol management module, the system implements it through annotations. The annotation is defined as follows:
Protocol definition page screenshot

Below is an example of adding code for the modbus-rtu protocol:

The fields are explained as follows:

  1. name: the protocol name
  2. protocolCode: the protocol code, used by the system to identify the protocol and associate it with products; one product corresponds to one protocol code.
  3. description: the protocol description (optional)
Protocol definition page screenshot

When a device has data to decode or encode, the device matches a protocol in the system based on the protocol code in the product, and uses that protocol for decoding and encoding.

A defined decoding example is as follows:
The class that actually performs decoding is: ModbusMessageDecoder
Protocol definition page screenshot

A defined encoding example is as follows:
The class that actually performs encoding is: ModbusMessageEncoder
Protocol definition page screenshot

3. Annotation-Based Protocol Decoding and Encoding ​

The platform encapsulates a base package for decoding and encoding hardware device messages through annotations, namely the fastbee-protocol-base module. For all kinds of hardware device messages, this annotation-based approach can be used to implement decoding and encoding,

reducing the tedious work of backend developers in message data decoding and encoding.

Field definitions of the @Column annotation:
Annotation-based protocol decoding and encoding screenshot

FastBee | fastbee.cn