Modbus

// typedefs

typedef io.ModbusWriteSingleParams io.ModbusWriteSingleReplyParams;
typedef io.ModbusReadReplyParams io.ModbusReadWriteFileRecordParams;
typedef io.ModbusReadReplyPdu io.ModbusReadWriteFileRecordPdu;
typedef io.ModbusMaskWriteParams io.ModbusMaskWriteReplyParams;
typedef io.ModbusReadReplyParams io.ModbusReadWriteMultipleRegistersReplyParams;
typedef io.ModbusReadReplyParams io.ModbusReportServerIdReplyParams;
typedef io.ModbusWriteSinglePdu io.ModbusWriteSingleReplyPdu;
typedef io.ModbusMaskWritePdu io.ModbusMaskWriteReplyPdu;
typedef io.ModbusReadReplyPdu io.ModbusReadWriteMultipleRegistersReplyPdu;

// enums

enum io.ModbusChecksumKind;
enum io.ModbusDiagnosticSubFunc;
enum io.ModbusException;
enum io.ModbusFunc;
enum io.ModbusProtocol;
enum io.ModbusRole;

// structs

struct io.ModbusBitBank;
struct io.ModbusDiagnosticsParams;
struct io.ModbusExceptionParams;
struct io.ModbusExceptionPdu;
struct io.ModbusFileRecord;
struct io.ModbusGetCommEventCounterReplyParams;
struct io.ModbusGetCommEventCounterReplyPdu;
struct io.ModbusGetCommEventLogReplyParams;
struct io.ModbusGetCommEventLogReplyPdu;
struct io.ModbusMaskWriteParams;
struct io.ModbusMaskWritePdu;
struct io.ModbusPduHdr;
struct io.ModbusReadExceptionStatusReplyParams;
struct io.ModbusReadExceptionStatusReplyPdu;
struct io.ModbusReadFifoQueueParams;
struct io.ModbusReadFifoQueuePdu;
struct io.ModbusReadFifoQueueReplyParams;
struct io.ModbusReadFifoQueueReplyPdu;
struct io.ModbusReadFileRecordReply;
struct io.ModbusReadParams;
struct io.ModbusReadPdu;
struct io.ModbusReadReplyParams;
struct io.ModbusReadReplyPdu;
struct io.ModbusReadWriteMultipleRegistersParams;
struct io.ModbusReadWriteMultipleRegistersPdu;
struct io.ModbusReplyPduHdr;
struct io.ModbusRtuAduHdr;
struct io.ModbusRtuAduPduHdr;
struct io.ModbusRtuCrc;
struct io.ModbusTcpAduHdr;
struct io.ModbusTcpAduPduHdr;
struct io.ModbusWriteMultipleCoilsParams;
struct io.ModbusWriteMultipleParams;
struct io.ModbusWriteMultiplePdu;
struct io.ModbusWriteMultipleRegistersParams;
struct io.ModbusWriteMultipleReplyParams;
struct io.ModbusWriteMultipleReplyPdu;
struct io.ModbusWriteSingleParams;
struct io.ModbusWriteSinglePdu;

// global functions

void io.layoutModbusRegisters(
    jnc.DynamicLayout* layout,
    size_t count,
    size_t size
);

void async io.layoutModbusPdu(
    jnc.DynamicLayout* layout,
    io.ModbusRole role
);

void io.appendModbusPduDigest(
    std.StringBuilder* digest,
    void const* p,
    size_t size,
    io.ModbusRole role
);

uint16_t io.crc16_modbus(
    void const* p,
    size_t size
);

string_t io.getModbusChecksumValidityString(bool isValid);
string_t io.formatModbusRtuCrc(void const* p);
string_t io.formatModbusAsciiLrc(void const* p);

void async io.layoutModbusAdu(
    jnc.DynamicLayout* layout,
    io.ModbusProtocol protocol,
    io.ModbusRole role
);

string_t io.getModbusAduDigest(
    void const* p,
    size_t size,
    jnc.ModuleItemDecl* decl
);

string_t io.getModbusRegisterDigest(
    void const* p0,
    size_t size
);

string_t io.getModbusBitDigest(
    void const* p,
    size_t size
);