Read character with custom 128 bit UUID

Hello, I am currently working on the nrF52840 module with the soft device s140.

My job is to read the values ​​from different characteristics.

The characteristics are configured via individual 128-bit uuids. (UUID char 1: 470230b9-28cc-4c91-9a73-6dc094564b96)

My approach so far has been:

1. I add the individual uuid with the function sd_ble_uuid_vs_add() and save the type ->

ble_uuid128_t const base_serv_uuid =
	{
			{
					0x96, 0x4B, 0x56, 0x94, 0xC0, 0x6D, 0x73, 0x9A,
					0x91, 0x4C, 0xCC, 0x28,  0xb9, 0x30, 0x02, 0x47
			}
	};
						
ble_uuid_t read_uuid;

err_code = sd_ble_uuid_vs_add(&base_serv_uuid, &read_uuid.type);

2. Then try to read the characteristic with the sd_ble_gattc_char_value_by_uuid_read() function. In doing so, I pass the previously saved type and uuid as follows -> 

const ble_gattc_handle_range_t read_handle_range = {0x0001, 0xffff};

read_uuid.uuid = 0x30b9;
						
err_code = sd_ble_gattc_char_value_by_uuid_read(m_conn_handle, &read_uuid, &read_handle_range);

I get the BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP event but theres no handle as a response in the data package. I also tried discovering my custom chars with 

err_code = sd_ble_gattc_characteristics_discover(m_conn_handle, &read_handle_range);

but I only discover the standard characteristics with device name and so on. But no custom uuid characteristics.

Reading over the handle works fine tho, but I have to implement a version to read over the uuid.

Do I provide the uuid in the wrong format while assigning it to the ble stack or do I have to be aware of something else, like while initializing the ble stack?

Thanks for the help and I am hoping to find a solution to read my custom uuid characteristics.

Parents
  • I implemented the error check afterwards and there is no error returned by either of the API calls. I also implemented the function for discovering the characteristics and there are all characteristics returned at the BLE_GATTC_EVT_CHAR_DISC_RSP event with type 0x02 (which is the same which is returned at the sd_ble_gattc_char_value_by_uuid_read() call). This means the custom base uuid is assigned correctly, or am I wrong?

    I don't know why I am not getting the event after sd_ble_gattc_char_value_by_uuid_read() call..

  • KonstantinK said:
    I don't know why I am not getting the event after sd_ble_gattc_char_value_by_uuid_read() call..

    Me neither, I suggest you try to continue to debug, and just try and fail a bit, e.g. try with another peer for testing, try to add some delays between calling api calls etc.

    Kenneth

Reply Children
No Data
Related