6626的连接参数更新示例,下面以simple工程为例 1.找到app_adv.c文件app_adv_event_cb static void app_adv_event_cb(uint16_t evt_id, const omble_evt_t *evt) { if (evt_id == OB_GAP_EVT_CONNECTED) { log_debug("OB_GAP_EVT_CONNECTED(%d): %d\n", evt->gap.conn_idx, evt->gap.connected.adv_idx); memcpy(&last_conn, &evt->gap.connected.peer_addr, sizeof(ob_gap_addr_t)); evt_timer_set(&ble_update_conn_param_timer, 2000, EVT_TIMER_ONE_SHOT, ble_update_conn_param_timer_cb, NULL); } else if (evt_id == OB_GAP_EVT_DISCONNECTED) { log_debug("OB_GAP_EVT_DISCONNECTED(%d): 0x%02X\n", evt->gap.conn_idx, evt->gap.disconnected.reason); ob_gap_adv_start(0, &adv_param, &adv_data, &scan_rsp_data); } else if (evt_id == OB_GAP_EVT_ADV_STATE_CHANGED) { log_debug("OB_GAP_EVT_ADV_STATE_CHANGED(%d), reason:%d\n", evt->gap.adv_state_changed.adv_idx, evt->gap.adv_state_changed.state); } else { } } 2.修改连接参数回调 static evt_timer_t ble_update_conn_param_timer; //ob_gap_conn_params_t param1; static void ble_update_conn_param_timer_cb(evt_timer_t *timer, void *param) { ob_gap_conn_params_t param1 = {14, 0, 500}; ob_gap_conn_param_update(0, ¶m1); } /**** |