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

Long 16 bytes characteristic UUID different from the srevice UUID

I want to use to set the UUID in my Nordic device as following:

Base UUID:
{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}

-- Characteristic #1 UUID: {0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}

-- Characteristic #2 UUID: {0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04}

The problem is that I know how to set the base UUID, but I can not find a way how to set the characteristic UUID. What I do for now, is I am setting the characteristic as two bytes and then it works, and I get those two bytes as the 13th and the 14th bytes in the base UUID.

The topology looks like:

Base UUID: {0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}

-- Characteristic #1 UUID: {0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01}

-- Characteristic #2 UUID: {0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01}

How can I set the characteristic UUID to be different from the base UUID in the 15th and 16th byte as well?

Thanks a lot, Eli

Parents
  • I don't know why you can't use the 2 bytes at indices 12 and 13, but what you want to do should be possible. You just need to add the different base UUIDs, and then use these when you add the charactertistics.

    uint32_t        err_code;
    
    ble_uuid128_t   base_uuid2 = {{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}};
    
    ble_uuid_t      ble_uuid2;
    
    err_code = sd_ble_uuid_vs_add(&base_uuid2, &ble_uuid2.type);
    APP_ERROR_CHECK(err_code);    
    
    ble_uuid2.uuid           = 0x0000;
    

    and

    uint32_t        err_code;
    
    ble_uuid128_t   base_uuid3 = {{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03}};
    
    ble_uuid_t      ble_uuid3;
    
    err_code = sd_ble_uuid_vs_add(&base_uuid3, &ble_uuid3.type);
    APP_ERROR_CHECK(err_code);    
    
    ble_uuid3.uuid           = 0x0000;
    
  • Thanks Petter, I do it because I need backward comparability to my order version devices and applications. In the Slave I can create the topology. I did it the same way you said. But, I can't see those long UUIDs in the Master when I am doing the discovery.

Reply Children
No Data
Related