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

about UUID

Is it possible to make a services like this: services UUID : 55550001-5555-5555-5555-55555555555 characteristic UUID : 55550001-4444-4444-4444-444444444444

Parents
  • Hi Hunter,

    It is possible to create a service with characteristics like that, but the recommended way is to create a base UUID at www.itu.int/.../generate_uuid.aspx (so that you get a unique UUID) or you can generate it based on www.itu.int/.../X.667-E.pdf.

    When you have generated it, you can use the function call sd_ble_uuid_vs_add.

    Example:

    Generated UUID 7298d7a0-0c38-11e6-ac45-0002a5d5c51b

    ble_uuid128_t vs_uuid = 
        {0x1b, 0xc5, 0xd5, 0xa5, 0x02, 0x00, 0x45, 0xac, 0xe6, 0x11, 0x38, 0x0c, 0x0, 0x0, 0x98, 0x72};
    // Notice that byte [12-13] is set to 0 instead of 0xd7a0, 
    // this is because the this array is stored and then combined with the ble_uuid_t type.
    uint8_t vs_uuid_id;
    
    uint32_t errcode = sd_ble_uuid_vs_add(vs_uuid, &vs_uuid_id);
    
    // Now you can use this uuid for a service
    ble_uuid_t my_uuid = {0x0001, vs_uuid_id};
    errcode = sd_ble_gatts_service_add(type, &my_uuid, &handle);
    // Service UUID read from peer 72980001-0c38-11e6-ac45-0002a5d5c51b
    
    my_uuid.uuid = 0x0003; //Change the UUID for the characteristic
    ble_gatts_attr_t my_attr;
    my_attr.p_uuid = &my_uuid;
    errcode = sd_ble_gatts_characteristic_add(handle, &char_md, &attr_md, &char_handles);
    // Characteristic UUID read from peer 72980003-0c38-11e6-ac45-0002a5d5c51b
    

    Similarily you can use the same function to create two differen vs_uuid's like you did in your question, but it is better to stick to one random generated UUID as this will kind of be your unique UUID.

Reply Children
No Data
Related