nRF51 SDK: Generic Access Profile (GAP)

| nRF51 SDK

- Home
- Related Pages
- API Reference
- Data Structures

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Modules | Data Structures | Enumerations | Functions
Generic Access Profile (GAP)
S110 (BLE peripheral)

Definitions and prototypes for the GAP interface. More...

## Modules

| Message Sequence Charts
| Defines

## Data Structures

struct | ble_gap_addr_t
| Bluetooth Low Energy address. More...
struct | ble_gap_conn_params_t
| GAP connection parameters. More...
struct | ble_gap_conn_sec_mode_t
| GAP link requirements. More...
struct | ble_gap_conn_sec_t
| GAP connection security status. More...
struct | ble_gap_irk_t
| Identity Resolving Key. More...
struct | ble_gap_whitelist_t
| Whitelist structure. More...
struct | ble_gap_adv_params_t
| GAP advertising parameters. More...
struct | ble_gap_scan_params_t
| GAP scanning parameters. More...
struct | ble_gap_sec_params_t
| GAP security parameters. More...
struct | ble_gap_enc_info_t
| GAP Encryption Information. More...
struct | ble_gap_master_id_t
| GAP Master Identification. More...
struct | ble_gap_id_info_t
| GAP Identity Information. More...
struct | ble_gap_sign_info_t
| GAP Signing Information. More...
struct | ble_gap_evt_connected_t
| Event data for connected event. More...
struct | ble_gap_evt_disconnected_t
| Event data for disconnected event. More...
struct | ble_gap_evt_conn_param_update_t
| Event data for connection parameter update event. More...
struct | ble_gap_evt_sec_params_request_t
| Event data for security parameters request event. More...
struct | ble_gap_evt_sec_info_request_t
| Event data for securito info request event. More...
struct | ble_gap_evt_passkey_display_t
| Event data for passkey display event. More...
struct | ble_gap_evt_auth_key_request_t
| Event data for authentication key request event. More...
struct | ble_gap_sec_levels_t
| Security levels supported. More...
struct | ble_gap_sec_keys_t
| Keys that have been exchanged. More...
struct | ble_gap_evt_auth_status_t
| Event data for authentication status event. More...
struct | ble_gap_evt_conn_sec_update_t
| Event data for connection security update event. More...
struct | ble_gap_evt_timeout_t
| Event data for timeout event. More...
struct | ble_gap_evt_rssi_changed_t
| Event data for advertisement report event. More...
struct | ble_gap_evt_t
| GAP event callback event structure. More...

## Enumerations

enum

BLE_GAP_SVCS {
SD_BLE_GAP_ADDRESS_SET = 0x70, SD_BLE_GAP_ADDRESS_GET, SD_BLE_GAP_ADV_DATA_SET, SD_BLE_GAP_ADV_START,
SD_BLE_GAP_ADV_STOP, SD_BLE_GAP_CONN_PARAM_UPDATE, SD_BLE_GAP_DISCONNECT, SD_BLE_GAP_TX_POWER_SET,
SD_BLE_GAP_APPEARANCE_SET, SD_BLE_GAP_APPEARANCE_GET, SD_BLE_GAP_PPCP_SET, SD_BLE_GAP_PPCP_GET,
SD_BLE_GAP_DEVICE_NAME_SET, SD_BLE_GAP_DEVICE_NAME_GET, SD_BLE_GAP_AUTHENTICATE, SD_BLE_GAP_SEC_PARAMS_REPLY,
SD_BLE_GAP_AUTH_KEY_REPLY, SD_BLE_GAP_SEC_INFO_REPLY, SD_BLE_GAP_CONN_SEC_GET, SD_BLE_GAP_RSSI_START,
SD_BLE_GAP_RSSI_STOP, SD_BLE_GAP_ADDRESS_SET = 0x70, SD_BLE_GAP_ADDRESS_GET, SD_BLE_GAP_ADV_DATA_SET,
SD_BLE_GAP_ADV_START, SD_BLE_GAP_ADV_STOP, SD_BLE_GAP_CONN_PARAM_UPDATE, SD_BLE_GAP_DISCONNECT,
SD_BLE_GAP_TX_POWER_SET, SD_BLE_GAP_APPEARANCE_SET, SD_BLE_GAP_APPEARANCE_GET, SD_BLE_GAP_PPCP_SET,
SD_BLE_GAP_PPCP_GET, SD_BLE_GAP_DEVICE_NAME_SET, SD_BLE_GAP_DEVICE_NAME_GET, SD_BLE_GAP_AUTHENTICATE,
SD_BLE_GAP_SEC_PARAMS_REPLY, SD_BLE_GAP_AUTH_KEY_REPLY, SD_BLE_GAP_ENCRYPT, SD_BLE_GAP_SEC_INFO_REPLY,
SD_BLE_GAP_CONN_SEC_GET, SD_BLE_GAP_RSSI_START, SD_BLE_GAP_RSSI_STOP, SD_BLE_GAP_SCAN_START,
SD_BLE_GAP_SCAN_STOP, SD_BLE_GAP_CONNECT, SD_BLE_GAP_CONNECT_CANCEL, SD_BLE_GAP_ADDRESS_SET = 0x70,
SD_BLE_GAP_ADDRESS_GET, SD_BLE_GAP_ADV_DATA_SET, SD_BLE_GAP_ADV_START, SD_BLE_GAP_ADV_STOP,
SD_BLE_GAP_CONN_PARAM_UPDATE, SD_BLE_GAP_DISCONNECT, SD_BLE_GAP_TX_POWER_SET, SD_BLE_GAP_APPEARANCE_SET,
SD_BLE_GAP_APPEARANCE_GET, SD_BLE_GAP_PPCP_SET, SD_BLE_GAP_PPCP_GET, SD_BLE_GAP_DEVICE_NAME_SET,
SD_BLE_GAP_DEVICE_NAME_GET, SD_BLE_GAP_AUTHENTICATE, SD_BLE_GAP_SEC_PARAMS_REPLY, SD_BLE_GAP_AUTH_KEY_REPLY,
SD_BLE_GAP_SEC_INFO_REPLY, SD_BLE_GAP_CONN_SEC_GET, SD_BLE_GAP_RSSI_START, SD_BLE_GAP_RSSI_STOP
}

