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

How to fetch peer's base uuid?

Hi experts,

I have just tried lbs example. I saw in the ble_lbs_c.h, the base uuid and service uuid are defined for the peripheral peers who are going to be connected. However, if I don't know these uuids, I would like to read them from the peripheral devices when they are discovered or connected. Is there any way to do this?

thanks.

  • As GATT Client you can do full GATT service discovery meaning read all handles and their UUIDs as soon as you connect and see GATT Server on the other side. But if you don't know it before connection then you obviously don't have it. Actually UUIDs are meant to be always known and public, that's how any application can work on top of ATT/GATT (= looks for the particular Service/Characteristic etc. all named just by UUIDs).

  • Thanks. Now, I can understand Service/Characteristic UUIDs are public and always know: the same products provide the same services.

    By the way, the nRF Connect app (called NRF Master Control Panel before) can tell the service UUID of the device after being connected, even if the base UUID is modified. How does the app find it? So I think, the BLE protocol should allow ble master (GATT client) to discover all UUIDs of peripheral (GATT server). Back to my problem, I tried to implement a ble center based on s132 to collect data from multi peripheral ble devices. However, all the peripheral ble devices own unique base UUID, and can't be probed one by one (lots of custom devices). db_discovery will fail if the base UUID is not correctly specified and passed to sd_ble_uuid_vs_add(). So I wonder if there is a way to read the UUID as the APP did.

    Thanks.

  • "Base UUIDs" is visible in the full UUID as well. You cannot "fix" UUID without knowing the base, again on both sides. The only difference between "short" UUID (2-byte) and "full UUID" (16-byte) is that short UUIDs are mapped on "BT SIG base UUID" which is well known. but if you would expose it in 16-byte format it would mean the same and GATT compliant devices should understand it. So to summarize: you see "base UUID" if you see full UUID (and these are typically exposed freely on GATT Server side), if you change "base UUID" it will of course change all the UUIDs which are using that as "common" base and so UUIDs will become unknown to the other party.

  • so,softdevice doesnot provide an api to read the full uuid as android (nrf connect) does?

  • Where you want to read UUID from? Which GATT role(s) is your app using on top of SD and what is it connected to?

Related