Hello, I tried to merged two examples from SDK
1) I run ble_app_bps example from SDK 15.0 HW - PCA10056, nRF52840

2) I included to the main.c
#include "ble_lbs.h"
3) I defined in sdk_condif.h
#define NRF_LOG_ENABLED 1 #define NRF_LOG_BACKEND_RTT_ENABLED 1 #define BLE_LBS_ENABLED 1 #define NRF_SDH_BLE_VS_UUID_COUNT 1 #define NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE 1760 #define NRF_SDH_BLE_SERVICE_CHANGED 1
4) I added service's UUID to the advertising packet
static ble_uuid_t m_sr_uuids[] =
{
{LBS_UUID_BASE, BLE_UUID_TYPE_VENDOR_BEGIN}
};
static void advertising_init(void)
{
ret_code_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;
/* I added this lines-> */ init.srdata.uuids_complete.uuid_cnt = sizeof(m_sr_uuids) / sizeof(m_sr_uuids[0]);
/* I added this lines-> */ init.srdata.uuids_complete.p_uuids = m_sr_uuids;
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;
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);
}
5) I added service initialization to the services_init function
static void services_init(void)
{
uint32_t err_code;
ble_bps_init_t bps_init;
ble_bas_init_t bas_init;
ble_dis_init_t dis_init;
/* I added this lines-> */ ble_lbs_init_t lbs_init;
ble_dis_sys_id_t sys_id;
nrf_ble_qwr_init_t qwr_init = {0};
// Initialize Queued Write Module
qwr_init.error_handler = nrf_qwr_error_handler;
err_code = nrf_ble_qwr_init(&m_qwr, &qwr_init);
APP_ERROR_CHECK(err_code);
// Initialize LBS.
/* I added this lines-> */ memset(&lbs_init, 0, sizeof(lbs_init));
/* I added this lines-> */ lbs_init.led_write_handler = led_write_handler;
/* I added this lines-> */ err_code = ble_lbs_init(&m_lbs, &lbs_init);
/* I added this lines-> */ APP_ERROR_CHECK(err_code);
// Initialize Blood Pressure Service.
memset(&bps_init, 0, sizeof(bps_init));
bps_init.evt_handler = on_bps_evt;
bps_init.feature = BLE_BPS_FEATURE_BODY_MOVEMENT_BIT |
BLE_BPS_FEATURE_MEASUREMENT_POSITION_BIT;
// Here the sec level for the Blood Pressure Service can be changed/increased.
BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&bps_init.bps_meas_attr_md.cccd_write_perm);
BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&bps_init.bps_meas_attr_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&bps_init.bps_meas_attr_md.write_perm);
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&bps_init.bps_feature_attr_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&bps_init.bps_feature_attr_md.write_perm);
err_code = ble_bps_init(&m_bps, &bps_init);
APP_ERROR_CHECK(err_code);
// Initialize Battery Service.
memset(&bas_init, 0, sizeof(bas_init));
// Here the sec level for the Battery Service can be changed/increased.
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&bas_init.battery_level_char_attr_md.cccd_write_perm);
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&bas_init.battery_level_char_attr_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&bas_init.battery_level_char_attr_md.write_perm);
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&bas_init.battery_level_report_read_perm);
bas_init.evt_handler = NULL;
bas_init.support_notification = true;
bas_init.p_report_ref = NULL;
bas_init.initial_batt_level = 100;
err_code = ble_bas_init(&m_bas, &bas_init);
APP_ERROR_CHECK(err_code);
// Initialize Device Information Service.
memset(&dis_init, 0, sizeof(dis_init));
ble_srv_ascii_to_utf8(&dis_init.manufact_name_str, MANUFACTURER_NAME);
ble_srv_ascii_to_utf8(&dis_init.model_num_str, MODEL_NUM);
sys_id.manufacturer_id = MANUFACTURER_ID;
sys_id.organizationally_unique_id = ORG_UNIQUE_ID;
dis_init.p_sys_id = &sys_id;
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&dis_init.dis_attr_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&dis_init.dis_attr_md.write_perm);
err_code = ble_dis_init(&dis_init);
APP_ERROR_CHECK(err_code);
}
As a result:
1) I can not understand, why nRF Connect shows Unknown Service, why doesn't recognize this service like LED Button Service. When I run LED Button Service example, the application can recognize it
2) Why I can not see service and characteristics at the Attribute Table.

