This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

advdata address type set in Public and advdata packet was all zero

Hi,here i met an issue that when i set address type in public mode by funtion sd_ble_gap_address_set(),and then the advdata packet data was all zereo.This project was created on the SDK8.0 template demo.Could you help me solve this problem?

/**@brief Function for initializing the Advertising functionality. */ static void advertising_init(void) { uint32_t err_code; ble_advdata_t advdata; ble_advdata_t scanrsp;

// Build advertising data struct to pass into @ref ble_advertising_init.
memset(&advdata, 0, sizeof(advdata));
advdata.name_type               = BLE_ADVDATA_FULL_NAME;												
advdata.include_appearance      = true;
advdata.flags                   = BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE;
advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
advdata.uuids_complete.p_uuids  = m_adv_uuids;

ble_adv_modes_config_t options = {0};
options.ble_adv_fast_enabled  = BLE_ADV_FAST_ENABLED;
options.ble_adv_fast_interval = APP_ADV_INTERVAL;																	
options.ble_adv_fast_timeout  = APP_ADV_TIMEOUT_IN_SECONDS;	

err_code = ble_advertising_init(&advdata, NULL, &options, on_adv_evt, NULL);	
APP_ERROR_CHECK(err_code);

}

static void gap_params_init(void) { uint32_t err_code; ble_gap_conn_params_t gap_conn_params; ble_gap_conn_sec_mode_t sec_mode; ble_gap_addr_t gapaddr;

static uint8_t address[6]={0x7E,0x21,0x8E,0xBE,0x89,0x8E};
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);

gapaddr.addr_type = BLE_GAP_ADDR_TYPE_PUBLIC;;
memset(&gapaddr.addr, 0x00, sizeof(gapaddr.addr));
memcpy(&gapaddr.addr, address, sizeof(gapaddr.addr));

err_code = sd_ble_gap_address_set(BLE_GAP_ADDR_CYCLE_MODE_NONE, &gapaddr);
APP_ERROR_CHECK(err_code);

err_code = sd_ble_gap_device_name_set(&sec_mode,
                                      (const uint8_t *) DEVICE_NAME,
                                      strlen(DEVICE_NAME));
APP_ERROR_CHECK(err_code);

err_code = sd_ble_gap_appearance_set(BLE_APPEARANCE_GENERIC_MEDIA_PLAYER);
APP_ERROR_CHECK(err_code);

memset(&gap_conn_params, 0, sizeof(gap_conn_params));

gap_conn_params.min_conn_interval = MIN_CONN_INTERVAL;
gap_conn_params.max_conn_interval = MAX_CONN_INTERVAL;
gap_conn_params.slave_latency     = SLAVE_LATENCY;
gap_conn_params.conn_sup_timeout  = CONN_SUP_TIMEOUT;

err_code = sd_ble_gap_ppcp_set(&gap_conn_params);
APP_ERROR_CHECK(err_code);

err_code = sd_ble_gap_tx_power_set(TX_POWER_LEVEL);    
APP_ERROR_CHECK(err_code);

}

Parents Reply Children
No Data
Related