modbus_codec 0.1.1
modbus_codec: ^0.1.1 copied to clipboard
Transport-agnostic Modbus RTU codec for Dart. Encode request frames and decode raw response bytes into typed values over BLE, serial, or TCP.
0.1.1 #
- Input validation for
slaveId,address, and quantity limits on all function codes. ReadBitsResponsenow returns allbyteCount * 8bits; caller slices to request quantity.- Decoder throws
ModbusFrameExceptionon malformed frames instead of crashing. ModbusConvertguards for non-ASCII input, negative scale factor, andpadToRegistersoverflow.
0.1.0 #
Initial release.
ModbusEncoderfor building RTU request frames: read coils / discrete inputs / holding registers / input registers (FC 01–04), and write single & multiple coils / registers (FC 05, 06, 15, 16).ModbusDecoderfor parsing RTU response bytes into typed responses (ReadRegistersResponse,ReadBitsResponse,WriteSingleResponse,WriteMultipleResponse), with optional CRC validation.Crc16Modbus— CRC-16/MODBUS compute, byte generation, and validation.ModbusConverthelpers: signed 16/32-bit, 32-bit register pairing with selectable word order, fixed-point scaling, and packed-ASCII encode/decode.ModbusDeviceException/ModbusFrameExceptionfor device-reported errors and malformed frames.- Zero runtime dependencies; pure Dart.