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

Table of Contents

0x10 - BLE_GAP_EVT_CONNECTED

Event packet encoding

Frame format encoding of the BLE_GAP_EVT_CONNECTED packet.

Event ID = 0x10 for BLE_GAP_EVT_CONNECTED.

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 GAP Connected event, the ble_gap_evt_connected_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_gap_evt_t::conn_handle
7 bytes Peer Address: ble_gap_addr_t (See Figure 2 for details on encoding)
7 bytes Own Address: ble_gap_addr_t (See Figure 2 for details on encoding)
1 byte Role: GAP Roles BLE role for this connection
1 byte Bitfields:
- IRK Index: 7 bits,
- IRK Match: 1 bit
(See Figure 3 for details on encoding)
8 bytes GAP Connection Parameters: ble_gap_conn_params_t (See Figure 4 for details on encoding)


Encoding of BLE GAP Event - Connected

event_connected_packet_S130.png
Figure 1: Encoding of BLE GAP Connected event.


Encoding of peer and own address

The own address is encoded the same way as the peer address.

event_connected_peer_addr_packet.png
Figure 2: Encoding of peer and own addresses inside the BLE GAP Connected event.


Encoding of IRK byte

event_connected_irk.png
Figure 3: Encoding of IRK byte inside BLE GAP Connected event.


Encoding of GAP Connection Parameters

event_connected_conn_param_packet.png
Figure 4: Encoding of GAP Connection Parameters inside the BLE GAP Connected event.


0x11 - BLE_GAP_EVT_DISCONNECTED

Event packet encoding

Frame format encoding of the BLE_GAP_EVT_DISCONNECTED packet.

Event ID = 0x11 for BLE_GAP_EVT_DISCONNECTED.

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 GAP Disconnected event, the ble_gap_evt_disconnected_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_gap_evt_t::conn_handle
1 byte Reason See ble_gap_evt_disconnected_t::reason


Encoding of BLE GAP Disconnected event

event_disconnected_packet.png
Figure 1: Encoding of BLE GAP Disconnected event.


0x12 - BLE_GAP_EVT_CONN_PARAM_UPDATE

Event packet encoding

Frame format encoding of the BLE_GAP_EVT_CONN_PARAM_UPDATE packet.

Event ID = 0x12 for BLE_GAP_EVT_CONN_PARAM_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, because the size of the event could differ depending on the decoder architecture.

The BLE GAP event contains a connection handle. For the BLE GAP Connect Parameter Update event, the ble_gap_evt_conn_param_update_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_gap_evt_t::conn_handle
8 bytes GAP Connection Parameters ble_gap_conn_params_t (See Figure 1 for details on encoding)


Encoding of GAP Connection Parameter Update event

event_conn_param_update.png
Figure 1: Encoding of GAP Connection Parameter Update event.


0x13 - BLE_GAP_EVT_SEC_PARAMS_REQUEST

Event packet encoding

Frame format encoding of the BLE_GAP_EVT_SEC_PARAMS_REQUEST packet.

Event ID = 0x13 for BLE_GAP_EVT_SEC_PARAMS_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, and for the BLE GAP Security Parameters Request event, the ble_gap_evt_sec_params_request_t is encoded after the connection handle, as seen in Figure 1.

The Bond, MITM, IO capabilities, and OOB fields are all bitfields inside 1 byte as seen in Figure 2.

The order of the encoding is:

Length Parameter Value
2 bytes Connection Handle See ble_gap_evt_t::conn_handle
1 byte Bitfields:
- Bond: 1 bit,
- MITM: 1 bit,
- IO Capabilities: 3 bits,
- OOB: 1 bit
(See Figure 2 for details on encoding)
1 byte Minimum Keysize See ble_gap_sec_params_t::min_key_size
1 byte Maximum Keysize See ble_gap_sec_params_t::max_key_size
1 byte Peripheral Key Distribution Bitmap:
- enc: 1 bit,
- id: 1 bit,
- sign: 1 bit
See ble_gap_sec_params_t::kdist_periph
1 byte Central Key Distribution Bitmap:
- enc: 1 bit,
- id: 1 bit,
- sign: 1 bit
See ble_gap_sec_params_t::kdist_central


Encoding of GAP Security Parameters Request event

event_sec_params_request_packet_s120.png
Figure 1: Encoding of GAP Security Parameters Request event.


Encoding of Bond, MITM, IO caps, and OOB

event_sec_params_request_bond_mitm_iocaps_oob.png
Figure 2: Encoding of Bond, MITM, IO caps, and OOB inside a GAP Security Parameters Request event.


