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

ble_gatts_service_add error code 0x0000000c

Hello, I am trying to set my own BLE service, and on the adverstisement initialization I get an error 0x0000000c when calling to ble_advertising_init().

Why does it mean and happen? How can I fix it?

Thanks in advance

My uuids are initialized like this

#define SERVICE_UUID_BASE {0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0x00, 0x00, 0xAB, 0xAB}
#define D_SERVICE_UUID 0xE800
#define D_42_CHAR_UUID 0xE801
#define D_DT_CHAR_UUID 0xE802
#define D_GO_CHAR_UUID 0xE803
#define D_LG_CHAR_UUID 0xE804


static ble_uuid128_t D_base_uuid = SERVICE_UUID_BASE ;
static ble_uuid_t m_adv_uuids[] = {{D_SERVICE_UUID, BLE_UUID_TYPE_VENDOR_BEGIN },
                                         {BLE_UUID_BATTERY_SERVICE, BLE_UUID_TYPE_BLE},
                                         {BLE_UUID_DEVICE_INFORMATION_SERVICE, BLE_UUID_TYPE_BLE}
                                       };

My adverstising method looks like

static void advertising_init(void)
{
    uint32_t               err_code;
    ble_advdata_t          advdata;
    ble_adv_modes_config_t options;

    // Build advertising data struct to pass into @ref ble_advertising_init.
    memset(&advdata, 0, sizeof(advdata));

    advdata.name_type               = BLE_ADVDATA_FULL_NAME;
    advdata.include_appearance      = true;
    advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    advdata.uuids_complete.p_uuids  = m_adv_uuids;

    memset(&options, 0, sizeof(options));
    options.ble_adv_fast_enabled  = true;
    options.ble_adv_fast_interval = APP_ADV_INTERVAL;
    options.ble_adv_fast_timeout  = APP_ADV_TIMEOUT_IN_SECONDS;

    err_code = ble_advertising_init(&advdata, NULL, &options, on_adv_evt, NULL);
    APP_ERROR_CHECK(err_code);
}

Finally part of my service initialization is

    uint32_t ble_D_init(ble_D_t * p_D, const ble_D_init_t * p_D_init)
    {
        uint32_t   err_code;
        ble_uuid_t ble_uuid;
        ble_uuid128_t base_uuid = D_base_uuid;
    
    
        // Initialize service structure
        p_D->evt_handler                 = p_D_init->evt_handler;
        p_D->is_sensor_contact_supported = p_D_init->is_sensor_contact_supported;
        p_D->conn_handle                 = BLE_CONN_HANDLE_INVALID;
        p_D->is_sensor_contact_DTected  = false;
        p_D->interval_count              = 0;
        p_D->max_D_len              = INIT_MAX_LEN;
    
    
        // Add service
        err_code = sd_ble_uuid_vs_add(&base_uuid, &(p_D->uuid_type));
        APP_ERROR_CHECK(err_code);// HERE err_code = 0x00000000
    
        ble_uuid.type = p_D->uuid_type;
        ble_uuid.uuid = D_SERVICE_UUID;

        err_code =sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,&ble_uuid,&p_D->service_handle);//HERE err_code = 0x00000000
...}
Parents Reply Children
No Data
Related