| GAP API SVC numbers. More...

enum

BLE_GAP_EVTS {
BLE_GAP_EVT_CONNECTED = 0x10, BLE_GAP_EVT_DISCONNECTED, BLE_GAP_EVT_CONN_PARAM_UPDATE, BLE_GAP_EVT_SEC_PARAMS_REQUEST,
BLE_GAP_EVT_SEC_INFO_REQUEST, BLE_GAP_EVT_PASSKEY_DISPLAY, BLE_GAP_EVT_AUTH_KEY_REQUEST, BLE_GAP_EVT_AUTH_STATUS,
BLE_GAP_EVT_CONN_SEC_UPDATE, BLE_GAP_EVT_TIMEOUT, BLE_GAP_EVT_RSSI_CHANGED, BLE_GAP_EVT_CONNECTED = 0x10,
BLE_GAP_EVT_DISCONNECTED, BLE_GAP_EVT_CONN_PARAM_UPDATE, BLE_GAP_EVT_SEC_PARAMS_REQUEST, BLE_GAP_EVT_SEC_INFO_REQUEST,
BLE_GAP_EVT_PASSKEY_DISPLAY, BLE_GAP_EVT_AUTH_KEY_REQUEST, BLE_GAP_EVT_AUTH_STATUS, BLE_GAP_EVT_CONN_SEC_UPDATE,
BLE_GAP_EVT_TIMEOUT, BLE_GAP_EVT_RSSI_CHANGED, BLE_GAP_EVT_ADV_REPORT, BLE_GAP_EVT_SEC_REQUEST,
BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST, BLE_GAP_EVT_CONNECTED = 0x10, BLE_GAP_EVT_DISCONNECTED, BLE_GAP_EVT_CONN_PARAM_UPDATE,
BLE_GAP_EVT_SEC_PARAMS_REQUEST, BLE_GAP_EVT_SEC_INFO_REQUEST, BLE_GAP_EVT_PASSKEY_DISPLAY, BLE_GAP_EVT_AUTH_KEY_REQUEST,
BLE_GAP_EVT_AUTH_STATUS, BLE_GAP_EVT_CONN_SEC_UPDATE, BLE_GAP_EVT_TIMEOUT, BLE_GAP_EVT_RSSI_CHANGED
}

| GAP Event IDs. Those IDs uniquely identify an event coming from the stack to the application. More...

## Functions

