This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

sd_ble_gattc_char_value_by_uuid_read - again

Hi

I'm fighting to read characteristics of my service with sd_ble_gattc_char_value_by_uuid_read. I'm using SD130 V2.0.1 and SDK11.

Here are some snippets from my central device. I register my custom 128bit UUID in the SD130 like so:

err_code = sd_ble_uuid_vs_add(&m_svc_uuid, &m_uuid_type);
APP_ERROR_CHECK(err_code);

m_uuid.type = m_uuid_type;
m_uuid.uuid = MH_BLE_UUID_SERVICE;

then the normal scan and connect takes place. In the ble connect handler I call:

	m_range.start_handle = 0x0001; // CHAR Start on create: 0x1101
	m_range.end_handle = 0xffff; // CHAR END on create: 0x1105
	err_code = sd_ble_gattc_char_value_by_uuid_read(p_gap_evt->conn_handle, &m_uuid_type, &m_range);

No matter if I add the known characteristic handles or the full range, the error is the same. The function call executes with NRF_SUCCESS, but in the BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP event handler, the returned status is always BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND 0x010A.

Am I missing something or is my call in the wrong place? It would be great if somebody could supply a more detailed explanation then the one in the docs. I couldn't find any example using the call on devzone or in SDK exmples....

Thanks

Parents
  • Hi Martin Petter,

    Please be noted that in the call sd_ble_gattc_char_value_by_uuid_read() the parameter *p_uuid should be the UUID of the characteristic, not the m_uuid_type. The m_uuid_type is the ID of the base UUID in the database. the UUID of the characteristic should consist of uuid_type and the actual UUID (16bit UUID for the characteristic).

    For example in our UART service, the base UUID is

    NUS_BASE_UUID                   {{0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x00, 0x00, 0x40, 0x6E}}
    

    But the 16 bit UUID for RX characteristic, for example, is

    #define BLE_UUID_NUS_TX_CHARACTERISTIC  0x0003 
    

    And it's the charactersitic's UUID, not the service's UUID.

    If you still have trouble, please post your code.

Reply
  • Hi Martin Petter,

    Please be noted that in the call sd_ble_gattc_char_value_by_uuid_read() the parameter *p_uuid should be the UUID of the characteristic, not the m_uuid_type. The m_uuid_type is the ID of the base UUID in the database. the UUID of the characteristic should consist of uuid_type and the actual UUID (16bit UUID for the characteristic).

    For example in our UART service, the base UUID is

    NUS_BASE_UUID                   {{0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x00, 0x00, 0x40, 0x6E}}
    

    But the 16 bit UUID for RX characteristic, for example, is

    #define BLE_UUID_NUS_TX_CHARACTERISTIC  0x0003 
    

    And it's the charactersitic's UUID, not the service's UUID.

    If you still have trouble, please post your code.

Children
Related