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

Generic Service UUID Selection Error

Hi!

I try to create a custom service. To do that I copied the ble_bas service and followed this guide.

You can see my init function here:

#define APP_UUID                         {{ 0xC0, 0xBE, 0xBA, 0xEE, 0xFF, 0xC0,0xBE, 0xBA, 0xEE, 0xFF, 0xC0,0xBE, 0xBA, 0xEE, 0xFF, 0xC0 }}

uint32_t ble_pwr_init(ble_pwr_t * p_pwr, const ble_pwr_init_t * p_pwr_init){
    if (p_pwr == NULL || p_pwr_init == NULL){
        return NRF_ERROR_NULL;
    }

    uint32_t   err_code;
    ble_uuid_t ble_uuid;
    ble_uuid128_t     base_uuid = APP_UUID;

    // Initialize service structure
    p_pwr->evt_handler               = p_pwr_init->evt_handler;
    p_pwr->conn_handle               = BLE_CONN_HANDLE_INVALID;
    p_pwr->is_notification_supported = p_pwr_init->support_notification;
    p_pwr->last_vtg                  = 230;

    // Add service
    err_code = sd_ble_uuid_vs_add(&base_uuid, &ble_uuid.type);
    if (err_code != NRF_SUCCESS){
        return err_code;
    }

    err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &p_pwr->service_handle);
    if (err_code != NRF_SUCCESS){
        return err_code;
    }

    // Add Power level characteristic
    return vtg_char_add(p_pwr, p_pwr_init);
}

Sadly it fails on the line:

err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &p_pwr->service_handle);

with an error: ::NRF_ERROR_FORBIDDEN Forbidden value supplied, certain UUIDs are reserved for the stack.

Can you spot what's wrong? I really can't spot why my UUID is bad (I tried a couple of different ones too)

Thanks! Yatekii

Parents Reply Children
Related