This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND

I used NRF connect to connect to a slave。

I want to use the central to connect to the device。

this is my code.

#define SERVICE1_BASE_UUID {{0x12, 0x19, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00}}

ble_uuid128_t ytzn_s1_base_uuid = SERVICE1_BASE_UUID;
ble_uuid_t ytzn_s1_uuid;

err_code = sd_ble_uuid_vs_add(&ytzn_s1_base_uuid, &p_ble_ytzn_c->s1_uuid_type);
if(err_code==NRF_SUCCESS)
SKY_LOG("uuid_vs_add OK\r\n");
VERIFY_SUCCESS(err_code);

ytzn_s1_uuid.type = p_ble_ytzn_c->s1_uuid_type;
ytzn_s1_uuid.uuid = SERVICE1_UUID;

err_code=ble_db_discovery_evt_register(&ytzn_s1_uuid);
if(err_code==NRF_SUCCESS)
{
NRF_LOG_INFO("discovery register S1 OK\r\n");

}

but the service is not found。

static void on_primary_srv_discovery_rsp(ble_db_discovery_t * const p_db_discovery,
const ble_gattc_evt_t * const p_ble_gattc_evt)
{
ble_gatt_db_srv_t * p_srv_being_discovered;
p_srv_being_discovered = &(p_db_discovery->services[p_db_discovery->curr_srv_ind]);

if (p_ble_gattc_evt->conn_handle != p_db_discovery->conn_handle)
{
return;
}
if (p_ble_gattc_evt->gatt_status == BLE_GATT_STATUS_SUCCESS)
{
uint32_t err_code;
const ble_gattc_evt_prim_srvc_disc_rsp_t * p_prim_srvc_disc_rsp_evt;
NRF_LOG_INFO("Found service UUID 0x%x\r\n", p_srv_being_discovered->srv_uuid.uuid);

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;

err_code = characteristics_discover(p_db_discovery,
p_ble_gattc_evt->conn_handle);
if (err_code != NRF_SUCCESS)
{
p_db_discovery->discovery_in_progress = false;

// Error with discovering the service.
// Indicate the error to the registered user application.
discovery_error_evt_trigger(p_db_discovery,
err_code,
p_ble_gattc_evt->conn_handle);

m_pending_user_evts[0].evt.evt_type = BLE_DB_DISCOVERY_AVAILABLE;
m_pending_user_evts[0].evt.conn_handle = p_ble_gattc_evt->conn_handle;
//m_evt_handler(&m_pending_user_evts[0].evt);
}
}
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);
}
}

and    p_ble_gattc_evt->gatt_status ==0X010A.

i use sniffer to get the packs.

In my understanding, this can find the service, where am I wrong?

thank you  very much.

Parents Reply Children
No Data
Related