Hello,
We're using version 7.0.1 of the S140 soft device. We are making a bluetooth application where the device behaves both as a central and peripheral. In peripheral mode I can successfully advertise and be connected to. However, I can't get my custom service to be added properly. Below is my code to initialize the service which I took from the beginner's tutorial. It's nothing fancy, and I can compile it and run with with no problems or error codes from the function calls.
#define BLE_UUID_OUR_BASE_UUID {{0x23, 0xD1, 0x13, 0xEF, 0x5F, 0x78, 0x23, 0x15, 0xDE, 0xEF, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00}} // 128-bit base UUID #define BLE_UUID_OUR_SERVICE 0xABCD // Just a random, but recognizable value uint16_t service_handle; uint32_t ble_peripheral_service_init(void){ uint32_t err_code; // Variable to hold return codes from library and softdevice functions // OUR_JOB: Declare 16-bit service and 128-bit base UUIDs and add them to the BLE stack ble_uuid_t service_uuid; ble_uuid128_t base_uuid = BLE_UUID_OUR_BASE_UUID; service_uuid.uuid = BLE_UUID_OUR_SERVICE; err_code = sd_ble_uuid_vs_add(&base_uuid, &service_uuid.type); APP_ERROR_CHECK(err_code); // OUR_JOB: Add our service err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &service_uuid, &service_handle); APP_ERROR_CHECK(err_code); vlog_info("BLE Peripheral Service Initialized\r\n"); return err_code; }
Everything runs as expected. However, my central cannot find my service during discovery. When I use NRF Connect (on both iphone and my mac), after I connect, I only see the generic services and not my service. I don't see anything that could go wrong. Am I missing something in my SDK config? Here's the relevant values. Given the lack off error codes and everything seems to run properly I don't think it's that.
#define NRF_BLE_GATT_ENABLED 1 #define NRF_SDH_BLE_PERIPHERAL_LINK_COUNT 2 #define NRF_SDH_BLE_VS_UUID_COUNT 10 #define NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE 992 #define NRF_SDH_BLE_SERVICE_CHANGED 0
Any help would be greatly appreciated. Thank you.