4#ifndef PROTOCORE_ZWAVE_H
5#define PROTOCORE_ZWAVE_H
60 uint16_t (*build_frame)(uint8_t *,
protocore_zwave_type, uint8_t,
const uint8_t *, uint8_t, uint8_t *, uint16_t);
61 int (*parse_frame)(uint8_t *,
const uint8_t *, uint16_t, uint8_t *, uint8_t *,
const uint8_t **, uint8_t *);
65 uint16_t (*build_ack)(uint8_t *, uint8_t *, uint16_t);
81 uint8_t data_len, uint8_t *out, uint16_t cap);
94 const uint8_t **pdata, uint8_t *pdata_len);
PROTO_ENUM_PACKED
Application protocol spoken on a listener port or connection slot.
#define PROTOCORE_NS_LAYOUT(T,...)
Pin every dispatch slot of a table that is nothing but function pointers.
#define PROTOCORE_NS
Storage for a dispatch table. The const is load bearing.
Dispatch table. Addressed by offset, so the layout is asserted below.
uint16_t(* build_frame)(uint8_t *, protocore_zwave_type, uint8_t, const uint8_t *, uint8_t, uint8_t *, uint16_t)
#define PROTOCORE_BEGIN_DECLS
Give a header's declarations C linkage, so their symbol names carry no parameter types.
_Bool proto_bool
The truth value.
#define PROTOCORE_END_DECLS
proto_bool protocore_zwave_is_nak(uint8_t *work, uint8_t b)
True if b is the NAK control byte.
uint16_t protocore_zwave_build_frame(uint8_t *work, protocore_zwave_type type, uint8_t cmd, const uint8_t *data, uint8_t data_len, uint8_t *out, uint16_t cap)
Assemble a data frame carrying type + cmd + data into out.
enum PROTO_ENUM_PACKED protocore_zwave_type
Data-frame type.
int protocore_zwave_parse_frame(uint8_t *work, const uint8_t *raw, uint16_t len, uint8_t *type, uint8_t *cmd, const uint8_t **pdata, uint8_t *pdata_len)
Frame one data frame from the front of raw and verify the checksum.
proto_bool protocore_zwave_is_ack(uint8_t *work, uint8_t b)
True if b is the ACK control byte.
PROTOCORE_NS ZwaveNs Zwave PROTOCORE_UNUSED
Module namespace.
uint16_t protocore_zwave_build_ack(uint8_t *work, uint8_t *out, uint16_t cap)
Write the single ACK byte into out. 1, or 0 if cap < 1.
proto_bool protocore_zwave_is_can(uint8_t *work, uint8_t b)
True if b is the CAN control byte.