Definition
If a device reports binary data, a codec must be developed for data format conversion. If a device reports JSON data, codec development is not required.
For example, in the NB-IoT scenario where devices communicate with the IoT platform using CoAP, the payload of the CoAP message is data at the application layer and the data type is defined by the device. As NB-IoT devices require low power consumption, data at the application layer is in binary format instead of JSON. However, the platform sends data in JSON format to applications. Therefore, codec development is required for the platform to convert data between binary and JSON formats.

Data Reporting

In the data reporting process, the codec is used in the following scenarios:
- Decoding binary data reported by a device into JSON data and sending the decoded data to an application
- Encoding JSON data returned by an application into binary data and sending the encoded data to a device
Command Delivery

In the command delivery process, the codec is used in the following scenarios:
- Encoding JSON data delivered by an application into binary data and sending the encoded data to a device
- Decoding binary data returned by a device into JSON data and reporting the decoded data to an application
Graphical Development and Offline Development
The platform provides three methods for developing codecs. Offline codec development is complex and time-consuming. Graphical codec development is recommended.
- Graphical development: The codec of a product can be quickly developed in a visualized manner on the IoTDA console.
- Offline development: A codec is developed through the secondary development based on the Java codec demo to implement encoding, decoding, packaging, and quality inspection.
- Script-based development: JavaScript scripts are used to implement encoding and decoding.
Last Article: Developing a Codec
Next Article: Graphical Development
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.