uint32_t | sd_ble_gap_address_set (ble_gap_addr_t const *const p_addr)
| Set local Bluetooth address. More...
uint32_t | sd_ble_gap_address_get (ble_gap_addr_t *const p_addr)
| Get local Bluetooth address. More...
uint32_t | sd_ble_gap_adv_data_set (uint8_t const *const p_data, uint8_t dlen, uint8_t const *const p_sr_data, uint8_t srdlen)
| Set, clear or update advertisement and scan response data. More...
uint32_t | sd_ble_gap_adv_start (ble_gap_adv_params_t const *const p_adv_params)
| Start advertising (GAP Discoverable, Connectable modes, Broadcast Procedure). More...
uint32_t | sd_ble_gap_adv_stop (void)
| Stop advertising (GAP Discoverable, Connectable modes, Broadcast Procedure). More...
uint32_t | sd_ble_gap_conn_param_update (uint16_t conn_handle, ble_gap_conn_params_t const *const p_conn_params)
| Update connection parameters. More...
uint32_t | sd_ble_gap_disconnect (uint16_t conn_handle, uint8_t hci_status_code)
| Disconnect (GAP Link Termination). More...
uint32_t | sd_ble_gap_tx_power_set (int8_t tx_power)
| Set the radio's transmit power. More...
uint32_t | sd_ble_gap_appearance_set (uint16_t appearance)
| Set GAP Appearance value. More...
uint32_t | sd_ble_gap_appearance_get (uint16_t *const p_appearance)
| Get GAP Appearance value. More...
uint32_t | sd_ble_gap_ppcp_set (ble_gap_conn_params_t const *const p_conn_params)
| Set GAP Peripheral Preferred Connection Parameters. More...
uint32_t | sd_ble_gap_ppcp_get (ble_gap_conn_params_t *const p_conn_params)
| Get GAP Peripheral Preferred Connection Parameters. More...
uint32_t | sd_ble_gap_device_name_set (ble_gap_conn_sec_mode_t const *const p_write_perm, uint8_t const *const p_dev_name, uint16_t len)
| Set GAP device name. More...
uint32_t | sd_ble_gap_device_name_get (uint8_t *const p_dev_name, uint16_t *const p_len)
| Get GAP device name. More...
uint32_t | sd_ble_gap_authenticate (uint16_t conn_handle, ble_gap_sec_params_t const *const p_sec_params)
| Initiate GAP Authentication procedure. More...
uint32_t | sd_ble_gap_sec_params_reply (uint16_t conn_handle, uint8_t sec_status, ble_gap_sec_params_t const *const p_sec_params)
| Reply with GAP security parameters. More...
uint32_t | sd_ble_gap_auth_key_reply (uint16_t conn_handle, uint8_t key_type, uint8_t const *const key)
| Reply with an authentication key. More...
uint32_t | sd_ble_gap_sec_info_reply (uint16_t conn_handle, ble_gap_enc_info_t const *const p_enc_info, ble_gap_sign_info_t const *const p_sign_info)
| Reply with GAP security information. More...
uint32_t | sd_ble_gap_conn_sec_get (uint16_t conn_handle, ble_gap_conn_sec_t *const p_conn_sec)
| Get the current connection security. More...
uint32_t | sd_ble_gap_rssi_start (uint16_t conn_handle)
| Start reporting the received signal strength to the application. More...
uint32_t | sd_ble_gap_rssi_stop (uint16_t conn_handle)
| Stop reporting the received singnal strength. More...

## Detailed Description

Definitions and prototypes for the GAP interface.

## Enumeration Type Documentation

enum BLE_GAP_EVTS

GAP Event IDs. Those IDs uniquely identify an event coming from the stack to the application.

