Hi,
I am working on the heart_rate_collector example code of nrf51-ble-driver_linux_0.5.0. When I use "sd_ble_opt_set" to set channel map as below, the API will retrun NRF_SUCCESS
ble_opt_t new_opt_config;
memset(&new_opt_config, 0, sizeof(new_opt_config));
new_opt_config.gap_opt.ch_map.ch_map[0] = 0xFF;
new_opt_config.gap_opt.ch_map.ch_map[1] = 0x0F;
new_opt_config.gap_opt.ch_map.ch_map[2] = 0x00;
new_opt_config.gap_opt.ch_map.ch_map[3] = 0x00;
new_opt_config.gap_opt.ch_map.ch_map[4] = 0x00;
err_code = sd_ble_opt_set(BLE_GAP_OPT_CH_MAP, &new_opt_config);
printf(" err =%x\n",err_code);
err_code = sd_ble_gap_connect(&(p_ble_gap_evt->params.adv_report.peer_addr),
&m_scan_param,
&m_connection_param);
But when I check the current active channel map during the connection, the API will return BLE_ERROR_INVALID_CONN_HANDLE
static void ble_evt_dispatch(ble_evt_t * p_ble_evt) {
uint32_t err_code;
const ble_gap_evt_t * p_gap_evt = &p_ble_evt->evt.gap_evt;
...
...
case BLE_GAP_EVT_CONN_PARAM_UPDATE:
printf("[%s]:BLE_GAP_EVT_CONN_PARAM_UPDATE\n",__func__); fflush(stdout);
ble_opt_t opt;
memset(&opt, 0, sizeof(opt));
opt.gap_opt.ch_map.conn_handle = p_gap_evt->conn_handle;
uint32_t error_code = sd_ble_opt_get(BLE_GAP_OPT_CH_MAP, &opt);
printf("error_code =%x, ChMap %02X %02X %02X %02X %02X\r\n",error_code,
opt.gap_opt.ch_map.ch_map[0], opt.gap_opt.ch_map.ch_map[1],
opt.gap_opt.ch_map.ch_map[2],opt.gap_opt.ch_map.ch_map[3],
opt.gap_opt.ch_map.ch_map[4]);
break;}
Does anyone tell me how can I handle "sd_ble_opt_get(BLE_GAP_OPT_CH_MAP, &opt)" ?
Thanks