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

How to generate different UUID's for service and characteristics

Hello,

I want to generate different UUID for service and for characteristics with different base address for both.

I am updating base address in characteristics_add function and uses this function: err_code = sd_ble_uuid_vs_add(&base_uuid, &char_uuid.type); before, sd_ble_gatts_characteristic_add();

But still I am getting the base address of service only not the upadated characteristics base address.

I am not getting what would be the problem

Parents
  • Your problem is in the struct you send in to sd_ble_gatts_service_add. The call to sd_ble_uuid_vs_add will populate only the .type field of service_uuid, not .uuid. Instead, try this:

    service_uuid.uuid = BLE_UUID_TEMPERATURE_SRV_UUID; // e.g. 0xaf22 or what ever...
    
    err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
                                        &service_uuid,
                                        &m_temperature_service.service_handle);
    APP_ERROR_CHECK(err_code);
    

    You can then have BLE_UUID_TEMPERATURE_ATTR_UUID for the attribute and so on....

Reply
  • Your problem is in the struct you send in to sd_ble_gatts_service_add. The call to sd_ble_uuid_vs_add will populate only the .type field of service_uuid, not .uuid. Instead, try this:

    service_uuid.uuid = BLE_UUID_TEMPERATURE_SRV_UUID; // e.g. 0xaf22 or what ever...
    
    err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
                                        &service_uuid,
                                        &m_temperature_service.service_handle);
    APP_ERROR_CHECK(err_code);
    

    You can then have BLE_UUID_TEMPERATURE_ATTR_UUID for the attribute and so on....

Children
No Data
Related