Enumerator
BLE_GAP_EVT_CONNECTED | Connection established.
BLE_GAP_EVT_DISCONNECTED | Disconnected from peer.
BLE_GAP_EVT_CONN_PARAM_UPDATE | Connection Parameters updated.
BLE_GAP_EVT_SEC_PARAMS_REQUEST | Request to provide security parameters.
BLE_GAP_EVT_SEC_INFO_REQUEST | Request to provide security information.
BLE_GAP_EVT_PASSKEY_DISPLAY | Request to display a passkey to the user.
BLE_GAP_EVT_AUTH_KEY_REQUEST | Request to provide an authentication key.
BLE_GAP_EVT_AUTH_STATUS | Authentication procedure completed with status.
BLE_GAP_EVT_CONN_SEC_UPDATE | Connection security updated.
BLE_GAP_EVT_TIMEOUT | Timeout expired.
BLE_GAP_EVT_RSSI_CHANGED | Signal strength measurement report.
BLE_GAP_EVT_CONNECTED | GAP BLE Event base. Connection established.
BLE_GAP_EVT_DISCONNECTED | Disconnected from peer.
BLE_GAP_EVT_CONN_PARAM_UPDATE | Connection Parameters updated.
BLE_GAP_EVT_SEC_PARAMS_REQUEST | Request to provide security parameters.
BLE_GAP_EVT_SEC_INFO_REQUEST | Request to provide security information.
BLE_GAP_EVT_PASSKEY_DISPLAY | Request to display a passkey to the user.
BLE_GAP_EVT_AUTH_KEY_REQUEST | Request to provide an authentication key.
BLE_GAP_EVT_AUTH_STATUS | Authentication procedure completed with status.
BLE_GAP_EVT_CONN_SEC_UPDATE | Connection security updated.
BLE_GAP_EVT_TIMEOUT | Timeout expired.
BLE_GAP_EVT_RSSI_CHANGED | Signal strength measurement report.
BLE_GAP_EVT_ADV_REPORT | Advertising report.
BLE_GAP_EVT_SEC_REQUEST | Security Request.
BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST | Connection Parameter Update Request.
BLE_GAP_EVT_CONNECTED | Connection established.
BLE_GAP_EVT_DISCONNECTED | Disconnected from peer.
BLE_GAP_EVT_CONN_PARAM_UPDATE | Connection Parameters updated.
BLE_GAP_EVT_SEC_PARAMS_REQUEST | Request to provide security parameters.
BLE_GAP_EVT_SEC_INFO_REQUEST | Request to provide security information.
BLE_GAP_EVT_PASSKEY_DISPLAY | Request to display a passkey to the user.
BLE_GAP_EVT_AUTH_KEY_REQUEST | Request to provide an authentication key.
BLE_GAP_EVT_AUTH_STATUS | Authentication procedure completed with status.
BLE_GAP_EVT_CONN_SEC_UPDATE | Connection security updated.
BLE_GAP_EVT_TIMEOUT | Timeout expired.
BLE_GAP_EVT_RSSI_CHANGED | Signal strength measurement report.

enum BLE_GAP_SVCS

GAP API SVC numbers.