Encoding of Key Distribution Bitmap

Encodings of Central and Peripheral Key Distribution Bitmaps are the same.

event_sec_params_request_kdist.png
Figure 3: Encoding of Key Distribution Bitmap inside a GAP Security Parameters Request event.


0x14 - BLE_GAP_EVT_SEC_INFO_REQUEST

Event packet encoding

Frame format encoding of the BLE_GAP_EVT_SEC_INFO_REQUEST packet.

Event ID = 0x14 for BLE_GAP_EVT_SEC_INFO_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 GAP Security Info Request event, the ble_gap_evt_sec_info_request_t is encoded after the connection handle, as seen in Figure 1.

The "Encryption info present", "Identity info present", and "Signing info present" flags are all bitfields inside 1 byte as seen in Figure 2.

The order of the encoding is:

Length Parameter Value
2 bytes Connection Handle See ble_gap_evt_t::conn_handle
1 byte Address Type See ble_gap_addr_t::addr_type
6 bytes Address See ble_gap_addr_t::addr
10 bytes Master ID See ble_gap_master_id_t
1 byte Bitfields:
- Encryption info: 1 bit,
- Identity info: 1 bit,
- Signing info: 1 bit
(See Figure 2 for details on encoding)


Encoding of GAP Connection Security Updated event

event_sec_info_request_packet_s120.png
Figure 1: Encoding of GAP Security Info Request event.


Encoding of Encryption, Identity, and Sign Information Required flags

event_sec_info_request_enc_id_sign_info_s120.png
Figure 2: Encoding of Encryption info, Identity info, and Signing info inside a GAP Security Info Request event.


0x15 - BLE_GAP_EVT_PASSKEY_DISPLAY

Event packet encoding

Frame format encoding of the BLE_GAP_EVT_PASSKEY_DISPLAY packet.

Event ID = 0x15 for BLE_GAP_EVT_PASSKEY_DISPLAY.

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 GAP Passkey display event, the ble_gap_evt_passkey_display_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_gap_evt_t::conn_handle
6 bytes Passkey See ble_gap_evt_passkey_display_t::passkey


Encoding of BLE GAP Passkey display event

event_gap_evt_passkey_display.png
Figure 1: Encoding of BLE GAP Passkey Display event.


0x16 - BLE_GAP_EVT_AUTH_KEY_REQUEST

Event packet encoding

Frame format encoding of the BLE_GAP_EVT_AUTH_KEY_REQUEST packet.

Event ID = 0x16 for BLE_GAP_EVT_AUTH_KEY_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 GAP key request event, the ble_gap_evt_auth_key_request_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_gap_evt_t::conn_handle
1 byte Key type See ble_gap_evt_auth_key_request_t::key_type


Encoding of BLE GAP auth key request event

event_auth_key_request_packet.png
Figure 1: Encoding of BLE GAP auth key request event.


0x17 - BLE_GAP_EVT_AUTH_STATUS

Event packet encoding

Frame format encoding of the BLE_GAP_EVT_AUTH_STATUS packet.

Event ID = 0x17 for BLE_GAP_EVT_AUTH_STATUS

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 GAP Authentication Status event, the ble_gap_evt_auth_status_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_gap_evt_t::conn_handle
1 byte Authentication Status
1 byte Error Source bonded error_src
1 byte Security levels mode1 lv1 lv2 lv3
1 byte Security levels mode2 lv1 lv2 lv3
1 byte Keys distribution - peripheral enc id sign
1 byte Keys distribution - central enc id sign
6 .. 138 bytes Security Keyset Structure See ble_gap_sec_keyset_t

Note: The security keyset structure is not part of the event data, but it is sent to the application processor. The BLE_GAP_EVT_AUTH_STATUS event indicates that the security keys exchange is complete. At this point, the security keys (contained in the security keyset structure) have been updated by the SoftDevice. Therefore, they must be sent to the application processor to enable the application to use the new keys.

The security keys synchronization between connectivity and application processors is done using GAP Functions for managing memory for security keys on connectivity device. and GAP Functions for managing memory for security keys in application device..

To find the security keys corresponding to the actual connection handle, the conn_ble_gap_sec_context_find and app_ble_gap_sec_context_find functions are used.

As the security context is no longer needed after the synchronization of the security keys, it is released using conn_ble_gap_sec_context_destroy and app_ble_gap_sec_context_destroy.

Encoding of GAP Connection Security Updated event

gap_event_auth_status_packet_s120.png
Figure 1: Encoding of GAP Authentication Status event.

The details of the security keyset structure encoding are described in Encoding of Keyset Structure.

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

