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
Advertising and Scan Response Data Encoder
Functions for encoding data in the Advertising and Scan Response Data format, and for passing the data to the stack. More...
Data Structures | |
struct | ble_advdata_tk_value_t |
Security Manager TK value. More... | |
struct | ble_advdata_uuid_list_t |
UUID list type. More... | |
struct | ble_advdata_conn_int_t |
Connection interval range structure. More... | |
struct | ble_advdata_manuf_data_t |
Manufacturer specific data structure. More... | |
struct | ble_advdata_service_data_t |
Service data structure. More... | |
struct | ble_advdata_t |
Advertising data structure. More... | |
Enumerations | |
enum | ble_advdata_le_role_t { BLE_ADVDATA_ROLE_NOT_PRESENT = 0, BLE_ADVDATA_ROLE_ONLY_PERIPH, BLE_ADVDATA_ROLE_ONLY_CENTRAL, BLE_ADVDATA_ROLE_BOTH_PERIPH_PREFERRED, BLE_ADVDATA_ROLE_BOTH_CENTRAL_PREFERRED } |
Advertising data LE Role types. More... | |
enum | ble_advdata_name_type_t { BLE_ADVDATA_NO_NAME, BLE_ADVDATA_SHORT_NAME, BLE_ADVDATA_FULL_NAME } |
Advertising data name type. More... | |
Functions | |
uint32_t | adv_data_encode (ble_advdata_t const *const p_advdata, uint8_t *const p_encoded_data, uint16_t *const p_len) |
Function for encoding data in the Advertising and Scan Response data format (AD structures). | |
uint32_t | ble_advdata_set (const ble_advdata_t *p_advdata, const ble_advdata_t *p_srdata) |
Function for encoding and setting the advertising data and/or scan response data. |
Detailed Description
Functions for encoding data in the Advertising and Scan Response Data format, and for passing the data to the stack.
Enumeration Type Documentation
Advertising data LE Role types.
This enumeration contains the options available for the LE role inside the advertising data.
- Enumerator:
Definition at line 103 of file ble_advdata.h.
Advertising data name type.
This enumeration contains the options available for the device name inside the advertising data.
- Enumerator:
Definition at line 114 of file ble_advdata.h.
Function Documentation
uint32_t adv_data_encode | ( | ble_advdata_t const *const | p_advdata, |
uint8_t *const | p_encoded_data, | ||
uint16_t *const | p_len | ||
) |
Function for encoding data in the Advertising and Scan Response data format (AD structures).
This function encodes data into the Advertising and Scan Response data format (AD structures) based on the selections in the supplied structures. This function can be used to create a payload of Advertising packet or Scan Response packet, or a payload of NFC message intended for initiating the Out-of-Band pairing.
- Parameters:
-
[in] p_advdata Pointer to the structure for specifying the content of encoded data. [out] p_encoded_data Pointer to the buffer where encoded data will be returned. [in,out] p_len in:
Size ofp_encoded_data
buffer.out:
Length of encoded data.
- Return values:
-
NRF_SUCCESS If the operation was successful. NRF_ERROR_INVALID_PARAM If the operation failed because a wrong parameter was provided in p_advdata
.NRF_ERROR_DATA_SIZE If the operation failed because not all the requested data could fit into the provided buffer or some encoded AD structure is too long and its length cannot be encoded with one octet.
- Warning:
- This API may override the application's request to use the long name and use a short name instead. This truncation will occur in case the long name does not fit the provided buffer size. The application can specify a preferred short name length if truncation is required. For example, if the complete device name is ABCD_HRMonitor, the application can specify the short name length to be 8, so that the short device name appears as ABCD_HRM instead of ABCD_HRMo or ABCD_HRMoni if the available size for the short name is 9 or 12 respectively, to have a more appropriate short name. However, it should be noted that this is just a preference that the application can specify, and if the preference is too large to fit in the provided buffer, the name can be truncated further.
Definition at line 603 of file ble_advdata.c.
uint32_t ble_advdata_set | ( | const ble_advdata_t * | p_advdata, |
const ble_advdata_t * | p_srdata | ||
) |
Function for encoding and setting the advertising data and/or scan response data.
This function encodes advertising data and/or scan response data based on the selections in the supplied structures, and passes the encoded data to the stack.
- Parameters:
-
[in] p_advdata Structure for specifying the content of the advertising data. Set to NULL if advertising data is not to be set. [in] p_srdata Structure for specifying the content of the scan response data. Set to NULL if scan response data is not to be set.
- Return values:
-
NRF_SUCCESS If the operation was successful. NRF_ERROR_INVALID_PARAM If the operation failed because a wrong parameter was provided in p_advdata
.NRF_ERROR_DATA_SIZE If the operation failed because not all the requested data could fit into the advertising packet. The maximum size of the advertisement packet is BLE_GAP_ADV_MAX_SIZE.
- Warning:
- This API may override the application's request to use the long name and use a short name instead. This truncation will occur in case the long name does not fit the provided buffer size. The application can specify a preferred short name length if truncation is required. For example, if the complete device name is ABCD_HRMonitor, the application can specify the short name length to be 8, so that the short device name appears as ABCD_HRM instead of ABCD_HRMo or ABCD_HRMoni if the available size for the short name is 9 or 12 respectively, to have a more appropriate short name. However, it should be noted that this is just a preference that the application can specify, and if the preference is too large to fit in the provided buffer, the name can be truncated further.
Definition at line 805 of file ble_advdata.c.
Generated on Tue Jul 12 2022 19:00:13 by 1.7.2