How to use sd_ble_uuid_vs_remove after setting the BLE_GATTC_OPT_UUID_DISC option

The product I'm developing uses the nRF52840 (vendor Fanstel) controlled using pc-ble-driver.

I will use the BLE_GATTC_OPT_UUID_DISC option to cause the vendor-specific UUID table to be populated without me ever calling sd_ble_uuid_vs_add.  It is populated when I use sd_ble_gattc_primary_services_discover and sd_ble_gattc_characteristics_discover to find services and characteristics. 

Part #1: is it true that since I don't call sd_ble_uuid_vs_add, the only cause for entries in the vendor-specific UUID table is calls to sd_ble_gattc_primary_services_discover and sd_ble_gattc_characteristics_discover?

----

Because the vendor-specific UUID table is getting populated every time I call those functions, I do need to delete entries in the table, otherwise it will get full, and no more UUIDs will be added. So I need to call sd_ble_uuid_vs_remove. 

The documentation for sd_ble_uuid_vs_remove says "Currently this function can only be called with a p_uuid_type set to BLE_UUID_TYPE_UNKNOWN or the last added UUID type." https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s140.api.v7.3.0%2Fgroup___b_l_e___c_o_m_m_o_n___f_u_n_c_t_i_o_n_s.html&anchor=gaf9814a42465b2d51fba4aae3a05bdb95

Email with Nordic mentions a further restriction on this API, that "the last added VS base UUID will be removed". 

Since I apparently have no control over which element of the vendor-specific UUID table will be removed by sd_ble_uuid_vs_remove, it seems like my only option is to repeatedly call sd_ble_uuid_vs_remove until all elements are removed. I would do this after I had gathered results from each call to sd_ble_gattc_primary_services_discover or sd_ble_gattc_characteristics_discover.   Pseudo-code would look like this:

Service discovery:

    call sd_ble_gattc_primary_services_discover 

    ... Get all results including UUIDs ..

    Repeatedly call sd_ble_uuid_vs_remove

Characteristic discovery:

    call sd_ble_gattc_characteristics_discover

    ... Get all results including UUIDs ..

    Repeatedly call sd_ble_uuid_vs_remove

Part #2:   Should this approach work? Is there any other way I could use sd_ble_uuid_vs_remove to prevent the vendor-specific UUID table from filling up?

----

I'm currently using pc-ble-driver v4.1.1 from here: https://github.com/NordicSemiconductor/pc-ble-driver/tree/v4.1.1

But even the latest version at that site doesn't implement  sd_ble_uuid_vs_remove

Part #3: where is there a pc-ble-driver that implements sd_ble_uuid_vs_remove and BLE_GATTC_OPT_UUID_DISC?

Thanks,

Paul Bradford

Imprivata, Inc.

Related