This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ASK:why my service always found failed? thks

Dear nordic employee:

The service I want to find is the sound service of the thing52thingy sound service

I tried to modify the HRT_central_client project to find the sound service

follows is modify

{
ret_code_t err_code;

VERIFY_PARAM_NOT_NULL(p_ble_hrs_c);
VERIFY_PARAM_NOT_NULL(p_ble_hrs_c_init);

ble_uuid_t hrs_uuid;

hrs_uuid.type = BLE_UUID_TYPE_VENDOR_BEGIN;
ble_uuid128_t tss_base_uuid={0x42, 0x00, 0x74, 0xA9, 0xFF, 0x52, 0x10, 0x9B, 0x33, 0x49, 0x35, 0x9B, 0x00, 0x00, 0x68, 0xEF};

err_code =sd_ble_uuid_vs_add(&tss_base_uuid, &hrs_uuid.type);



NRF_LOG_INFO("err_code= %d.\r\n", err_code);
hrs_uuid.uuid = 0x0500;
hrs_uuid.type = BLE_UUID_TYPE_BLE;


p_ble_hrs_c->evt_handler                 = p_ble_hrs_c_init->evt_handler;
p_ble_hrs_c->conn_handle                 = BLE_CONN_HANDLE_INVALID;
p_ble_hrs_c->peer_hrs_db.hrm_cccd_handle = BLE_GATT_HANDLE_INVALID;
p_ble_hrs_c->peer_hrs_db.hrm_handle      = BLE_GATT_HANDLE_INVALID;

return ble_db_discovery_evt_register(&hrs_uuid);

}

I find sd_ble_uuid_vs_add return 4(NRF_ERROR_BASE_NUM)

blew is the pm_manager setting

#define SEC_PARAM_BOND 1 #define SEC_PARAM_MITM 0
#define SEC_PARAM_LESC 0
#define SEC_PARAM_KEYPRESS 0
#define SEC_PARAM_IO_CAPABILITIES 3
#define SEC_PARAM_OOB 0
#define SEC_PARAM_MIN_KEY_SIZE 7
#define SEC_PARAM_MAX_KEY_SIZE 16

{

ble_gap_sec_params_t sec_param;
ret_code_t err_code;

err_code = pm_init();
APP_ERROR_CHECK(err_code);

memset(&sec_param, 0, sizeof(ble_gap_sec_params_t));

// Security parameters to be used for all security procedures.
sec_param.bond           = SEC_PARAM_BOND;
sec_param.mitm           = SEC_PARAM_MITM;
sec_param.lesc           = SEC_PARAM_LESC;
sec_param.keypress       = SEC_PARAM_KEYPRESS;
sec_param.io_caps        = SEC_PARAM_IO_CAPABILITIES;
sec_param.oob            = SEC_PARAM_OOB;
sec_param.min_key_size   = SEC_PARAM_MIN_KEY_SIZE;
sec_param.max_key_size   = SEC_PARAM_MAX_KEY_SIZE;
sec_param.kdist_own.enc  = 1;
sec_param.kdist_own.id   = 1;
sec_param.kdist_peer.enc = 1;
sec_param.kdist_peer.id  = 1;

err_code = pm_sec_params_set(&sec_param);
APP_ERROR_CHECK(err_code);

err_code = pm_register(pm_evt_handler);
APP_ERROR_CHECK(err_code);

}

AND then I receive ble_db_discovery_evt_t p_evt->evt_type is BLE_DB_DISCOVERY_SRV_NOT_FOUND

but when I modify the uuid value in ble_db_discovery_evt_register :hrt uuid-》0x180f(the battery service of thingy52) then I receive ble_db_discovery_evt_t p_evt->evt_type is BLE_DB_DISCOVERY_COMPLETE

question:

1、should I use the 128bit UUID or 16 bit uuid? 2、how can I set the pm manager?should i change the hrt project pm manager setting?how?

thank you very much!

Related