nRF51 SDK - S120 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
BLE S120 GATTS Events

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, because the size of the event could differ depending on the decoder architecture.

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

The order of the encoding is:

Length Parameter Value
2 bytes Connection Handle See ble_gatts_evt_t::conn_handle
2 bytes Attribute Handle See ble_gatts_evt_write_t::handle
1 byte Write Operation See ble_gatts_evt_write_t::op
2 bytes Service UUID UUID value
1 byte Service UUID Type UUID type
2 bytes Char UUID Characteristic UUID if applicable
1 byte Char UUID Type Characteristic UUID type if applicable (BLE_UUID_TYPE_UNKNOWN if N/A)
2 bytes Desc UUID Descriptor UUID if applicable
1 byte Desc UUID Type Descriptor UUID type if applicable (BLE_UUID_TYPE_UNKNOWN if N/A)
2 bytes Service Handle Handle value
2 bytes Value Handle Characteristic handle if applicable (BLE_GATT_HANDLE_INVALID if N/A)
1 byte Attribute Type See GATT Server Attribute Types
2 bytes Offset See ble_gatts_evt_write_t::offset
2 bytes Data Length See ble_gatts_evt_write_t::len
0...'Data Length' bytes Data See ble_gatts_evt_write_t::data
2 bytes User Memory Block Length See ble_user_mem_block_t::len
0...'User Memory Block Length' bytes User Memory Block See ble_user_mem_block_t::p_mem


The fields 'User Memory Block Length' and 'User Memory Block' are conditional based on the 'Write Operation' field and if the context corresponding to a given connection handle was found.

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.


0x51 - BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST

Event packet encoding

Frame format encoding of the BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST packet.

Event ID = 0x51 for BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST

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, because the size of the event could differ depending on the decoder architecture.

The BLE GAP event contains a connection handle. For the BLE GATTS RW Authorize Request event, the ble_gatts_evt_rw_authorize_request_t is encoded after the connection handle, as seen in Figure 1 and Figure 2.

The order of the encoding for read authorization is:

Length Parameter Value
2 bytes Connection Handle See ble_gatts_evt_t::conn_handle
1 byte Authorization Type See ble_gatts_evt_rw_authorize_request_t::type
2 bytes Attribute Handle See ble_gatts_evt_read_t::handle
2 bytes Service UUID UUID value
1 byte Service UUID Type UUID type
2 bytes Char UUID Characteristic UUID if applicable
1 byte Char UUID Type Characteristic UUID type if applicable (BLE_UUID_TYPE_UNKNOWN if N/A)
2 bytes Desc UUID Descriptor UUID if applicable
1 byte Desc UUID Type Descriptor UUID type if applicable (BLE_UUID_TYPE_UNKNOWN if N/A)
2 bytes Service Handle Handle value
2 bytes Value Handle Characteristic handle if applicable (BLE_GATT_HANDLE_INVALID if N/A)
1 byte Attribute Type See GATT Server Attribute Types
2 bytes Offset Offset for the write operation


The order of the encoding for write authorization is:

Length Parameter Value
2 bytes Connection Handle See ble_gatts_evt_t::conn_handle
1 byte Authorization Type See ble_gatts_evt_rw_authorize_request_t::type
2 bytes Attribute Handle See ble_gatts_evt_write_t::handle
1 byte Write Operation Type of write operation, see GATT Server Operations
2 bytes Service UUID UUID value
1 byte Service UUID Type UUID type
2 bytes Char UUID Characteristic UUID if applicable
1 byte Char UUID Type Characteristic UUID type if applicable (BLE_UUID_TYPE_UNKNOWN if N/A)
2 bytes Desc UUID Descriptor UUID if applicable
1 byte Desc UUID Type Descriptor UUID type if applicable (BLE_UUID_TYPE_UNKNOWN if N/A)
2 bytes Service Handle Handle value
2 bytes Value Handle Characteristic handle if applicable (BLE_GATT_HANDLE_INVALID if N/A)
1 byte Attribute Type See GATT Server Attribute Types
2 bytes Offset Offset for the write operation
2 bytes Data Length Length of the incoming data
0...'Data Length' bytes Data Incoming data, variable length
2 bytes User Memory Block Length See ble_user_mem_block_t::len
0...'User Memory Block Length' bytes User Memory Block See ble_user_mem_block_t::p_mem


