nRF51 SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
0x18 - BLE_GAP_EVT_CONN_SEC_UPDATE

Event packet encoding

Frame format encoding of the BLE_GAP_EVT_CONN_SEC_UPDATE packet.

Event ID = 0x18 for BLE_GAP_EVT_CONN_SEC_UPDATE

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 GAP Security Info Request event, the ble_gap_evt_conn_sec_update_t is encoded after connection handle as seen in Figure 1.

The security mode and level are both bitfields inside 1 byte as seen in Figure 2.

The order of the encoding is:

- 2 bytes: Connection Handle
- 1 byte: (See Figure 2)
- 4 bits: Security mode (sm)
- 4 bits: Level (lv)
- 1 byte: Encryption key size

Encoding of GAP Connection Security Updated event

event_conn_sec_update_packet.png
Figure 1: Encoding of GAP Connection Security Updated event.

Encoding of Security mode and Level

event_conn_sec_update_sec_mode.png
Figure 2: Encoding of Security mode and Level inside a GAP Connection Security Updated event.