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

128-bit UUID using sd_ble_uid_vs_add

I have a UUID in which bytes 12 and 13 are not 0. For example, I have something like this *addr = 87000d1f-1234-5678-9abc-123456789abc

When I use sd_ble_uuid_vs_add(&addr, uuid_type) and I examine the UUID advertised by using LightBlue I see the following:

87000000-1234-5678-9abc-123456789abc

In other words, bytes 12 and 13 now contain 0000 rather than 0d1f.

Is there a way that the advertised UUID is the original one that I intended, 87000d1f-1234-5678-9abc-123456789abc

Is there another method other than sd_ble_uuid_vs_add() that can give me the intended UUID?

Parents
  • That function adds a new vendor specific 128 bit base UUID for use, but bytes 12 and 13 are set when it's used. So for example if you were using that UUID in a service:

    ble_uuid_t ble_uuid;
    
    sd_ble_uuid_vs_add(addr, &my_saved_uuid_type);
    
    ble_uuid.type = my_saved_uuid_type;
    ble_uuid.uuid = 0x0d1f;
    
    sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, service_handle);
    

    Then later when adding characteristics to your service, use the same type with a new 16 bit value:

    ble_uuid.type = my_saved_uuid_type;
    ble_uuid.uuid = 0x0d20;
    
    attr_char_value.p_uuid    = &ble_uuid;
    
Reply
  • That function adds a new vendor specific 128 bit base UUID for use, but bytes 12 and 13 are set when it's used. So for example if you were using that UUID in a service:

    ble_uuid_t ble_uuid;
    
    sd_ble_uuid_vs_add(addr, &my_saved_uuid_type);
    
    ble_uuid.type = my_saved_uuid_type;
    ble_uuid.uuid = 0x0d1f;
    
    sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, service_handle);
    

    Then later when adding characteristics to your service, use the same type with a new 16 bit value:

    ble_uuid.type = my_saved_uuid_type;
    ble_uuid.uuid = 0x0d20;
    
    attr_char_value.p_uuid    = &ble_uuid;
    
Children
No Data
Related