4#ifndef PROTOCORE_ENOCEAN_H
5#define PROTOCORE_ENOCEAN_H
44#define PROTOCORE_ERP_RORG_RPS 0xF6
45#define PROTOCORE_ERP_RORG_1BS 0xD5
46#define PROTOCORE_ERP_RORG_4BS 0xA5
47#define PROTOCORE_ERP_RORG_VLD 0xD2
48#define PROTOCORE_ERP_RORG_MSC 0xD1
49#define PROTOCORE_ERP_RORG_ADT 0xA6
50#define PROTOCORE_ERP_RORG_UTE 0xD4
88 uint8_t (*esp3_crc8)(uint8_t *,
const uint8_t *, uint16_t);
90 uint16_t (*esp3_build)(uint8_t *,
protocore_esp3_type,
const uint8_t *, uint16_t,
const uint8_t *, uint8_t,
93 uint16_t (*erp1_build)(uint8_t *, uint8_t *, uint16_t, uint8_t,
const uint8_t *, uint8_t, uint32_t, uint8_t);
127 const uint8_t *opt, uint8_t opt_len, uint8_t *out, uint16_t cap);
150 uint8_t payload_len, uint32_t sender_id, uint8_t status);
PROTO_ENUM_PACKED
Application protocol spoken on a listener port or connection slot.
uint16_t protocore_enocean_erp1_build(uint8_t *work, uint8_t *out, uint16_t cap, uint8_t rorg, const uint8_t *payload, uint8_t payload_len, uint32_t sender_id, uint8_t status)
Assemble an ERP1 radio telegram (the inverse of .
proto_bool protocore_enocean_erp1_parse(uint8_t *work, const uint8_t *data, uint16_t len, protocore_erp1 *out)
Decode an ERP1 radio telegram: RORG + payload + 4-octet sender id + .
uint8_t protocore_enocean_esp3_crc8(uint8_t *work, const uint8_t *buf, uint16_t len)
CRC-8 used by ESP3 (polynomial 0x07, MSB-first, init 0x00).
int protocore_enocean_esp3_parse(uint8_t *work, const uint8_t *raw, uint16_t len, protocore_esp3_packet *out)
Frame one ESP3 telegram from the front of raw.
enum PROTO_ENUM_PACKED protocore_esp3_type
ESP3 packet types (the common ones).
uint16_t protocore_enocean_esp3_build(uint8_t *work, protocore_esp3_type type, const uint8_t *data, uint16_t data_len, const uint8_t *opt, uint8_t opt_len, uint8_t *out, uint16_t cap)
Assemble an ESP3 telegram into out.
PROTOCORE_NS EnoceanNs Enocean PROTOCORE_UNUSED
Module namespace.
#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.
uint8_t(* esp3_crc8)(uint8_t *, const uint8_t *, uint16_t)
A decoded ERP1 radio telegram (the payload aliases the caller's buffer).
const uint8_t * payload
RORG-specific data, or nullptr if none.
uint8_t rorg
telegram type (PROTOCORE_ERP_RORG_*)
uint8_t status
status octet (repeater count + telegram-type bits)
uint32_t sender_id
4-octet sender id (big-endian)
uint8_t payload_len
payload octets (data length - 6)
A parsed ESP3 telegram (pointers alias the caller's buffer).
uint8_t opt_len
optional-data length
const uint8_t * data
data field
uint16_t data_len
data length
const uint8_t * opt
optional-data field
protocore_esp3_type type
packet type (protocore_esp3_type)
#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