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

HID Keyboard + Custom GATT

Hi,

I'm using SDK 15.2 & trying to combine hid keyboard with custom gatt service, but it was not advertising. When I debug, it got stuck on the line below with error code 12-

err_code = sd_ble_gap_device_name_get(&p_encoded_data[(*p_offset) + AD_DATA_OFFSET],
                                          &actual_length);
    VERIFY_SUCCESS(err_code);

& the rtt logs showed

ble_app_hids_keyboard_custom.zip

So after going through several tickets, I changed -

init.advdata.include_appearance from true to false, & I could see the device name being advertised as 'Nord'.

How do I advertise full name?

I plan to use HID service with custom gatt & DFU service. How should I tackle the advertising data? Should I remove other services which come along with HID service like the battery service & device info service?

By referring https://devzone.nordicsemi.com/nordic/short-range-guides/b/bluetooth-low-energy/posts/ble-advertising-a-beginners-tutorial & other tickets, I tried adding

static ble_uuid_t m_adv_uuids_new[] = {{CUSTOM_SERVICE_UUID, BLE_UUID_TYPE_VENDOR_BEGIN }};
init.srdata.uuids_more_available.uuid_cnt = sizeof(m_adv_uuids_new) / sizeof(m_adv_uuids_new[0]);
init.srdata.uuids_more_available.p_uuids = m_adv_uuids_new;

OR

static ble_uuid_t m_adv_uuids_new[] = {{CUSTOM_SERVICE_UUID, BLE_UUID_TYPE_VENDOR_BEGIN }};
init.srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids_new) / sizeof(m_adv_uuids_new[0]);
init.srdata.uuids_complete.p_uuids = m_adv_uuids_new;

but didnt work.

Parents Reply
  • static void advertising_init(void)
    {
        uint32_t               err_code;
        ble_advertising_init_t init;
        memset(&init, 0, sizeof(init));
        init.advdata.name_type               = BLE_ADVDATA_FULL_NAME;
        init.advdata.include_appearance      = true;
        init.advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
        init.advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
        init.advdata.uuids_complete.p_uuids  = m_adv_uuids;
    	
    	/*new*/
    	init.config.ble_adv_fast_enabled  = true;
        init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
        init.config.ble_adv_fast_timeout  = APP_ADV_DURATION;
    	
        advertising_config_get(&init.config);
        init.evt_handler = on_adv_evt;
        err_code = ble_advertising_init(&m_advertising, &init);
        APP_ERROR_CHECK(err_code);
        ble_advertising_conn_cfg_tag_set(&m_advertising, APP_BLE_CONN_CFG_TAG);
    }
    ble_app_buttonless_dfu_custom.zip

    I have also attached the full code.

    Also what adjustments do I need to make in advertising data for the full device name to be visible with custom gatt & dfu service? I removed the hid service.

    Thanks.

Children
No Data
Related