|
openaliro
Aliro reader: UWB/CCC core and ESP32-S3/C5/C6 port
|
BLE protocol message framing: parse and build protocol/message_id headers and payloads; parse and extract Initiate Access, UWB control, Access Completed, and Reader Status Changed messages. More...
#include "ble_message.h"#include "tlv.h"#include <string.h>Functions | |
| int | woz_aliro_ble_build_message (uint8_t protocol, uint8_t message_id, const uint8_t *payload, size_t payload_length, uint8_t *output, size_t output_capacity, size_t *output_length) |
| Build a BLE protocol message with a given payload. | |
| static int | build_status (uint8_t message_id, uint8_t first, uint8_t reader_state, uint8_t output[8]) |
| Build a BLE Status message into an 8-byte array. | |
| int | woz_aliro_ble_build_reader_status_changed (uint8_t operation_source, uint8_t reader_state, uint8_t output[8]) |
| Build an 8-byte unencrypted BLE Reader Status Changed notification with operation_source and reader_state; return 0 on success, -1 on error. | |
BLE protocol message framing: parse and build protocol/message_id headers and payloads; parse and extract Initiate Access, UWB control, Access Completed, and Reader Status Changed messages.
|
static |
Build a BLE Status message into an 8-byte array.
Output is always 8 bytes when successful. Encodes protocol/message_id header, attribute ID 0 (State/Reader Information), and two state bytes (first and reader_state); output capacity must be >= 8 bytes.
| int woz_aliro_ble_build_message | ( | uint8_t | protocol, |
| uint8_t | message_id, | ||
| const uint8_t * | payload, | ||
| size_t | payload_length, | ||
| uint8_t * | output, | ||
| size_t | output_capacity, | ||
| size_t * | output_length | ||
| ) |
Build a BLE protocol message with a given payload.
Output is header (4 bytes: protocol, message_id, payload length as big-endian uint16) followed by the payload. Caller must provide a buffer large enough for header + payload; protocol field must not set bits 7-6. Payload must be 1–65535 bytes.