Shalom!
In my central nrf52840 board we connect to a TI BLE sensor that has a customer UUID base service and the TI OAD base service both with 128 UUIDs. I succeeded in discovering both base services and sub-services but I would like to dynamically add the TI OAD service only when I need to update to TI sensor which will be rarely if ever. Currently I can always add at startup the TI OAD service detection but do not see a way to add it dynamically and then delete it. I would like to dynamically add the OAD when needed and then delete it.
This is my OAD service detection initialization:
uint32_t ble_oad_c_init(ble_oad_c_t * p_ble_oad_c, ble_oad_c_init_t * p_ble_oad_c_init)
{
ble_uuid_t oad_uuid;
ble_uuid128_t nus_base_uuid = ALFA_CM_UUID_OAD_BASE_SERVICE;
uint32_t err_code;
VERIFY_PARAM_NOT_NULL(p_ble_oad_c);
VERIFY_PARAM_NOT_NULL(p_ble_oad_c_init);
VERIFY_PARAM_NOT_NULL(p_ble_oad_c_init->p_gatt_queue);
err_code = sd_ble_uuid_vs_add(&nus_base_uuid, &p_ble_oad_c->uuid_type);
VERIFY_SUCCESS(err_code);
oad_uuid.type = p_ble_oad_c->uuid_type;
oad_uuid.uuid = ALFA_CM_UUID_OAD_SERVICE;
p_ble_oad_c->conn_handle = BLE_CONN_HANDLE_INVALID;
p_ble_oad_c->evt_handler = p_ble_oad_c_init->evt_handler;
p_ble_oad_c->error_handler = p_ble_oad_c_init->error_handler;
p_ble_oad_c->p_gatt_queue = p_ble_oad_c_init->p_gatt_queue;
memset(p_ble_oad_c->peer_oad_db.bl_handle,BLE_GATT_HANDLE_INVALID,sizeof(p_ble_oad_c->peer_oad_db.bl_handle));
memset(p_ble_oad_c->peer_oad_db.cccd_handle,BLE_GATT_HANDLE_INVALID,sizeof(p_ble_oad_c->peer_oad_db.cccd_handle));
return ble_db_discovery_evt_register(&oad_uuid);
} // ble_oad_c_init
Thanks
David