bieli / IoText-data-protocol

Internet of Things data protocol - simplistic text and CSV-friendly IoT data protocol. Options: Schema-less, schema+versioning, building deltas for data values. Easy to re-use.
Apache License 2.0
0 stars 2 forks source link

CRC for message payload #26

Closed bieli closed 4 months ago

bieli commented 4 months ago

Description

We can use CRC16 from typical MODBUS implementation, next combine below fields with values:

and add optional field with calculated: c|<CRC>.

Example of IoText message without CRC:

t|123123123123,d|device_one,m|value:d=123.321

Example of IoText message with CRC as HEX number (this c field is optional!):

t|123123123123,d|device_one,m|value=d:123.321,c|4C5A

Why this is so important?

Sometimes in serial communication (RS-232, RS-485, and other) we have noise in transmission data (i.e. wrong bites). With this CRC implementation, we will be sure, that all message payload has original value.

bieli commented 4 months ago

Implementation in https://github.com/bieli/IoText-data-protocol/pull/27