I'm trying to set up the Dongle pca10059. I'm using the softdevice 140 and segger studio. The code is from the SDK, the template example.
the main.c:
static ble_uuid_t m_adv_uuids[] = /**< Universally unique service identifiers. */
{
//{BLE_UUID_DEVICE_INFORMATION_SERVICE, BLE_UUID_TYPE_BLE},
{CUSTOM_SERVICE_UUID, BLE_UUID_TYPE_VENDOR_BEGIN}
};
When I'm using BLE__UUID_TYPE_VENDOR_BEGIN, I can't find the Dongle anymore with the nRF Connect App. (The LED starts to blink.) When I use 0x01 instead, it works. But the only service I see then, is 0x0001.
in ble_cus.c:
uint32_t ble_cus_init(ble_cus_t * p_cus, const ble_cus_init_t * p_cus_init)
{
if(p_cus == NULL || p_cus_init == NULL)
{
return NRF_ERROR_NULL;
}
uint32_t err_code;
ble_uuid_t ble_uuid;
p_cus->conn_handle = BLE_CONN_HANDLE_INVALID;
ble_uuid128_t base_uuid = {CUSTOM_SERVICE_UUID_BASE};
err_code = sd_ble_uuid_vs_add(&base_uuid, &p_cus->uuid_type);
VERIFY_SUCCESS(err_code);
ble_uuid.type = p_cus->uuid_type;
ble_uuid.uuid = CUSTOM_SERVICE_UUID;
err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &p_cus->service_handle);
if(err_code != NRF_SUCCESS)
{
return err_code;
}
}
In ble_cus.h:
typedef struct ble_cus_s ble_cus_t;
#define BLE_CUS_DEF(_name) \
static ble_cus_t _name; \
/*#define BLE_SERVICE_DEF(_name) \
static ble_service_t _name; \
NRF_SDH_BLE_OBSERVER(_name ## _obs, \
BLE_SERVICE_OBSERVER_PRIO, \
ble_service_on_ble_evt, \
&_name)
*/
#define CUSTOM_SERVICE_UUID_BASE {0xA8, 0x47, 0xKJ, 0x0A, 0x1S, 0x4E, 0x95, 0xA2, 0x01, 0x47, 0xF6, 0x47, 0x00, 0x00, 0x64, 0x75}
#define CUSTOM_SERVICE_UUID 0x0001
#define CUSTOM_VALUE_CHAR_UUID 0x0002
typedef struct
{
uint8_t initial_custom_value;
ble_srv_cccd_security_mode_t custom_value_char_attr_md;
} ble_cus_init_t;
struct ble_cus_s
{
uint16_t service_handle;
ble_gatts_char_handles_t custom_value_handles;
uint16_t conn_handle;
uint8_t const uuid_type;
};
typedef struct ble_cus_s ble_cus_t;
uint32_t ble_cus_init(ble_cus_t * p_cus, const ble_cus_init_t * p_cus_init);
I made a few changes to use it with the pca10059. Because the template is for 10056. Might that be the problem?
Thanks in advance!