nrf/bluetooth: Improve advertisment behavior for nrf52 targets.

This patch makes sure that advertisment data is located in
persistent static RAM memory throughout the advertisment.

Also, setting m_adv_handle to predifined
BLE_GAP_ADV_SET_HANDLE_NOT_SET value to indicate first time
usage of the handle. Upon first advertisment configuration
this will be populated with a handle value returned by the
stack (s132/s140).
This commit is contained in:
Glenn Ruben Bakke 2019-02-19 20:48:50 +01:00
parent ee3a01f25c
commit 0c6f5bc529
1 changed files with 2 additions and 2 deletions

View File

@ -109,7 +109,7 @@ static mp_obj_t mp_gattc_char_data_observer;
#define BLE_GAP_ADV_MAX_SIZE 31
#define BLE_DRV_CONN_CONFIG_TAG 1
static uint8_t m_adv_handle;
static uint8_t m_adv_handle = BLE_GAP_ADV_SET_HANDLE_NOT_SET;
static uint8_t m_scan_buffer[BLE_GAP_SCAN_BUFFER_MIN];
nrf_nvic_state_t nrf_nvic_state = {0};
@ -407,7 +407,7 @@ bool ble_drv_advertise_data(ubluepy_advertise_data_t * p_adv_params) {
uint8_t byte_pos = 0;
uint8_t adv_data[BLE_GAP_ADV_MAX_SIZE];
static uint8_t adv_data[BLE_GAP_ADV_MAX_SIZE];
if (p_adv_params->device_name_len > 0) {
ble_gap_conn_sec_mode_t sec_mode;