SD_BLE_GATTC_HV_CONFIRM,/**< Handle Value Confirmation. */
SD_BLE_GATTC_EXCHANGE_MTU_REQUEST,/**< Exchange MTU Request. */
};
/**
* @brief GATT Client Event IDs.
*/
enumBLE_GATTC_EVTS
{
BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP=BLE_GATTC_EVT_BASE,/**< Primary Service Discovery Response event. \n See @ref ble_gattc_evt_prim_srvc_disc_rsp_t. */
BLE_GATTC_EVT_REL_DISC_RSP,/**< Relationship Discovery Response event. \n See @ref ble_gattc_evt_rel_disc_rsp_t. */
BLE_GATTC_EVT_CHAR_DISC_RSP,/**< Characteristic Discovery Response event. \n See @ref ble_gattc_evt_char_disc_rsp_t. */
BLE_GATTC_EVT_DESC_DISC_RSP,/**< Descriptor Discovery Response event. \n See @ref ble_gattc_evt_desc_disc_rsp_t. */
BLE_GATTC_EVT_ATTR_INFO_DISC_RSP,/**< Attribute Information Response event. \n See @ref ble_gattc_evt_attr_info_disc_rsp_t. */
BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP,/**< Read By UUID Response event. \n See @ref ble_gattc_evt_char_val_by_uuid_read_rsp_t. */
BLE_GATTC_EVT_READ_RSP,/**< Read Response event. \n See @ref ble_gattc_evt_read_rsp_t. */
BLE_GATTC_EVT_CHAR_VALS_READ_RSP,/**< Read multiple Response event. \n See @ref ble_gattc_evt_char_vals_read_rsp_t. */
BLE_GATTC_EVT_WRITE_RSP,/**< Write Response event. \n See @ref ble_gattc_evt_write_rsp_t. */
BLE_GATTC_EVT_HVX,/**< Handle Value Notification or Indication event. \n Confirm indication with @ref sd_ble_gattc_hv_confirm. \n See @ref ble_gattc_evt_hvx_t. */
BLE_GATTC_EVT_EXCHANGE_MTU_RSP,/**< Exchange MTU Response event. \n See @ref ble_gattc_evt_exchange_mtu_rsp_t. */
BLE_GATTC_EVT_TIMEOUT,/**< Timeout event. \n See @ref ble_gattc_evt_timeout_t. */
BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE/**< Write without Response transmission complete. \n See @ref ble_gattc_evt_write_cmd_tx_complete_t. */
};
/** @} */
/** @addtogroup BLE_GATTC_DEFINES Defines
* @{ */
/** @defgroup BLE_ERRORS_GATTC SVC return values specific to GATTC
* @{ */
#define BLE_ERROR_GATTC_PROC_NOT_PERMITTED (NRF_GATTC_ERR_BASE + 0x000) /**< Procedure not Permitted. */
/** @} */
/** @defgroup BLE_GATTC_ATTR_INFO_FORMAT Attribute Information Formats
* @{ */
#define BLE_GATTC_ATTR_INFO_FORMAT_16BIT 1 /**< 16-bit Attribute Information Format. */
#define BLE_GATTC_ATTR_INFO_FORMAT_128BIT 2 /**< 128-bit Attribute Information Format. */
uint16_thandle_decl;/**< Handle of the Characteristic Declaration. */
uint16_thandle_value;/**< Handle of the Characteristic Value. */
}ble_gattc_char_t;
/**@brief GATT descriptor. */
typedefstruct
{
uint16_thandle;/**< Descriptor Handle. */
ble_uuid_tuuid;/**< Descriptor UUID. */
}ble_gattc_desc_t;
/**@brief Write Parameters. */
typedefstruct
{
uint8_twrite_op;/**< Write Operation to be performed, see @ref BLE_GATT_WRITE_OPS. */
uint8_tflags;/**< Flags, see @ref BLE_GATT_EXEC_WRITE_FLAGS. */
uint16_thandle;/**< Handle to the attribute to be written. */
uint16_toffset;/**< Offset in bytes. @note For WRITE_CMD and WRITE_REQ, offset must be 0. */
uint16_tlen;/**< Length of data in bytes. */
uint8_tconst*p_value;/**< Pointer to the value data. */
}ble_gattc_write_params_t;
/**@brief Attribute Information for 16-bit Attribute UUID. */
typedefstruct
{
uint16_thandle;/**< Attribute handle. */
ble_uuid_tuuid;/**< 16-bit Attribute UUID. */
}ble_gattc_attr_info16_t;
/**@brief Attribute Information for 128-bit Attribute UUID. */
typedefstruct
{
uint16_thandle;/**< Attribute handle. */
ble_uuid128_tuuid;/**< 128-bit Attribute UUID. */
}ble_gattc_attr_info128_t;
/**@brief Event structure for @ref BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP. */
typedefstruct
{
uint16_tcount;/**< Service count. */
ble_gattc_service_tservices[1];/**< Service data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation.
See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */
}ble_gattc_evt_prim_srvc_disc_rsp_t;
/**@brief Event structure for @ref BLE_GATTC_EVT_REL_DISC_RSP. */
typedefstruct
{
uint16_tcount;/**< Include count. */
ble_gattc_include_tincludes[1];/**< Include data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation.
See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */
}ble_gattc_evt_rel_disc_rsp_t;
/**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_DISC_RSP. */
typedefstruct
{
uint16_tcount;/**< Characteristic count. */
ble_gattc_char_tchars[1];/**< Characteristic data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation.
See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */
}ble_gattc_evt_char_disc_rsp_t;
/**@brief Event structure for @ref BLE_GATTC_EVT_DESC_DISC_RSP. */
typedefstruct
{
uint16_tcount;/**< Descriptor count. */
ble_gattc_desc_tdescs[1];/**< Descriptor data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation.
See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */
}ble_gattc_evt_desc_disc_rsp_t;
/**@brief Event structure for @ref BLE_GATTC_EVT_ATTR_INFO_DISC_RSP. */
typedefstruct
{
uint16_tcount;/**< Attribute count. */
uint8_tformat;/**< Attribute information format, see @ref BLE_GATTC_ATTR_INFO_FORMAT. */
union{
ble_gattc_attr_info16_tattr_info16[1];/**< Attribute information for 16-bit Attribute UUID.
@note This is a variable length array. The size of 1 indicated is only a placeholder for compilation.
See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */
ble_gattc_attr_info128_tattr_info128[1];/**< Attribute information for 128-bit Attribute UUID.
@note This is a variable length array. The size of 1 indicated is only a placeholder for compilation.
See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */
}info;/**< Attribute information union. */
}ble_gattc_evt_attr_info_disc_rsp_t;
/**@brief GATT read by UUID handle value pair. */
typedefstruct
{
uint16_thandle;/**< Attribute Handle. */
uint8_t*p_value;/**< Pointer to the Attribute Value, length is available in @ref ble_gattc_evt_char_val_by_uuid_read_rsp_t::value_len. */
}ble_gattc_handle_value_t;
/**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP. */
typedefstruct
{
uint16_tcount;/**< Handle-Value Pair Count. */
uint16_tvalue_len;/**< Length of the value in Handle-Value(s) list. */
uint8_thandle_value[1];/**< Handle-Value(s) list. To iterate through the list use @ref sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter.
@note This is a variable length array. The size of 1 indicated is only a placeholder for compilation.
See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */
}ble_gattc_evt_char_val_by_uuid_read_rsp_t;
/**@brief Event structure for @ref BLE_GATTC_EVT_READ_RSP. */
typedefstruct
{
uint16_thandle;/**< Attribute Handle. */
uint16_toffset;/**< Offset of the attribute data. */
uint16_tlen;/**< Attribute data length. */
uint8_tdata[1];/**< Attribute data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation.
See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */
}ble_gattc_evt_read_rsp_t;
/**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_VALS_READ_RSP. */
* @note If any of the discovered characteristics have 128-bit UUIDs which are not present in the table provided to ble_vs_uuids_assign, a UUID structure with
* type @ref BLE_UUID_TYPE_UNKNOWN will be received in the corresponding event.
/**@brief Perform a Write (Characteristic Value or Descriptor, with or without response, signed or not, long or reliable) procedure.
*
* @details This function can perform all write procedures described in GATT.
*
* @note Only one write with response procedure can be ongoing per connection at a time.
* If the application tries to write with response while another write with response procedure is ongoing,
* the function call will return @ref NRF_ERROR_BUSY.
* A @ref BLE_GATTC_EVT_WRITE_RSP event will be issued as soon as the write response arrives from the peer.
*
* @note The number of Write without Response that can be queued is configured by @ref ble_gattc_conn_cfg_t::write_cmd_tx_queue_size
* When the queue is full, the function call will return @ref NRF_ERROR_RESOURCES.
* A @ref BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE event will be issued as soon as the transmission of the write without response is complete.
*
* @note The application can keep track of the available queue element count for writes without responses by following the procedure below:
* - Store initial queue element count in a variable.
* - Decrement the variable, which stores the currently available queue element count, by one when a call to this function returns @ref NRF_SUCCESS.
* - Increment the variable, which stores the current available queue element count, by the count variable in @ref BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE event.
*
* @events
* @event{@ref BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE, Write without response transmission complete.}
* @event{@ref BLE_GATTC_EVT_WRITE_RSP, Write response received from the peer.}