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

sd_ble_gattc_primary_services_discover(..) does not work properly.

hi dear Engineers!

if I use sd_ble_gattc_primary_services_discover(..) with NULL last parameter , all SERVICES discovered OK:

start_handle=0x0001;
err_code = sd_ble_gattc_primary_services_discover(p_gap_evt->conn_handle,
                                                                  start_handle,
                                                                  NULL);

but if I use searching by UUID (flollowing way) , no existing service discovered:

ble_enable_params.common_enable_params.vs_uuid_count = 2;// MAX Vendors UUIDs 128
//....
uint16_t uuid_sd_type = BLE_UUID_TYPE_VENDOR_BEGIN; // set VENDOR type of UUID 128
err_code = sd_ble_uuid_vs_add(&my_base_uuid[0], &uuid_sd_type );
err_code = sd_ble_uuid_vs_add(&my_base_uuid[1], &uuid_sd_type );
//....
start_handle=0x0001;
ble_uuid_t uuid16 = {.uuid=MY_UUID16, .type=BLE_UUID_TYPE_VENDOR_BEGIN};
err_code = sd_ble_gattc_primary_services_discover(p_gap_evt->conn_handle,
                                                                  start_handle,
                                                                  &uuid16);

from Documentation, ONLY two values are possible BLE_UUID_TYPE_BLE and BLE_UUID_TYPE_VENDOR_BEGIN. if I tried with any others, err_code of NRF_ERROR_INVALID_PARAM occured.

How to use sd_ble_gattc_primary_services_discover Correctly ?

Parents
  • See this:

    #define BLE_UUID_TYPE_VENDOR_BEGIN  0x02 /**< Vendor UUID types start at this index (128-bit). */
    

    The vendor UUID types start\begin at this index. So the first time you call sd_ble_uuid_vs_add() the returned type will be 0x02, the next time the returned type will be 0x03, and so on. This is a reference that you give to the SoftDevice so that it knows what base UUID to use together with the 16 bits that you give.

Reply
  • See this:

    #define BLE_UUID_TYPE_VENDOR_BEGIN  0x02 /**< Vendor UUID types start at this index (128-bit). */
    

    The vendor UUID types start\begin at this index. So the first time you call sd_ble_uuid_vs_add() the returned type will be 0x02, the next time the returned type will be 0x03, and so on. This is a reference that you give to the SoftDevice so that it knows what base UUID to use together with the 16 bits that you give.

Children
No Data
Related