R1 code for micro:bit based train controller code, requires second micro:bit running rx code to operate - see https://meanderingpi.wordpress.com/ for more information
Fork of nrf51-sdk by
Functions
[Generic Access Profile (GAP)]
Functions | |
SVCALL (SD_BLE_GAP_ADDRESS_SET, uint32_t, sd_ble_gap_address_set(uint8_t addr_cycle_mode, const ble_gap_addr_t *p_addr)) | |
Set local Bluetooth address. | |
SVCALL (SD_BLE_GAP_ADDRESS_GET, uint32_t, sd_ble_gap_address_get(ble_gap_addr_t *p_addr)) | |
Get local Bluetooth address. | |
SVCALL (SD_BLE_GAP_ADV_DATA_SET, uint32_t, sd_ble_gap_adv_data_set(uint8_t const *p_data, uint8_t dlen, uint8_t const *p_sr_data, uint8_t srdlen)) | |
Set, clear or update advertising and scan response data. | |
SVCALL (SD_BLE_GAP_ADV_START, uint32_t, sd_ble_gap_adv_start(ble_gap_adv_params_t const *p_adv_params)) | |
Start advertising (GAP Discoverable, Connectable modes, Broadcast Procedure). | |
SVCALL (SD_BLE_GAP_ADV_STOP, uint32_t, sd_ble_gap_adv_stop(void)) | |
Stop advertising (GAP Discoverable, Connectable modes, Broadcast Procedure). | |
SVCALL (SD_BLE_GAP_CONN_PARAM_UPDATE, uint32_t, sd_ble_gap_conn_param_update(uint16_t conn_handle, ble_gap_conn_params_t const *p_conn_params)) | |
Update connection parameters. | |
SVCALL (SD_BLE_GAP_DISCONNECT, uint32_t, sd_ble_gap_disconnect(uint16_t conn_handle, uint8_t hci_status_code)) | |
Disconnect (GAP Link Termination). | |
SVCALL (SD_BLE_GAP_TX_POWER_SET, uint32_t, sd_ble_gap_tx_power_set(int8_t tx_power)) | |
Set the radio's transmit power. | |
SVCALL (SD_BLE_GAP_APPEARANCE_SET, uint32_t, sd_ble_gap_appearance_set(uint16_t appearance)) | |
Set GAP Appearance value. | |
SVCALL (SD_BLE_GAP_APPEARANCE_GET, uint32_t, sd_ble_gap_appearance_get(uint16_t *p_appearance)) | |
Get GAP Appearance value. | |
SVCALL (SD_BLE_GAP_PPCP_SET, uint32_t, sd_ble_gap_ppcp_set(ble_gap_conn_params_t const *p_conn_params)) | |
Set GAP Peripheral Preferred Connection Parameters. | |
SVCALL (SD_BLE_GAP_PPCP_GET, uint32_t, sd_ble_gap_ppcp_get(ble_gap_conn_params_t *p_conn_params)) | |
Get GAP Peripheral Preferred Connection Parameters. | |
SVCALL (SD_BLE_GAP_DEVICE_NAME_SET, uint32_t, sd_ble_gap_device_name_set(ble_gap_conn_sec_mode_t const *p_write_perm, uint8_t const *p_dev_name, uint16_t len)) | |
Set GAP device name. | |
SVCALL (SD_BLE_GAP_DEVICE_NAME_GET, uint32_t, sd_ble_gap_device_name_get(uint8_t *p_dev_name, uint16_t *p_len)) | |
Get GAP device name. | |
SVCALL (SD_BLE_GAP_AUTHENTICATE, uint32_t, sd_ble_gap_authenticate(uint16_t conn_handle, ble_gap_sec_params_t const *p_sec_params)) | |
Initiate the GAP Authentication procedure. | |
SVCALL (SD_BLE_GAP_SEC_PARAMS_REPLY, uint32_t, sd_ble_gap_sec_params_reply(uint16_t conn_handle, uint8_t sec_status, ble_gap_sec_params_t const *p_sec_params, ble_gap_sec_keyset_t const *p_sec_keyset)) | |
Reply with GAP security parameters. | |
SVCALL (SD_BLE_GAP_AUTH_KEY_REPLY, uint32_t, sd_ble_gap_auth_key_reply(uint16_t conn_handle, uint8_t key_type, uint8_t const *p_key)) | |
Reply with an authentication key. | |
SVCALL (SD_BLE_GAP_ENCRYPT, uint32_t, sd_ble_gap_encrypt(uint16_t conn_handle, ble_gap_master_id_t const *p_master_id, ble_gap_enc_info_t const *p_enc_info)) | |
Initiate GAP Encryption procedure. | |
SVCALL (SD_BLE_GAP_SEC_INFO_REPLY, uint32_t, sd_ble_gap_sec_info_reply(uint16_t conn_handle, ble_gap_enc_info_t const *p_enc_info, ble_gap_irk_t const *p_id_info, ble_gap_sign_info_t const *p_sign_info)) | |
Reply with GAP security information. | |
SVCALL (SD_BLE_GAP_CONN_SEC_GET, uint32_t, sd_ble_gap_conn_sec_get(uint16_t conn_handle, ble_gap_conn_sec_t *p_conn_sec)) | |
Get the current connection security. | |
SVCALL (SD_BLE_GAP_RSSI_START, uint32_t, sd_ble_gap_rssi_start(uint16_t conn_handle, uint8_t threshold_dbm, uint8_t skip_count)) | |
Start reporting the received signal strength to the application. | |
SVCALL (SD_BLE_GAP_RSSI_STOP, uint32_t, sd_ble_gap_rssi_stop(uint16_t conn_handle)) | |
Stop reporting the received signal strength. | |
SVCALL (SD_BLE_GAP_RSSI_GET, uint32_t, sd_ble_gap_rssi_get(uint16_t conn_handle, int8_t *p_rssi)) | |
Get the received signal strength for the last connection event. | |
SVCALL (SD_BLE_GAP_SCAN_START, uint32_t, sd_ble_gap_scan_start(ble_gap_scan_params_t const *p_scan_params)) | |
Start scanning (GAP Discovery procedure, Observer Procedure). | |
SVCALL (SD_BLE_GAP_SCAN_STOP, uint32_t, sd_ble_gap_scan_stop(void)) | |
Stop scanning (GAP Discovery procedure, Observer Procedure). | |
SVCALL (SD_BLE_GAP_CONNECT, uint32_t, sd_ble_gap_connect(ble_gap_addr_t const *p_peer_addr, ble_gap_scan_params_t const *p_scan_params, ble_gap_conn_params_t const *p_conn_params)) | |
Create a connection (GAP Link Establishment). | |
SVCALL (SD_BLE_GAP_CONNECT_CANCEL, uint32_t, sd_ble_gap_connect_cancel(void)) | |
Cancel a connection establishment. |
Function Documentation
SVCALL | ( | SD_BLE_GAP_ADDRESS_SET | , |
uint32_t | , | ||
sd_ble_gap_address_set(uint8_t addr_cycle_mode, const ble_gap_addr_t *p_addr) | |||
) |
Set local Bluetooth address.
- Note:
- If the address cycle mode is BLE_GAP_ADDR_CYCLE_MODE_AUTO, the address type is required to be BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE or BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE. The given address is ignored and the SoftDevice will generate a new private address automatically every BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S seconds. If this API call is used again with the same parameters, the SoftDevice will immediately generate a new private address to replace the current address.
- If the application wishes to use a BLE_GAP_ADDR_TYPE_PUBLIC or BLE_GAP_ADDR_TYPE_RANDOM_STATIC address, the cycle mode must be BLE_GAP_ADDR_CYCLE_MODE_NONE.
-
If this API function is called while advertising or scanning, the softdevice will immediately update the advertising or scanning address without the need to stop the procedure in the following cases:
- If the previously set address is of type BLE_GAP_ADDR_TYPE_PUBLIC and the new address is also of type BLE_GAP_ADDR_TYPE_PUBLIC
- If the previously set address is not BLE_GAP_ADDR_TYPE_PUBLIC and the new address is also not BLE_GAP_ADDR_TYPE_PUBLIC. If the address is changed from a BLE_GAP_ADDR_TYPE_PUBLIC address to another type or from another type to a BLE_GAP_ADDR_TYPE_PUBLIC address, the change will take effect the next time an advertising or scanning procedure is started.
- If the address cycle mode is BLE_GAP_ADDR_CYCLE_MODE_NONE and the application is using privacy, the application must take care to generate and set new private addresses periodically to comply with the Privacy specification in Bluetooth Core Spec.
- Parameters:
-
[in] addr_cycle_mode Address cycle mode, see GAP Address cycle modes. [in] p_addr Pointer to address structure.
- Return values:
-
NRF_SUCCESS Address successfully set. NRF_ERROR_INVALID_ADDR Invalid pointer supplied. NRF_ERROR_INVALID_PARAM Invalid parameters. BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid address. NRF_ERROR_BUSY The stack is busy, process pending events and retry. NRF_ERROR_INVALID_STATE Invalid state to perform operation.
SVCALL | ( | SD_BLE_GAP_CONNECT_CANCEL | , |
uint32_t | , | ||
sd_ble_gap_connect_cancel(void) | |||
) |
Cancel a connection establishment.
- Return values:
-
NRF_SUCCESS Successfully cancelled an ongoing connection procedure. NRF_ERROR_INVALID_STATE Invalid state to perform operation.
SVCALL | ( | SD_BLE_GAP_CONNECT | , |
uint32_t | , | ||
sd_ble_gap_connect(ble_gap_addr_t const *p_peer_addr, ble_gap_scan_params_t const *p_scan_params, ble_gap_conn_params_t const *p_conn_params) | |||
) |
Create a connection (GAP Link Establishment).
- Note:
- To use the currently active whitelist set p_scan_params->p_whitelist to NULL.
- Parameters:
-
[in] p_peer_addr Pointer to peer address. If the selective bit is set in ble_gap_scan_params_t, then this must be NULL. [in] p_scan_params Pointer to scan parameters structure. [in] p_conn_params Pointer to desired connection parameters.
- Return values:
-
NRF_SUCCESS Successfully initiated connection procedure. NRF_ERROR_INVALID_ADDR Invalid parameter(s) pointer supplied. NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. NRF_ERROR_INVALID_STATE Invalid state to perform operation. BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid Peer address. NRF_ERROR_NO_MEM limit of available connections reached. NRF_ERROR_BUSY The stack is busy, process pending events and retry. If another connection is being established wait for the corresponding BLE_GAP_EVT_CONNECTED event before calling again. BLE_ERROR_GAP_WHITELIST_IN_USE Unable to replace the whitelist while another operation is using it.
SVCALL | ( | SD_BLE_GAP_SCAN_STOP | , |
uint32_t | , | ||
sd_ble_gap_scan_stop(void) | |||
) |
Stop scanning (GAP Discovery procedure, Observer Procedure).
- Return values:
-
NRF_SUCCESS Successfully stopped scanning procedure. NRF_ERROR_INVALID_STATE Invalid state to perform operation (most probably not in scanning state).
SVCALL | ( | SD_BLE_GAP_SCAN_START | , |
uint32_t | , | ||
sd_ble_gap_scan_start(ble_gap_scan_params_t const *p_scan_params) | |||
) |
Start scanning (GAP Discovery procedure, Observer Procedure).
- Note:
- To use the currently active whitelist set p_scan_params->p_whitelist to NULL.
- Parameters:
-
[in] p_scan_params Pointer to scan parameters structure.
- Return values:
-
NRF_SUCCESS Successfully initiated scanning procedure. NRF_ERROR_INVALID_ADDR Invalid pointer supplied. NRF_ERROR_INVALID_STATE Invalid state to perform operation. NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. NRF_ERROR_BUSY The stack is busy, process pending events and retry. BLE_ERROR_GAP_WHITELIST_IN_USE Unable to replace the whitelist while another operation is using it.
SVCALL | ( | SD_BLE_GAP_RSSI_GET | , |
uint32_t | , | ||
sd_ble_gap_rssi_get(uint16_t conn_handle, int8_t *p_rssi) | |||
) |
Get the received signal strength for the last connection event.
- Parameters:
-
[in] conn_handle Connection handle. [out] p_rssi Pointer to the location where the RSSI measurement shall be stored.
sd_ble_gap_rssi_start must be called to start reporting RSSI before using this function. NRF_ERROR_NOT_FOUND will be returned until RSSI was sampled for the first time after calling sd_ble_gap_rssi_start.
- Return values:
-
NRF_SUCCESS Successfully read the RSSI. NRF_ERROR_NOT_FOUND No sample is available. NRF_ERROR_INVALID_ADDR Invalid pointer supplied. BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. NRF_ERROR_INVALID_STATE RSSI reporting is not ongoing, or disconnection in progress.
SVCALL | ( | SD_BLE_GAP_RSSI_STOP | , |
uint32_t | , | ||
sd_ble_gap_rssi_stop(uint16_t conn_handle) | |||
) |
Stop reporting the received signal strength.
- Note:
- 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.
- Return values:
-
NRF_SUCCESS Successfully deactivated RSSI reporting. NRF_ERROR_INVALID_STATE Invalid state to perform operation. BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
SVCALL | ( | SD_BLE_GAP_RSSI_START | , |
uint32_t | , | ||
sd_ble_gap_rssi_start(uint16_t conn_handle, uint8_t threshold_dbm, uint8_t skip_count) | |||
) |
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. [in] threshold_dbm Minimum change in dBm before triggering the BLE_GAP_EVT_RSSI_CHANGED event. Events are disabled if threshold_dbm equals BLE_GAP_RSSI_THRESHOLD_INVALID. [in] skip_count Number of RSSI samples with a change of threshold_dbm or more before sending a new BLE_GAP_EVT_RSSI_CHANGED event.
- Return values:
-
NRF_SUCCESS Successfully activated RSSI reporting. NRF_ERROR_INVALID_STATE Disconnection in progress. Invalid state to perform operation. BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
SVCALL | ( | SD_BLE_GAP_CONN_SEC_GET | , |
uint32_t | , | ||
sd_ble_gap_conn_sec_get(uint16_t conn_handle, ble_gap_conn_sec_t *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.
- Return values:
-
NRF_SUCCESS Current connection security successfully retrieved. NRF_ERROR_INVALID_ADDR Invalid pointer supplied. BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
SVCALL | ( | SD_BLE_GAP_SEC_INFO_REPLY | , |
uint32_t | , | ||
sd_ble_gap_sec_info_reply(uint16_t conn_handle, ble_gap_enc_info_t const *p_enc_info, ble_gap_irk_t const *p_id_info, ble_gap_sign_info_t 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_id_info Pointer to a ble_gap_irk_t identity 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 yet supported, and p_sign_info must therefore be NULL.
- Return values:
-
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.
SVCALL | ( | SD_BLE_GAP_ENCRYPT | , |
uint32_t | , | ||
sd_ble_gap_encrypt(uint16_t conn_handle, ble_gap_master_id_t const *p_master_id, ble_gap_enc_info_t const *p_enc_info) | |||
) |
Initiate GAP Encryption procedure.
- Parameters:
-
[in] conn_handle Connection handle. [in] p_master_id Pointer to a ble_gap_master_id_t master identification structure. [in] p_enc_info Pointer to a ble_gap_enc_info_t encryption information structure.
In the central role, this function will initiate the encryption procedure using the encryption information provided.
- Note:
- Calling this function may result in the following event depending on the outcome and parameters: BLE_GAP_EVT_CONN_SEC_UPDATE.
- Return values:
-
NRF_SUCCESS Successfully initiated authentication procedure. NRF_ERROR_INVALID_ADDR Invalid pointer supplied. NRF_ERROR_INVALID_STATE Invalid state to perform operation. BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. BLE_ERROR_INVALID_ROLE Operation is not supported in the Peripheral role. NRF_ERROR_BUSY Procedure already in progress or not allowed at this time, wait for pending procedures to complete and retry.
SVCALL | ( | SD_BLE_GAP_AUTH_KEY_REPLY | , |
uint32_t | , | ||
sd_ble_gap_auth_key_reply(uint16_t conn_handle, uint8_t key_type, uint8_t const *p_key) | |||
) |
Reply with an authentication key.
- Parameters:
-
[in] conn_handle Connection handle. [in] key_type See GAP Authentication Key Types. [in] p_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.
- Return values:
-
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.
SVCALL | ( | SD_BLE_GAP_SEC_PARAMS_REPLY | , |
uint32_t | , | ||
sd_ble_gap_sec_params_reply(uint16_t conn_handle, uint8_t sec_status, ble_gap_sec_params_t const *p_sec_params, ble_gap_sec_keyset_t const *p_sec_keyset) | |||
) |
Reply with GAP security parameters.
- Parameters:
-
[in] conn_handle Connection handle. [in] sec_status Security status, see GAP Security status. [in] p_sec_params Pointer to a ble_gap_sec_params_t security parameters structure. In the central role this must be set to NULL, as the parameters have already been provided during a previous call to sd_ble_gap_authenticate. [in,out] p_sec_keyset Pointer to a ble_gap_sec_keyset_t security keyset structure. Any keys distributed as a result of the ongoing security procedure will be stored into the memory referenced by the pointers inside this structure. The keys will be stored and available to the application upon reception of a BLE_GAP_EVT_AUTH_STATUS event. The pointer to the ID key data distributed by the local device constitutes however an exception. It can either point to ID key data filled in by the user before calling this function, in which case a user-supplied Bluetooth address and IRK will be distributed, or the pointer to the ID key data structure can be NULL, in which case the device's configured (or default, if none is configured) Bluetooth address and IRK will be distributed.
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.
- Return values:
-
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.
SVCALL | ( | SD_BLE_GAP_AUTHENTICATE | , |
uint32_t | , | ||
sd_ble_gap_authenticate(uint16_t conn_handle, ble_gap_sec_params_t const *p_sec_params) | |||
) |
Initiate the 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 or bonding procedure. In the peripheral role, only the timeout, bond and mitm fields of this structure are used. In the central role, this pointer may be NULL to reject a Security Request.
In the central role, this function will send an SMP Pairing Request (or an SMP Pairing Failed if rejected), otherwise in the peripheral role, an SMP Security Request will be sent.
- Note:
- 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_CONN_SEC_UPDATE, BLE_GAP_EVT_AUTH_STATUS.
- Return values:
-
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. NRF_ERROR_BUSY The stack is busy, process pending events and retry. BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. NRF_ERROR_TIMEOUT A SMP timout has occured, and further SMP operations on this link is prohibited.
SVCALL | ( | SD_BLE_GAP_DEVICE_NAME_GET | , |
uint32_t | , | ||
sd_ble_gap_device_name_get(uint8_t *p_dev_name, uint16_t *p_len) | |||
) |
Get GAP device name.
- Parameters:
-
[out] 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.
- Return values:
-
NRF_SUCCESS GAP device name retrieved successfully. NRF_ERROR_INVALID_ADDR Invalid pointer supplied. NRF_ERROR_DATA_SIZE Invalid data size(s) supplied.
SVCALL | ( | SD_BLE_GAP_DEVICE_NAME_SET | , |
uint32_t | , | ||
sd_ble_gap_device_name_set(ble_gap_conn_sec_mode_t const *p_write_perm, uint8_t 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).
- Return values:
-
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.
SVCALL | ( | SD_BLE_GAP_PPCP_GET | , |
uint32_t | , | ||
sd_ble_gap_ppcp_get(ble_gap_conn_params_t *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.
- Return values:
-
NRF_SUCCESS Peripheral Preferred Connection Parameters retrieved successfully. NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
SVCALL | ( | SD_BLE_GAP_PPCP_SET | , |
uint32_t | , | ||
sd_ble_gap_ppcp_set(ble_gap_conn_params_t 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.
- Return values:
-
NRF_SUCCESS Peripheral Preferred Connection Parameters set successfully. NRF_ERROR_INVALID_ADDR Invalid pointer supplied. NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
SVCALL | ( | SD_BLE_GAP_APPEARANCE_GET | , |
uint32_t | , | ||
sd_ble_gap_appearance_get(uint16_t *p_appearance) | |||
) |
Get GAP Appearance value.
- Parameters:
-
[out] p_appearance Pointer to appearance (16-bit) to be filled in, see Bluetooth Appearance values.
- Return values:
-
NRF_SUCCESS Appearance value retrieved successfully. NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
SVCALL | ( | SD_BLE_GAP_APPEARANCE_SET | , |
uint32_t | , | ||
sd_ble_gap_appearance_set(uint16_t appearance) | |||
) |
Set GAP Appearance value.
- Parameters:
-
[in] appearance Appearance (16-bit), see Bluetooth Appearance values.
- Return values:
-
NRF_SUCCESS Appearance value set successfully. NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
SVCALL | ( | SD_BLE_GAP_TX_POWER_SET | , |
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.
- Return values:
-
NRF_SUCCESS Successfully changed the transmit power. NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
SVCALL | ( | SD_BLE_GAP_DISCONNECT | , |
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 Bluetooth status codes (accepted values are BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION and BLE_HCI_CONN_INTERVAL_UNACCEPTABLE).
- Return values:
-
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).
SVCALL | ( | SD_BLE_GAP_CONN_PARAM_UPDATE | , |
uint32_t | , | ||
sd_ble_gap_conn_param_update(uint16_t conn_handle, ble_gap_conn_params_t 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.
This function can be used as a central both to reply to a BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST or to start the procedure unrequested.
- 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. If NULL is provided on a central role and in response to a BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST, the peripheral request will be rejected
- Return values:
-
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_INVALID_STATE Invalid state to perform operation. NRF_ERROR_BUSY Procedure already in progress or not allowed at this time, process pending events and wait for pending procedures to complete and retry. BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. NRF_ERROR_NO_MEM Not enough memory to complete operation.
SVCALL | ( | SD_BLE_GAP_ADV_STOP | , |
uint32_t | , | ||
sd_ble_gap_adv_stop(void) | |||
) |
Stop advertising (GAP Discoverable, Connectable modes, Broadcast Procedure).
- Return values:
-
NRF_SUCCESS The BLE stack has stopped advertising. NRF_ERROR_INVALID_STATE Invalid state to perform operation (most probably not in advertising state).
SVCALL | ( | SD_BLE_GAP_ADV_START | , |
uint32_t | , | ||
sd_ble_gap_adv_start(ble_gap_adv_params_t const *p_adv_params) | |||
) |
Start advertising (GAP Discoverable, Connectable modes, Broadcast Procedure).
- Note:
- An application can start an advertising procedure for broadcasting purposes while a connection is active. After a BLE_GAP_EVT_CONNECTED event is received, this function may therefore be called to start a broadcast advertising procedure. The advertising procedure cannot however be connectable (it must be of type BLE_GAP_ADV_TYPE_ADV_SCAN_IND or BLE_GAP_ADV_TYPE_ADV_NONCONN_IND).
- Only one advertiser may be active at any time.
- To use the currently active whitelist set p_adv_params->p_whitelist to NULL.
- Parameters:
-
[in] p_adv_params Pointer to advertising parameters structure.
- Return values:
-
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. NRF_ERROR_BUSY The stack is busy, process pending events and retry. BLE_ERROR_GAP_WHITELIST_IN_USE Unable to replace the whitelist while another operation is using it.
SVCALL | ( | SD_BLE_GAP_ADV_DATA_SET | , |
uint32_t | , | ||
sd_ble_gap_adv_data_set(uint8_t const *p_data, uint8_t dlen, uint8_t const *p_sr_data, uint8_t srdlen) | |||
) |
Set, clear or update advertising and scan response data.
- Note:
- The format of the advertising 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 advertising data and scan response data.
- To clear the advertising 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 advertising packet. If NULL, no changes are made to the current advertising 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.
- Return values:
-
NRF_SUCCESS Advertising 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. NRF_ERROR_NOT_SUPPORTED Unsupported data type. BLE_ERROR_GAP_UUID_LIST_MISMATCH Invalid UUID list supplied.
SVCALL | ( | SD_BLE_GAP_ADDRESS_GET | , |
uint32_t | , | ||
sd_ble_gap_address_get(ble_gap_addr_t *p_addr) | |||
) |
Get local Bluetooth address.
- Parameters:
-
[out] p_addr Pointer to address structure to be filled in.
- Return values:
-
NRF_SUCCESS Address successfully retrieved. NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
Generated on Tue Jul 12 2022 19:00:13 by
![doxygen](doxygen.png)