Hi,
I just met some difficulties to implant more then one service into my project. The project was developed based on hid_keyboard.
The project can work normally when without lbs, but when I add the lbs service it just could not advertise and the button is no response as well.
I have done the below change in to my project:
ble_uuid_t m_adv_uuids[] = {{BLE_UUID_HUMAN_INTERFACE_DEVICE_SERVICE, BLE_UUID_TYPE_BLE},{LBS_UUID_SERVICE, BLE_UUID_TYPE_BLE}}; static void led_write_handler(uint16_t conn_handle, ble_lbs_t * p_lbs, uint8_t led_state) { if (led_state) { bsp_board_led_on(LED_2); NRF_LOG_INFO("Received LED ON!"); } else { bsp_board_led_off(LED_2); NRF_LOG_INFO("Received LED OFF!"); } } static void lbs_init(void) { ret_code_t err_code; ble_lbs_init_t init = {0}; // Initialize LBS. init.led_write_handler = led_write_handler; err_code = ble_lbs_init(&m_lbs, &init); APP_ERROR_CHECK(err_code); } static void services_init(void) { qwr_init(); dis_init(); bas_init(); hids_init(); lbs_init(); } static void advertising_init(void) { uint32_t err_code; uint8_t adv_flags; ble_advertising_init_t init; memset(&init, 0, sizeof(init)); adv_flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE; init.advdata.name_type = BLE_ADVDATA_FULL_NAME; init.advdata.include_appearance = true; init.advdata.flags = adv_flags; init.advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]); init.advdata.uuids_complete.p_uuids = m_adv_uuids; init.config.ble_adv_whitelist_enabled = true; init.config.ble_adv_directed_high_duty_enabled = true; init.config.ble_adv_directed_enabled = false; init.config.ble_adv_directed_interval = 0; init.config.ble_adv_directed_timeout = 0; init.config.ble_adv_fast_enabled = true; init.config.ble_adv_fast_interval = APP_ADV_FAST_INTERVAL; init.config.ble_adv_fast_timeout = APP_ADV_FAST_DURATION; init.config.ble_adv_slow_enabled = true; init.config.ble_adv_slow_interval = APP_ADV_SLOW_INTERVAL; init.config.ble_adv_slow_timeout = APP_ADV_SLOW_DURATION; init.evt_handler = on_adv_evt; init.error_handler = ble_advertising_error_handler; 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); }