3.1.3.1
Setting the Advertisement Payload (ble_advertisement_data_set)
Prototype
–
at_ble_status_t at_ble_adv_data_set (uint8_t const *const adv_data,
uint8_t adv_data_len,
uint8_t const *const scan_resp_data,
uint8_t scan_response_data_len);
Description
– Set, clear or update the advertisement and scan response data.
Parameters
–
•
adv_data
– Raw data to be placed in advertisement packet
•
adv_data_len
– Data length for
adv_data
. Max size: 28 bytes (3 bytes are reserved to set
advertising AD type flags based on the selected Advertising mode and the user is not required to
configure AD type flags in the advertisement payload)
•
scan_resp_data
– Raw data to be placed in the scan response packet. If NULL, no changes are
made to the current scan response packet data
•
scan_response_data_len
– Data length for
scan_resp_data
. Max size: 31 bytes
Return
– Execution Status
This function requires a parameter raw "
adv_data
" to be sent to central. Following is an example of its
definition:
static uint8_t adv_data[] = {
0x11, // AD1 length = 17
0x03, // AD1 Type = Complete list of 128-bit UUIDs
0x1b,0xc5,0xd5,0xa5,
0x02,0x00,0xa6,0x87,// AD1 = UUID MSBs
0xe5,0x11,0x36,0x39,//
0xc0,0xba,0x5a,0xf0,//
0x0A,// AD2 Length = 10
0x09,// AD2 Type = Complete local Name
‘M’,’y’,’_’,’D’,’E’,’V’ // AD2 = “My_DEV”
};
3.1.3.2
Starting the Advertisement Process (at_ble_adv_start)
Prototype
–
at_ble_status_t at_ble_adv_start (at_ble_adv_type_t type
at_ble_adv_mode_t mode,
at_ble_addr_t *peer_addr,
at_ble_filter_type_t filtered,
uint16_t interval,
uint16_t timeout,
bool disable_randomness);
Description
– Start advertisement process.
Parameters
–
•
type
– Advertising type to be used, can be:
–
AT_BLE_ADV_TYPE_UNDIRECTED
–
AT_BLE_ADV_TYPE_DIRECTED
–
AT_BLE_ADV_TYPE_SCANNABLE_UNDIRECTED
–
AT_BLE_ADV_TYPE_NONCONN_UNDIRECTED
–
AT_BLE_ADV_TYPE_DIRECTED_LDC
–
AT_BLE_ADV_TYPE_SCAN_RESPONSE
•
mode
– Advertising mode to be used, can be:
ATBTLC1000
Establishing Connection with Central Device
©
2017 Microchip Technology Inc.
Training Manual
DS00002599A-page 22