Edit 1
To narrow down I did this... Below is ble_dfu_init()
from ble_dfu.c.
uint32_t ble_dfu_init(ble_dfu_t * p_dfu, const ble_dfu_init_t * p_dfu_init)
{
uint32_t err_code;
ble_uuid_t ble_uuid;
ble_uuid128_t nus_base_uuid = BLE_DFU_BASE_UUID;
VERIFY_PARAM_NOT_NULL(p_dfu);
VERIFY_PARAM_NOT_NULL(p_dfu_init);
p_m_dfu = p_dfu; // TODO: find a nicer solution to this
// Initialize the service structure.
p_dfu->conn_handle = BLE_CONN_HANDLE_INVALID;
p_dfu->evt_handler = p_dfu_init->evt_handler;
p_dfu->is_waiting_for_disconnection = false;
p_dfu->is_ctrlpt_notification_enabled = false;
==>5
/**@snippet [Adding proprietary Service to S110 SoftDevice] */
// Add a custom base UUID.
err_code = sd_ble_uuid_vs_add(&nus_base_uuid, &p_dfu->uuid_type);
VERIFY_SUCCESS(err_code);
ble_uuid.type = p_dfu->uuid_type;
ble_uuid.uuid = BLE_UUID_DFU_SERVICE;
==>4
// Add the service.
err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
&ble_uuid,
&p_dfu->service_handle);
/**@snippet [Adding proprietary Service to S110 SoftDevice] */
VERIFY_SUCCESS(err_code);
==>3
// Add the RX Characteristic.
err_code = rx_char_add(p_dfu, p_dfu_init);
VERIFY_SUCCESS(err_code);
==>2
err_code = nrf_dfu_flash_init(true);
VERIFY_SUCCESS(err_code);
==>1
nrf_dfu_settings_init();
#endif
return NRF_SUCCESS;
}
Keeping the #endif
at the same location I kept moving #if 0
from 1 till 5. Till 4, service discovery for my custom service fails. At 5, Eureka!! My custom service is detected.
Why sd_ble_uuid_vs_add()
for DFU is interfering with my custom service detection? I guess there is some problem with sd_ble_uuid_vs_add()
, can someone please prove me wrong?
Original question
I have a vendor specific service and DFU service included in my application. When service discovery begins for vendor specific service it arrives at the below point in on_primary_srv_discovery_rsp()
else
{
==>NRF_LOG_INFO("Service UUID 0x%x Not found\r\n", p_srv_being_discovered->srv_uuid.uuid);
// Trigger Service Not Found event to the application.
discovery_complete_evt_trigger(p_db_discovery,
false,
p_ble_gattc_evt->conn_handle);
on_srv_disc_completion(p_db_discovery,
p_ble_gattc_evt->conn_handle);
}
The response in p_ble_gattc_evt->gatt_status
is 0x010a
that is BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND
.
But when DFU service is removed then my application works fine. Also, during initialisation, DFU service is getting initialised first and later vendor specific service is initialised. When I change the sequence of initialisation, the vendor specific service works fine but db discovery for DFU fails now.
Note that I have made vs_uuid_count=2
in softdevice_handler.c and I have also changed the app_ram_base in my linker file accordingly.
Is this a known issue?