Enumerator
SD_BLE_GAP_ADDRESS_SET | Set own Bluetooth Address.
SD_BLE_GAP_ADDRESS_GET | Get own Bluetooth Address.
SD_BLE_GAP_ADV_DATA_SET | Set Advertisement Data.
SD_BLE_GAP_ADV_START | Start Advertising.
SD_BLE_GAP_ADV_STOP | Stop Advertising.
SD_BLE_GAP_CONN_PARAM_UPDATE | Connection Parameter Update.
SD_BLE_GAP_DISCONNECT | Disconnect.
SD_BLE_GAP_TX_POWER_SET | Set TX Power.
SD_BLE_GAP_APPEARANCE_SET | Set Appearance.
SD_BLE_GAP_APPEARANCE_GET | Get Appearance.
SD_BLE_GAP_PPCP_SET | Set PPCP.
SD_BLE_GAP_PPCP_GET | Get PPCP.
SD_BLE_GAP_DEVICE_NAME_SET | Set Device Name.
SD_BLE_GAP_DEVICE_NAME_GET | Get Device Name.
SD_BLE_GAP_AUTHENTICATE | Initiate Pairing/Bonding.
SD_BLE_GAP_SEC_PARAMS_REPLY | Reply with Security Parameters.
SD_BLE_GAP_AUTH_KEY_REPLY | Reply with an authentication key.
SD_BLE_GAP_SEC_INFO_REPLY | Reply with Security Information.
SD_BLE_GAP_CONN_SEC_GET | Obtain connection security level.
SD_BLE_GAP_RSSI_START | Start reporting of changes in RSSI.
SD_BLE_GAP_RSSI_STOP | Stop reporting of changes in RSSI.
SD_BLE_GAP_ADDRESS_SET | GAP BLE SVC base. Set own Bluetooth Address.
SD_BLE_GAP_ADDRESS_GET | Get own Bluetooth Address.
SD_BLE_GAP_ADV_DATA_SET | Set Advertising Data.
SD_BLE_GAP_ADV_START | Start Advertising.
SD_BLE_GAP_ADV_STOP | Stop Advertising.
SD_BLE_GAP_CONN_PARAM_UPDATE | Connection Parameter Update.
SD_BLE_GAP_DISCONNECT | Disconnect.
SD_BLE_GAP_TX_POWER_SET | Set TX Power.
SD_BLE_GAP_APPEARANCE_SET | Set Appearance.
SD_BLE_GAP_APPEARANCE_GET | Get Appearance.
SD_BLE_GAP_PPCP_SET | Set PPCP.
SD_BLE_GAP_PPCP_GET | Get PPCP.
SD_BLE_GAP_DEVICE_NAME_SET | Set Device Name.
SD_BLE_GAP_DEVICE_NAME_GET | Get Device Name.
SD_BLE_GAP_AUTHENTICATE | Initiate Pairing/Bonding.
SD_BLE_GAP_SEC_PARAMS_REPLY | Reply with Security Parameters.
SD_BLE_GAP_AUTH_KEY_REPLY | Reply with an authentication key.
SD_BLE_GAP_ENCRYPT | Initiate encryption procedure.
SD_BLE_GAP_SEC_INFO_REPLY | Reply with Security Information.
SD_BLE_GAP_CONN_SEC_GET | Obtain connection security level.
SD_BLE_GAP_RSSI_START | Start reporting of changes in RSSI.
SD_BLE_GAP_RSSI_STOP | Stop reporting of changes in RSSI.
SD_BLE_GAP_SCAN_START | Start Scanning.
SD_BLE_GAP_SCAN_STOP | Stop Scanning.
SD_BLE_GAP_CONNECT | Connect.
SD_BLE_GAP_CONNECT_CANCEL | Cancel ongoing connection procedure.
SD_BLE_GAP_ADDRESS_SET | Set own Bluetooth Address.
SD_BLE_GAP_ADDRESS_GET | Get own Bluetooth Address.
SD_BLE_GAP_ADV_DATA_SET | Set Advertisement Data.
SD_BLE_GAP_ADV_START | Start Advertising.
SD_BLE_GAP_ADV_STOP | Stop Advertising.
SD_BLE_GAP_CONN_PARAM_UPDATE | Connection Parameter Update.
SD_BLE_GAP_DISCONNECT | Disconnect.
SD_BLE_GAP_TX_POWER_SET | Set TX Power.
SD_BLE_GAP_APPEARANCE_SET | Set Appearance.
SD_BLE_GAP_APPEARANCE_GET | Get Appearance.
SD_BLE_GAP_PPCP_SET | Set PPCP.
SD_BLE_GAP_PPCP_GET | Get PPCP.
SD_BLE_GAP_DEVICE_NAME_SET | Set Device Name.
SD_BLE_GAP_DEVICE_NAME_GET | Get Device Name.
SD_BLE_GAP_AUTHENTICATE | Initiate Pairing/Bonding.
SD_BLE_GAP_SEC_PARAMS_REPLY | Reply with Security Parameters.
SD_BLE_GAP_AUTH_KEY_REPLY | Reply with an authentication key.
SD_BLE_GAP_SEC_INFO_REPLY | Reply with Security Information.
SD_BLE_GAP_CONN_SEC_GET | Obtain connection security level.
SD_BLE_GAP_RSSI_START | Start reporting of changes in RSSI.
SD_BLE_GAP_RSSI_STOP | Stop reporting of changes in RSSI.

## Function Documentation

uint32_t sd_ble_gap_address_get | ( | ble_gap_addr_t *const | p_addr | ) |

Get local Bluetooth address.

Parameters

  [out] | p_addr | Pointer to address structure.

Returns
  NRF_SUCCESS Address successfully retrieved.
  NRF_ERROR_INVALID_ADDR Invalid pointer supplied.

uint32_t sd_ble_gap_address_set | ( | ble_gap_addr_t const *const | p_addr | ) |

Set local Bluetooth address.

Parameters

  [in] | p_addr | Pointer to address structure.

Returns
  NRF_SUCCESS Address successfully set.
  NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
  BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid address.
  NRF_ERROR_BUSY The stack is busy, process pending events and retry.

uint32_t sd_ble_gap_adv_data_set | ( | uint8_t const *const | p_data,
|  | uint8_t | dlen,
|  | uint8_t const *const | p_sr_data,
|  | uint8_t | srdlen
| ) |  |

Set, clear or update advertisement and scan response data.

Note
  The format of the advertisement data will be checked by this call to ensure interoperability. Limitations imposed by this API call to the data provided include having a flags data type in the scan response data and duplicating the local name in the advertisement data and scan response data.
  : To clear the advertisement data and set it to a 0-length packet, simply provide a valid pointer (p_data/p_sr_data) with its corresponding length (dlen/srdlen) set to 0.
  : The call will fail if p_data and p_sr_data are both NULL since this would have no effect.

