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

creating custom service and characteristics with Bluetooth Base UUID.

Hi,

Am using nrf51822

uint32_t ble_nus_c_init(ble_nus_c_t * p_ble_nus_c, ble_nus_c_init_t * p_ble_nus_c_init)
{

		// for RN_4871
	  uint32_t      err_code;
    ble_uuid_t    uart_uuid;
    ble_uuid128_t nus_base_uuid = NUS_BASE_UUID;

    VERIFY_PARAM_NOT_NULL(p_ble_nus_c);
    VERIFY_PARAM_NOT_NULL(p_ble_nus_c_init);
	
		err_code = sd_ble_uuid_vs_add(&nus_base_uuid, &p_ble_nus_c->uuid_type);
    VERIFY_SUCCESS(err_code);
    uart_uuid.type = p_ble_nus_c->uuid_type;
    uart_uuid.uuid = BLE_UUID_NUS_SERVICE;
	
	
    ble_uuid128_t char1_base_uuid = CHAR1_BASE_UUID;

    err_code = sd_ble_uuid_vs_add(&char1_base_uuid, &p_ble_nus_c->uuid_type);
    VERIFY_SUCCESS(err_code);
    uart_uuid.type = p_ble_nus_c->uuid_type;
    uart_uuid.uuid = BLE_UUID_NUS_TX_CHARACTERISTIC;


    ble_uuid128_t char2_base_uuid = CHAR2_BASE_UUID;

    err_code = sd_ble_uuid_vs_add(&char2_base_uuid, &p_ble_nus_c->uuid_type);
    VERIFY_SUCCESS(err_code);
    uart_uuid.type = p_ble_nus_c->uuid_type;
    uart_uuid.uuid = BLE_UUID_NUS_RX_CHARACTERISTIC;

    p_ble_nus_c->conn_handle           = BLE_CONN_HANDLE_INVALID;
    p_ble_nus_c->evt_handler           = p_ble_nus_c_init->evt_handler;
    p_ble_nus_c->handles.nus_tx_handle = BLE_GATT_HANDLE_INVALID;
    p_ble_nus_c->handles.nus_rx_handle = BLE_GATT_HANDLE_INVALID;
		
    return ble_db_discovery_evt_register(&uart_uuid);
}	
a central, i want to discover the service of anothe rble module (which is RN4871 from microship).

My problem here is that this RN4871 advertise a service with a different base UUID for service and for its two characteristics. 

Am not able to discover this service, although i tried to use the fucntion  sd_ble_uuid_vs_add(.....) more then one time, first time for service and two times for each characteristic.

after each use of "sd_ble_uuid_vs_add" a VERIFY_SUCCESS(err_code); is used, but is stucks after the first use of sd_ble_uuid_vs_add().

PS1 : the bases are : 

#define NUS_BASE_UUID {{0x55, 0xE4, 0x05, 0xD2, 0xAF, 0x9F, 0xA9, 0x8F, 0xE5, 0x4A, 0x7D, 0xFE, 0x43, 0x53, 0x53, 0x49}} //Used vendor specific UUID.
#define CHAR1_BASE_UUID {{0x16, 0x96, 0x24, 0x47, 0xC6, 0x23, 0x61, 0xBA, 0xD9, 0x4B, 0x4D, 0x1E, 0x43, 0x53, 0x53, 0x49}} // Used vendor specific UUID.
#define CHAR2_BASE_UUID {{0xB3, 0x9B, 0x72, 0x34, 0xBE, 0xEC, 0xD4, 0xA8, 0xF4, 0x43, 0x41, 0x88, 0x43, 0x53, 0x53, 0x49}} // Used vendor specific UUID.

#define BLE_UUID_NUS_SERVICE 0x5343 // The UUID of the Nordic UART Service.
#define BLE_UUID_NUS_TX_CHARACTERISTIC 0x5343 // The UUID of the Characteristic1.
#define BLE_UUID_NUS_RX_CHARACTERISTIC 0x5344 // The UUID of the Characteristic2.

PS2: i adjusted the RAM.

PS3: i adjusted   the uuid count with :  p_ble_enable_params->common_enable_params.vs_uuid_count = 3 in function ble_stack_init(void)
 since am using SDk 12.3.0 ( don't has NRF_SDH_BLE_VS_UUID_COUNT in it's sdk_config.h)

would you help me please.

Thnks in advance

Related