136***060
参考例子: \GR551x_SDK_V2.0.2\projects\ble\ble_central\ble_app_uart_c\
如下代码, 能在"BLE_GAPM_EVT_ADV_REPORT"事件中拿到对端的MAC, 但是却不能实现自动连接。 请教可能的原因, 谢谢。
scan_init.conn_param.type = BLE_GAP_INIT_TYPE_DIRECT_CONN_EST;
....
scan_init.connect_auto = true;
scan_init.err_handler = NULL;
scan_init.evt_handler = ble_scanner_evt_handler;
// filter_data.svr_uuid.length = UART_UUID_LEN;
// filter_data.svr_uuid.p_data = s_target_uuid;
filter_data.dev_name.length = strlen(s_target_name);
filter_data.dev_name.p_data = (uint8_t *)s_target_name;
filter_data.target_addr.addr_type = BLE_GAP_ADDR_TYPE_PUBLIC;
memcpy(filter_data.target_addr.gap_addr.addr, s_target_addr, SYS_BD_ADDR_LEN);
ble_scanner_filter_set(BLE_SCANNER_NAME_FILTER|BLE_SCANNER_ADDR_FILTER, &filter_data);
error_code = ble_scanner_init(&scan_init);
APP_ERROR_CHECK(error_code);
ble_scanner_filter_enable(BLE_SCANNER_FILTER_ANYONE_MATCH);
error_code = ble_scanner_start();
APP_ERROR_CHECK(error_code);
zhongchengzhi
您好,您这边检查下扫描的时候,代码能到如下地方么?若不能,检查下原因呢:
打开微信,使用“扫一扫”即可关注