use sdk:11.0
Reference routine:ble_nus_c
now I use 52832 to connect a device,the service UUID like the photo.
when I only discover one service UUID,like this code
uint32_t ble_nus_c_init(ble_nus_c_t * p_ble_nus_c, ble_nus_c_init_t * p_ble_nus_c_init) { uint32_t err_code; ble_uuid_t uart_uuid; ble_uuid128_t nus_base_uuid = NUS_BASE_UUID; VERIFY_PARAM_NOT_NULL(p_ble_nus_c); VERIFY_PARAM_NOT_NULL(p_ble_nus_c_init); err_code = sd_ble_uuid_vs_add(&nus_base_uuid, &p_ble_nus_c->uuid_type); VERIFY_SUCCESS(err_code); uart_uuid.type = p_ble_nus_c->uuid_type; uart_uuid.uuid = BLE_UUID_NUS_SERVICE; p_ble_nus_c->conn_handle = BLE_CONN_HANDLE_INVALID; p_ble_nus_c->evt_handler = p_ble_nus_c_init->evt_handler; p_ble_nus_c->handles.nus_rx_handle = BLE_GATT_HANDLE_INVALID; p_ble_nus_c->handles.nus_tx_handle = BLE_GATT_HANDLE_INVALID; err_code=ble_db_discovery_evt_register(&uart_uuid); return err_code; }
the center can connect the device,and send some command to control the device.
but when I add some code,want to discover the second service UUID,the code like this
uint32_t ble_nus_c_init2(ble_nus_c_t * p_ble_nus_c, ble_nus_c_init_t * p_ble_nus_c_init) { uint32_t err_code; ble_uuid_t uart_uuid2; ble_uuid128_t nus_base_uuid2 = NUS_BASE_UUID2; VERIFY_PARAM_NOT_NULL(p_ble_nus_c); VERIFY_PARAM_NOT_NULL(p_ble_nus_c_init); err_code = sd_ble_uuid_vs_add(&nus_base_uuid2, &p_ble_nus_c->uuid_type); VERIFY_SUCCESS(err_code); uart_uuid2.type = p_ble_nus_c->uuid_type; uart_uuid2.uuid = BLE_UUID_NUS_SERVICE2; p_ble_nus_c->conn_handle = BLE_CONN_HANDLE_INVALID; p_ble_nus_c->evt_handler = p_ble_nus_c_init->evt_handler; p_ble_nus_c->handles.nus_rx_handle = BLE_GATT_HANDLE_INVALID; p_ble_nus_c->handles.nus_tx_handle = BLE_GATT_HANDLE_INVALID; err_code = ble_db_discovery_evt_register(&uart_uuid2); return err_code; }
when the center to discover the second UUID,it always restart。
So how to reconige 2 service UUID