brilliant_device library

Classes

BrilliantDevice

Constants

haloReceiveBufferSize → const int
Default size in bytes of Halo's data receive queue (frame.bluetooth.receive_buffer_size() on the device)

Functions

bleWriteSize(int maxWrite) → int
Returns the largest ATT write value, at most maxWrite bytes, that exactly fills whole link-layer packets (251k - 7 bytes: 244, 495, ...). A write that overruns a packet boundary by a few bytes spends a whole extra packet of airtime on them. Returns maxWrite when not even one packet fits.
chunkLuaString(List<int> payload, int maxChunkBytes) → List<String>
Splits payload (the UTF-8 bytes of an escaped Lua string literal) into chunks of at most maxChunkBytes bytes, without splitting a multi-byte UTF-8 sequence or a Lua escape sequence across two chunks.
isDataAck(List<int> notification) → bool
Whether notification (as received on the RX characteristic, including its 0x01 data marker) is data.lua's per-packet ACK: 01 01 00 00, or 01 01 00 01 when the device failed to process the packet.