Hi,Sir:
I am making a DEMO based on SDK15.0(SDK15.0\examples\ble_central\ble_app_hrs_c) and pca10056 for my one of important customs.I need to implement some extra software features as flowing:
- implement BLE host client that can find a peripheral all services include SIG service and private service(this function seems as PC /Android’s nRF connect) .
- The BLE host client can find corresponding characteristics and of the peripheral service.
For BLE SIG services, I can register them in advance one by one through uint32_t ble_db_discovery_evt_register(ble_uuid_t const * p_uuid) function,then discover services and corresponding characteristics of the services;but for private service,the user cannot know the UUID of the private service of the BLE peripheral in advance, and does not know how many private services are provided outside the BLE peripheral.
So, for the BLE host client find BLE peripheral several private services that cannot be known in advance, do you have any situation?
I tried to modify some code to find BLE private service:
from(SDK\nRF5_SDK_15.0.0_a53641a\examples\ble_central\ble_app_hrs_c\pca10056)as flowing:
replace
// err_code = sd_ble_gattc_primary_services_discover(conn_handle,
// SRV_DISC_START_HANDLE,
// &(p_srv_being_discovered->srv_uuid));
with
err_code = sd_ble_gattc_primary_services_discover(conn_handle,
SRV_DISC_START_HANDLE,
NULL);
But I only get two services ,their 0x 1800和 0x1801 on on_primary_srv_discovery_rsp().
Attachment program and print information:
p_prim_srvc_disc_rsp_evt = &(p_ble_gattc_evt->params.prim_srvc_disc_rsp);
p_srv_being_discovered->srv_uuid = p_prim_srvc_disc_rsp_evt->services[0].uuid;
p_srv_being_discovered->handle_range = p_prim_srvc_disc_rsp_evt->services[0].handle_range;
NRF_LOG_DEBUG("Current service count = %d.", p_prim_srvc_disc_rsp_evt->count);
for(uint8_t i= 0;i< p_prim_srvc_disc_rsp_evt->count;i++)
{
NRF_LOG_DEBUG("Found a %d type service UUID 0x%04X", p_prim_srvc_disc_rsp_evt->services[i].uuid.type,
p_prim_srvc_disc_rsp_evt->services[i].uuid.uuid);
NRF_LOG_DEBUG("The service handle range:0x%04X--0x%04X", p_prim_srvc_disc_rsp_evt->services[i].handle_range.start_handle,
p_prim_srvc_disc_rsp_evt->services[i].handle_range.end_handle);
}
<debug> ble_db_disc: Starting discovery of service with UUID 0x0 on connection handle 0x0.
<debug> ble_db_disc: Current service count = 2.
<debug> ble_db_disc: Found a 1 type service UUID 0x1800
<debug> ble_db_disc: The service handle range:0x0001--0x0009
<debug> ble_db_disc: Found a 1 type service UUID 0x1801
<debug> ble_db_disc: The service handle range:0x000A--0x000A