Parameters

  [in] | p_data | Raw data to be placed in advertisement packet. If NULL, no changes are made to the current advertisement packet data.
  [in] | dlen | Data length for p_data. Max size: BLE_GAP_ADV_MAX_SIZE octets. Should be 0 if p_data is NULL, can be 0 if p_data is not NULL.
  [in] | p_sr_data | Raw data to be placed in scan response packet. If NULL, no changes are made to the current scan response packet data.
  [in] | srdlen | Data length for p_sr_data. Max size: BLE_GAP_ADV_MAX_SIZE octets. Should be 0 if p_sr_data is NULL, can be 0 if p_data is not NULL.

Returns
  NRF_SUCCESS Advertisement data successfully updated or cleared.
  NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
  NRF_ERROR_INVALID_FLAGS Invalid combination of advertising flags supplied.
  NRF_ERROR_INVALID_DATA Invalid data type(s) supplied, check the advertising data format specification.
  NRF_ERROR_INVALID_LENGTH Invalid data length(s) supplied.
  BLE_ERROR_GAP_UUID_LIST_MISMATCH Invalid UUID list supplied.
  NRF_ERROR_BUSY The stack is busy, process pending events and retry.

uint32_t sd_ble_gap_adv_start | ( | ble_gap_adv_params_t const *const | p_adv_params | ) |

Start advertising (GAP Discoverable, Connectable modes, Broadcast Procedure).

Parameters

  [in] | p_adv_params | Pointer to advertising parameters structure.

Returns
  NRF_SUCCESS The BLE stack has started advertising.
  NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
  NRF_ERROR_INVALID_STATE Invalid state to perform operation.
  NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check the accepted ranges and limits.
  BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid Bluetooth address supplied.
  BLE_ERROR_GAP_DISCOVERABLE_WITH_WHITELIST Discoverable mode and whitelist incompatible.

uint32_t sd_ble_gap_adv_stop | ( | void |  | ) |

Stop advertising (GAP Discoverable, Connectable modes, Broadcast Procedure).

Returns
  NRF_SUCCESS The BLE stack has stopped advertising.
  NRF_ERROR_INVALID_STATE Invalid state to perform operation (most probably not in advertising state).

uint32_t sd_ble_gap_appearance_get | ( | uint16_t *const | p_appearance | ) |

Get GAP Appearance value.

Parameters

  [out] | p_appearance | Appearance (16-bit), see BLE_APPEARANCES.

Returns
  NRF_SUCCESS Appearance value retrieved successfully.
  NRF_ERROR_INVALID_ADDR Invalid pointer supplied.

uint32_t sd_ble_gap_appearance_set | ( | uint16_t | appearance | ) |

Set GAP Appearance value.

Parameters

  [in] | appearance | Appearance (16-bit), see BLE_APPEARANCES.

Returns
  NRF_SUCCESS Appearance value set successfully.
  NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.

uint32_t sd_ble_gap_auth_key_reply | ( | uint16_t | conn_handle,
|  | uint8_t | key_type,
|  | uint8_t const *const | key
| ) |  |

Reply with an authentication key.

Parameters

  [in] | conn_handle | Connection handle.
  [in] | key_type | See BLE_GAP_AUTH_KEY_TYPES.
  [in] | key | If key type is BLE_GAP_AUTH_KEY_TYPE_NONE, then NULL. If key type is BLE_GAP_AUTH_KEY_TYPE_PASSKEY, then a 6-byte ASCII string (digit 0..9 only, no NULL termination). If key type is BLE_GAP_AUTH_KEY_TYPE_OOB, then a 16-byte OOB key value in Little Endian format.

This function is only used to reply to a BLE_GAP_EVT_AUTH_KEY_REQUEST, calling it at other times will result in an NRF_ERROR_INVALID_STATE.

Note
  If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters.

Returns
  NRF_SUCCESS Authentication key successfully set.
  NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
  NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
  NRF_ERROR_INVALID_STATE Invalid state to perform operation.
  BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.

uint32_t sd_ble_gap_authenticate | ( | uint16_t | conn_handle,
|  | ble_gap_sec_params_t const *const | p_sec_params
| ) |  |

Initiate GAP Authentication procedure.

Parameters

  [in] | conn_handle | Connection handle.
  [in] | p_sec_params | Pointer to the ble_gap_sec_params_t structure with the security parameters to be used during the pairing procedure.

In the central role, this function will send an SMP Pairing Request, otherwise in the peripheral role, an SMP Security Request will be sent. In the peripheral role, only the timeout, bond and mitm fields of ble_gap_sec_params_t are used.

