add reliable BLE telemetry transport
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define TRIKKE_BLE_FRAGMENT_HEADER_SIZE 8
|
||||
#define TRIKKE_BLE_ACK_SIZE 8
|
||||
|
||||
// BLE data notifications carry a little-endian packet sequence, byte offset,
|
||||
// total TRK1 frame size, then the frame bytes at that offset. The unchanged
|
||||
// TRK1 CRC remains the end-to-end integrity check after reassembly.
|
||||
size_t trikke_ble_encode_fragment(
|
||||
uint8_t *output,
|
||||
size_t output_size,
|
||||
const uint8_t *packet,
|
||||
size_t packet_size,
|
||||
size_t packet_offset,
|
||||
size_t att_payload_capacity);
|
||||
|
||||
// An application acknowledgement is ASCII "ACK1" followed by the exact
|
||||
// little-endian TRK1 packet sequence that the receiver persisted.
|
||||
bool trikke_ble_decode_ack(
|
||||
const uint8_t *ack,
|
||||
size_t ack_size,
|
||||
uint32_t *packet_sequence);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user