The BLE GAP event contains a connection handle. For the BLE GAP Security Info Request event, the ble_gap_evt_conn_sec_update_t is encoded after the 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:

Length Parameter Value
2 bytes Connection Handle See ble_gap_evt_t::conn_handle
1 byte Security Mode bitfields:
- Security mode (sm): 4 bits,
- Level (lv): 4 bits
(See Figure 2 for details on encoding)
1 byte Encryption Key Size See ble_gap_conn_sec_t::encr_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 Encryption, Identity, and Sign Information Required flags

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


0x19 - BLE_GAP_EVT_TIMEOUT

Event packet encoding

Frame format encoding of the BLE_GAP_EVT_TIMEOUT packet.

Event ID = 0x19 for BLE_GAP_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 GAP event contains a connection handle. For the BLE GAP Timeout event, the ble_gap_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_gap_evt_t::conn_handle
1 byte Timeout Source See ble_gap_evt_timeout_t::src


Encoding of BLE GAP Timeout event

event_timeout_packet.png
Figure 1: Encoding of BLE GAP Timeout event.


0x1A - BLE_GAP_EVT_RSSI_CHANGED

Event packet encoding

Frame format encoding of the BLE_GAP_EVT_RSSI_CHANGED packet.

Event ID = 0x1A for BLE_GAP_EVT_RSSI_CHANGED

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 GAP RSSI Changed event, the ble_gap_evt_rssi_changed_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_gap_evt_t::conn_handle
1 byte RSSI See ble_gap_evt_rssi_changed_t::rssi


Encoding of BLE GAP RSSI Changed event

event_gap_evt_rssi_changed_packet.png
Figure 1: Encoding of BLE GAP RSSI Changed event.


0x1B - BLE_GAP_EVT_ADV_REPORT

Event packet encoding

Frame format encoding of the BLE_GAP_EVT_ADV_REPORT packet.

Event ID = 0x1B for BLE_GAP_EVT_ADV_REPORT

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 ADV REPORT event, the ble_gap_evt_adv_report_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_gap_evt_t::conn_handle
1 byte Address Type See ble_gap_addr_t::addr_type
6 bytes Address See ble_gap_addr_t::addr
1 byte RSSI See ble_gap_evt_rssi_changed_t::rssi
1 byte Flags scan_rsp:1 type:2 dlen:5
0..31 bytes Data Data bytes


Encoding of BLE ADV REPORT event

gap_event_adv_report_s120.png
Figure 1: Encoding of BLE ADV REPORT event.


0x1E - BLE_GAP_EVT_SCAN_REQ_REPORT

Event packet encoding

Frame format encoding of the BLE_GAP_EVT_SCAN_REQ_REPORT packet.

Event ID = 0x1E for BLE_GAP_EVT_SCAN_REQ_REPORT

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 GAP Scan Req. Report event, the ble_gap_evt_scan_req_report_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_gap_evt_t::conn_handle
1 byte Peer Address Type See ble_gap_addr_t::addr_type
6 bytes Peer Address See ble_gap_addr_t::addr
1 bytes RSSI See ble_gap_evt_scan_req_report_t::rssi


Encoding of BLE GAP SCAN REQ Report event

event_gap_evt_scan_req_report_packet.png
Figure 1: Encoding of BLE GAP EVT SCAN REQ REPORT event.


0x1C - BLE_GAP_EVT_SEC_REQUEST

Event packet encoding

Frame format encoding of the BLE_GAP_EVT_SEC_REQUEST packet.

Event ID = 0x1C for BLE_GAP_EVT_SEC_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 GAP SEC Request event, the ble_gap_evt_sec_request_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_gap_evt_t::conn_handle
1 byte Bond, MITM See ble_gap_evt_sec_request_t::bond and ble_gap_evt_sec_request_t::mitm


Encoding of BLE GAP SEC Request event

event_gap_evt_sec_request_packet.png
Figure 1: Encoding of BLE GAP SEC Request event.


0x1D - BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST

Event packet encoding

Frame format encoding of the BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST packet.

Event ID = 0x1D for BLE_GAP_EVT_CONN_PARAM_UPDATE_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 GAP CONN PARAM Update Request event, the ble_gap_evt_conn_param_update_request_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_gap_evt_t::conn_handle
8 bytes Connection Parameters See Encoding of GAP Connection Parameters for encoding details


Encoding of BLE GAP CONN PARAM Update Request event

event_gap_evt_conn_param_update_request_packet.png
Figure 1: Encoding of BLE GAP SEC CONN PARAM Update Request event.