Characteristics¶
AVSS defines four GATT characteristics: Control Point for command and control, Report for transferring sensor measurements, Program for firmware upgrade, and Timesync Config for configuring the time-synchronization feature.
Control Point¶
Characteristic Behaviour¶
The Control Point is used to exchange comands and responses between device and client. The client sends commands by writing to the Control Point, and the device responds by indicating the Control Point.
The device handles and responds to commands synchronously, meaning the client must wait for the response before issuing a new command.
Each command receives a single response. Some commands define responses specific to that command, which are detailed in their respective sections. Any command may return a generic Response message in addition to its specified response type.
Characteristic Format¶
Messages on the Control Point consist of an opcode indicating the type of command or response followed by an opcode-specific payload of variable size. Most payloads are CBOR-encoded.
The table below details the byte layout of the Control Point characteristic.
Byte Position |
Field |
Description |
|---|---|---|
0 |
Opcode |
A single byte indicating the type of command or response. |
1-N |
Payload |
Data specific to the opcode. Typically a CBOR-encoded object with a structure that varies based on the opcode. |
Report¶
Characteristic Behaviour¶
The Report characteristic transfers sensor measurements from the device, via notifications on the characteristic.
The size of a report can exceed the maximum transmission unit, so each notification contains a report segment with a minimal header, allowing the client to assemble and decode the complete report.
Report Segment Data Format¶
The value of a Report characteristic notification is a report segment. This segment consists of a single-byte header followed by a variable number of payload bytes. To form a complete report, the payloads of all related segments must be concatenated in the correct order.
Report Segment Byte Layout¶
The table below illustrates the byte layout of a report segment, detailing the structure of the header and payload.
Byte Position |
Field |
Description |
|---|---|---|
0 |
Header |
Contains bitfields for sequence number, first segment indicator, and last segment indicator. |
1-N |
Payload |
Variable-length data that forms part of the complete report when concatenated with other payloads. |
Header Byte Bitfield Layout¶
The table below illustrates the layout of the bitfields in the header byte.
Bit Position |
Field |
Description |
|---|---|---|
0-5 |
Sequence Number |
Contains a sequence number for the segment. |
6 |
First |
Indicates if the segment is the first one in a report. |
7 |
Last |
Indicates if the segment is the last one in a report. |
Report Data Format¶
A fully assembled report consists of two fields: a single byte marking the report type and a CBOR-encoded object whose format depends on the report type. Below is a table detailing the byte layout of these fields:
Report Byte Layout¶
Byte Position |
Field |
Description |
|---|---|---|
0 |
Report Type |
A single byte indicating the type of the report. See List of Report Types. |
1-N |
Report Data |
A CBOR-encoded object containing the report data, with a structure that varies based on the Report Type. |
Program¶
[TBD]
Timesync Config¶
[TBD]