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

What are nRF52 advertisements exactly good for and what UUID do I have to put?

Hi!

So I managed to create my custom service with one characteristic (a struct with several attribs). I can see it in my app and everything's awesome. Yay.

But in some tutorial and in the sample app I altered initially (ble_bas sample), there is this struct:

static ble_uuid_t m_adv_uuids[] = {
    {BLE_UUID_POWER_SERVICE, BLE_UUID_TYPE_VENDOR_BEGIN},
    {BLE_UUID_BATTERY_SERVICE, BLE_UUID_TYPE_BLE},
    {BLE_UUID_DEVICE_INFORMATION_SERVICE, BLE_UUID_TYPE_BLE}
}; /**< Universally unique service identifiers. */

As you can see I already put my own services UUID at the top. I also made it of type VENDOR_BEGIN as stated in the tutorial.

But it then fails to initiate the advertising. Additional data:

#define APP_UUID                         {{ 0xC0, 0xBE, 0xBA, 0xEE, 0xFF, 0xC0,0xBE, 0xBA, 0xEE, 0xFF, 0xC0,0xBE, 0xBA, 0xEE, 0xFF, 0xC0 }}
#define BLE_UUID_POWER_SERVICE 0xBABE
#define BLE_UUID_POWER_CHAR 0xB0BA

And I register my vendor UUID like this:

ble_uuid128_t   base_uuid = APP_UUID;
    
// Add vendor UUID
err_code = sd_ble_u

uid_vs_add(&base_uuid, &ble_uuid.type);

And as expected I register the characteristic and the service with BLE_UUID_POWER_SERVICE and BLE_UUID_POWER_CHAR respectively. This works fine!

So now my question is: If I can see my service already, what do I need the adverts for and how do I register them properly if needbe?

Thanks a lot!

Related