The fields 'User Memory Block Length' and 'User Memory Block' are conditional based on the 'Authorization Type' and 'Write Operation' fields and if the context corresponding to a given connection handle was found.

Encoding of GATTS RW Authorize Request event - Read

gatts_event_rw_authorize_request_dec_read.png
Figure 1: Encoding of GATTS RW Authorize Request event.


Encoding of GATTS RW Authorize Request event - Write

gatts_event_rw_authorize_request_dec_write.png
Figure 2: Encoding of GATTS RW Authorize Request event.


Encoding of Attribute Context

event_gatts_write_packet_context.png
Figure 3: Encoding of Context inside a GATTS RW Authorize Request event.


0x52 - BLE_GATTS_EVT_SYS_ATTR_MISSING

Event packet encoding

Frame format encoding of the BLE_GATTS_EVT_SYS_ATTR_MISSING packet.

Event ID = 0x52 for BLE_GATTS_EVT_SYS_ATTR_MISSING

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, because the size of the event could differ depending on the decoder architecture.

The BLE GATTS event contains a connection handle. For the BLE GATTS System Attributes Missing event, the ble_gatts_evt_sys_attr_missing_t is encoded after the connection handle, as seen in Figure 1.

The order of the encoding is:

Length Parameter Value
2 bytes Connection Handle See ble_gatts_evt_t::conn_handle
1 byte Hint See ble_gatts_evt_sys_attr_missing_t::hint


Encoding of GATTS System Attributes Missing event

event_sys_attr_missing.png
Figure 1: Encoding of GATTS System Attributes Missing event.


0x53 - BLE_GATTS_EVT_HVC

Event packet encoding

Frame format encoding of the BLE_GATTS_EVT_HVC packet.

Event ID = 0x53 for BLE_GATTS_EVT_HVC

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, because the size of the event could differ depending on the decoder architecture.

The BLE GATTS event contains a connection handle. For the BLE GATTS HVC event, the ble_gatts_evt_hvc_t is encoded after the connection handle, as seen in Figure 1.

The order of the encoding is:

Length Parameter Value
2 bytes Connection Handle See ble_gatts_evt_t::conn_handle
2 bytes Attribute Handle See ble_gatts_evt_hvc_t::handle


Encoding of BLE GATTS HVC event

gatts_event_hvc.png
Figure 1: Encoding of BLE GATTS HVC event.


0x54 - BLE_GATTS_EVT_SC_CONFIRM

Event packet encoding

Frame format encoding of the BLE_GATTS_EVT_SC_CONFIRM packet.

Event ID = 0x54 for BLE_GATTS_EVT_SC_CONFIRM

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, because the size of the event could differ depending on the decoder architecture.

The BLE_GATTS_EVT_SC_CONFIRM event is encoded in the following order (also presented in Figure 1):

Length Parameter Value
2 bytes Connection Handle See ble_gatts_evt_t::conn_handle


Encoding of BLE GATTS SC Confirm event

event_gatts_evt_sc_confirm.png
Figure 1: Encoding of BLE GATTS SC Confirm event.


0x55 - BLE_GATTS_EVT_TIMEOUT

Event packet encoding

Frame format encoding of the BLE_GATTS_EVT_TIMEOUT packet.

Event ID = 0x55 for BLE_GATTS_EVT_TIMEOUT

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, because the size of the event could differ depending on the decoder architecture.

The BLE GATTS event contains a connection handle. For the BLE GATTS Timeout event, the ble_gatts_evt_timeout_t is encoded after the connection handle, as seen in Figure 1.

The order of the encoding is:

Length Parameter Value
2 bytes Connection Handle See ble_gatts_evt_t::conn_handle
1 byte Timeout Source See ble_gatts_evt_timeout_t::src


Encoding of BLE GATTS Timeout event

gatts_event_timeout.png
Figure 1: Encoding of BLE GATTS Timeout event.