nRF51 SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
0x50 - BLE_GATTS_EVT_WRITE

Event packet encoding

Frame format encoding of the BLE_GATTS_EVT_WRITE packet.

Event ID = 0x50 for BLE_GATTS_EVT_WRITE

All BLE Events, ble_evt_t, are encoded with the header ble_evt_hdr_t first, containing only the 'Event ID', followed by the event. The 'Event Length' will not be encoded as the size of the event could be of different sizes depending on decoder architecture.

The BLE GAP event contains a connection handle, and for the BLE GATTS Write event, the ble_gatts_evt_write_t is encoded after connection handle as seen in Figure 2.

The order of the encoding is:

- 2 bytes: Connection Handle
- 2 bytes: Attribute Handle
- 1 byte: Write Operation
- 2 bytes: Service UUID
- 1 byte: Service UUID Type
- 2 bytes: Char UUID
- 1 byte: Char UUID Type
- 2 bytes: Desc UUID
- 1 byte: Desc UUID Type
- 2 bytes: Service Handle
- 2 bytes: Value Handle
- 1 byte: Attribute Type
- 2 bytes: Offset
- 2 bytes: Data Length
- 0...'Data Length' bytes: Data

Encoding of GATTS Write event

event_gatts_write_packet.png
Figure 1: Encoding of GATTS Write event.

Encoding of Context

event_gatts_write_packet_context.png
Figure 2: Encoding of Context inside a GATTS Write event.