Note
  The GAP Authentication procedure may be triggered by the central without calling this function when accessing a secure service.
  Calling this function may result in the following events depending on the outcome and parameters: BLE_GAP_EVT_SEC_PARAMS_REQUEST, BLE_GAP_EVT_SEC_INFO_REQUEST, BLE_GAP_EVT_AUTH_KEY_REQUEST, BLE_GAP_EVT_AUTH_STATUS.
  The timeout parameter in ble_gap_sec_params_t is interpreted here as the Security Request timeout

Returns
  NRF_SUCCESS Successfully initiated authentication procedure.
  NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
  NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
  NRF_ERROR_INVALID_STATE Invalid state to perform operation.
  BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.

uint32_t sd_ble_gap_conn_param_update | ( | uint16_t | conn_handle,
|  | ble_gap_conn_params_t const *const | p_conn_params
| ) |  |

Update connection parameters.

In the central role this will initiate a Link Layer connection parameter update procedure, otherwise in the peripheral role, this will send the corresponding L2CAP request and wait for the central to perform the procedure. In both cases, and regardless of success or failure, the application will be informed of the result with a BLE_GAP_EVT_CONN_PARAM_UPDATE event.

Note
  If both a connection supervision timeout and a maximum connection interval are specified, then the following constraint applies: (conn_sup_timeout * 8) >= (max_conn_interval * (slave_latency + 1))

Parameters

  [in] | conn_handle | Connection handle.
  [in] | p_conn_params | Pointer to desired connection parameters. If NULL is provided on a peripheral role, the parameters in the PPCP characteristic of the GAP service will be used instead.

Returns
  NRF_SUCCESS The Connection Update procedure has been started successfully.
  NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
  NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check parameter limits and constraints.
  NRF_ERROR_BUSY Procedure already in progress or not allowed at this time, process pending events and retry.
  BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
  NRF_ERROR_NO_MEM Not enough memory to complete operation.

uint32_t sd_ble_gap_conn_sec_get | ( | uint16_t | conn_handle,
|  | ble_gap_conn_sec_t *const | p_conn_sec
| ) |  |

Get the current connection security.

Parameters

  [in] | conn_handle | Connection handle.
  [out] | p_conn_sec | Pointer to a ble_gap_conn_sec_t structure to be filled in.

Returns
  NRF_SUCCESS Current connection security successfully retrieved.
  NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
  BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.

uint32_t sd_ble_gap_device_name_get | ( | uint8_t *const | p_dev_name,
|  | uint16_t *const | p_len
| ) |  |

Get GAP device name.

Parameters

  [in] | p_dev_name | Pointer to an empty buffer where the UTF-8 non NULL-terminated string will be placed. Set to NULL to obtain the complete device name length.
  [in,out] | p_len | Length of the buffer pointed by p_dev_name, complete device name length on output.

Note
  If the device name is longer than the size of the supplied buffer, p_len will return the complete device name length, and not the number of bytes actually returned in p_dev_name. The application may use this information to allocate a suitable buffer size.

Returns
  NRF_SUCCESS GAP device name retrieved successfully.
  NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
  NRF_ERROR_DATA_SIZE Invalid data size(s) supplied.

uint32_t sd_ble_gap_device_name_set | ( | ble_gap_conn_sec_mode_t const *const | p_write_perm,
|  | uint8_t const *const | p_dev_name,
|  | uint16_t | len
| ) |  |

Set GAP device name.

Parameters

  [in] | p_write_perm | Write permissions for the Device Name characteristic see ble_gap_conn_sec_mode_t.
  [in] | p_dev_name | Pointer to a UTF-8 encoded, non NULL-terminated string.
  [in] | len | Length of the UTF-8, non NULL-terminated string pointed to by p_dev_name in octets (must be smaller or equal than BLE_GAP_DEVNAME_MAX_LEN).

Returns
  NRF_SUCCESS GAP device name and permissions set successfully.
  NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
  NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
  NRF_ERROR_DATA_SIZE Invalid data size(s) supplied.

uint32_t sd_ble_gap_disconnect | ( | uint16_t | conn_handle,
|  | uint8_t | hci_status_code
| ) |  |

Disconnect (GAP Link Termination).

This call initiates the disconnection procedure, and its completion will be communicated to the application with a BLE_GAP_EVT_DISCONNECTED event.

Parameters

  [in] | conn_handle | Connection handle.
  [in] | hci_status_code | HCI status code, see BLE_HCI_STATUS_CODES (accepted values are BTLE_REMOTE_USER_TERMINATED_CONNECTION and BTLE_CONN_INTERVAL_UNACCEPTABLE).

Returns
  NRF_SUCCESS The disconnection procedure has been started successfully.
  NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
  BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
  NRF_ERROR_INVALID_STATE Invalid state to perform operation (disconnection is already in progress or not connected at all).

