What is ble_gattc_handle_range_t?

Hello, I'm seeking some clarification regarding "ble_gattc_handle_range_t". I would like to use the function "sd_ble_gattc_char_value_by_uuid_read()" to read the char value on my peripheral. Is "ble_gattc_handle_range_t" referring to a range of conn_handles or a range of 16bit characteristics, or something else?

`

/**@brief Operation Handle Range. */
typedef struct
{
  uint16_t          start_handle; /**< Start Handle. */
  uint16_t          end_handle;   /**< End Handle. */
} ble_gattc_handle_range_t;

Parents Reply
  • Hi,

    If you want to read a single characteristic value, and know which handle the value of this characteristic is stored at, then you only need sd_ble_gattc_read(), which lets you specify the exact handle. If the characteristic value is longer than ATT_MTU - 1, then you must call the function repeatedly with increasing offeset, in order to get the full value.

    The "by_uuid" read is for if you know the UUID of the characteristic, but don't know where in the ATT table it is (what handle, or position, it has in the ATT table.) For that you typically provide a range, since you do not know which of the handles in the range contains your characteristic.

    For more on how services, characteristics and descriptors are stored in the ATT / GATT table, please have a look at Bluetooth low energy Characteristics, a beginner's tutorial. The Attribute Protocol (ATT) section of that tutorial describes this in detail, hopefully enough that after reading it the SoftDevice API should make more sense.

    Regards,
    Terje

Children
Related