uint32_t sd_ble_gap_ppcp_get | ( | ble_gap_conn_params_t *const | p_conn_params | ) |

Get GAP Peripheral Preferred Connection Parameters.

Parameters

  [out] | p_conn_params | Pointer to a ble_gap_conn_params_t structure where the parameters will be stored.

Returns
  NRF_SUCCESS Peripheral Preferred Connection Parameters retrieved successfully.
  NRF_ERROR_INVALID_ADDR Invalid pointer supplied.

uint32_t sd_ble_gap_ppcp_set | ( | ble_gap_conn_params_t const *const | p_conn_params | ) |

Set GAP Peripheral Preferred Connection Parameters.

Parameters

  [in] | p_conn_params | Pointer to a ble_gap_conn_params_t structure with the desired parameters.

Returns
  NRF_SUCCESS Peripheral Preferred Connection Parameters set successfully.
  NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
  NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.

uint32_t sd_ble_gap_rssi_start | ( | uint16_t | conn_handle | ) |

Start reporting the received signal strength to the application.

A new event is reported whenever the RSSI value changes, until sd_ble_gap_rssi_stop is called.

Parameters

  [in] | conn_handle | Connection handle.

Returns
  NRF_SUCCESS Successfully activated RSSI reporting.
  NRF_ERROR_INVALID_STATE Invalid state to perform operation.
  BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.

uint32_t sd_ble_gap_rssi_stop | ( | uint16_t | conn_handle | ) |

Stop reporting the received singnal strength.

An RSSI change detected before the call but not yet received by the application may be reported after sd_ble_gap_rssi_stop has been called.

Parameters

  [in] | conn_handle | Connection handle.

Returns
  NRF_SUCCESS Successfully deactivated RSSI reporting.
  NRF_ERROR_INVALID_STATE Invalid state to perform operation.
  BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.

uint32_t sd_ble_gap_sec_info_reply | ( | uint16_t | conn_handle,
|  | ble_gap_enc_info_t const *const | p_enc_info,
|  | ble_gap_sign_info_t const *const | p_sign_info
| ) |  |

Reply with GAP security information.

Parameters

  [in] | conn_handle | Connection handle.
  [in] | p_enc_info | Pointer to a ble_gap_enc_info_t encryption information structure. May be NULL to signal none is available.
  [in] | p_sign_info | Pointer to a ble_gap_sign_info_t signing information structure. May be NULL to signal none is available.

This function is only used to reply to a BLE_GAP_EVT_SEC_INFO_REQUEST, calling it at other times will result in NRF_ERROR_INVALID_STATE.

Note
  If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters.
  Data signing is not implemented yet. p_sign_info must therefore be NULL.

Returns
  NRF_SUCCESS Successfully accepted security information.
  NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
  NRF_ERROR_INVALID_STATE Invalid state to perform operation.
  BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
  NRF_ERROR_BUSY The stack is busy, process pending events and retry.

uint32_t sd_ble_gap_sec_params_reply | ( | uint16_t | conn_handle,
|  | uint8_t | sec_status,
|  | ble_gap_sec_params_t const *const | p_sec_params
| ) |  |

Reply with GAP security parameters.

Parameters

  [in] | conn_handle | Connection handle.
  [in] | sec_status | Security status, see BLE_GAP_SEC_STATUS.
  [in] | p_sec_params | Pointer to a ble_gap_sec_params_t security parameters structure.

This function is only used to reply to a BLE_GAP_EVT_SEC_PARAMS_REQUEST, calling it at other times will result in an NRF_ERROR_INVALID_STATE.

Note
  If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters.
  The timeout parameter in ble_gap_sec_params_t is interpreted here as the SMP procedure timeout, and must be 30 seconds. The function will fail if the application supplies a different value.

Returns
  NRF_SUCCESS Successfully accepted security parameter from the application.
  NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
  NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
  NRF_ERROR_INVALID_STATE Invalid state to perform operation.
  BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.

uint32_t sd_ble_gap_tx_power_set | ( | int8_t | tx_power | ) |

Set the radio's transmit power.

Parameters

  [in] | tx_power | Radio transmit power in dBm (accepted values are -40, -30, -20, -16, -12, -8, -4, 0, and 4 dBm).

Note
  -40 dBm will not actually give -40 dBm, but will instead be remapped to -30 dBm.

Returns
  NRF_SUCCESS Successfully changed the transmit power.
  NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
  NRF_ERROR_BUSY The stack is busy, process pending events and retry.