Device information Service Client module. More...
Modules | |
Device Information Client configuration | |
Data Structures | |
struct | ble_dis_c_evt_disc_complete_t |
Event structure for BLE_DIS_C_EVT_DISCOVERY_COMPLETE. More... | |
struct | ble_dis_c_string_t |
Response data for string-based DIS characteristics. More... | |
struct | ble_dis_c_evt_read_rsp_t |
Event structure for BLE_DIS_C_EVT_DIS_C_READ_RSP. More... | |
struct | ble_dis_c_evt_read_rsp_err_t |
Event structure for BLE_DIS_C_EVT_DIS_C_READ_RSP_ERROR. More... | |
struct | ble_dis_c_evt_t |
Structure containing the DIS event data received from the peer. More... | |
struct | ble_dis_c_s |
DIS Client structure. More... | |
struct | ble_dis_c_char_group_t |
Structure describing the group of DIS characteristics with which this module can interact. More... | |
struct | ble_dis_c_init_t |
DIS Client initialization structure. More... | |
Macros | |
#define | BLE_DIS_C_DEF(_name) |
Macro for defining a ble_dis_c instance. More... | |
#define | BLE_DIS_C_ARRAY_DEF(_name, _cnt) |
Macro for defining multiple ble_dis_c instances. More... | |
Typedefs | |
typedef uint16_t | ble_dis_c_handle_t |
Attribute handle pointing to DIS characteristics on the connected peer device. | |
typedef struct ble_dis_c_s | ble_dis_c_t |
typedef void(* | ble_dis_c_evt_handler_t )(ble_dis_c_t *p_ble_dis_c, ble_dis_c_evt_t const *p_evt) |
Event handler type. More... | |
Enumerations | |
enum | ble_dis_c_evt_type_t { BLE_DIS_C_EVT_DISCOVERY_COMPLETE, BLE_DIS_C_EVT_DIS_C_READ_RSP, BLE_DIS_C_EVT_DIS_C_READ_RSP_ERROR, BLE_DIS_C_EVT_DISCONNECTED } |
DIS Client event type. More... | |
enum | ble_dis_c_char_type_t { BLE_DIS_C_MANUF_NAME, BLE_DIS_C_MODEL_NUM, BLE_DIS_C_SERIAL_NUM, BLE_DIS_C_HW_REV, BLE_DIS_C_FW_REV, BLE_DIS_C_SW_REV, BLE_DIS_C_SYS_ID, BLE_DIS_C_CERT_LIST, BLE_DIS_C_PNP_ID, BLE_DIS_C_CHAR_TYPES_NUM } |
DIS Client characteristic type. More... | |
Functions | |
ret_code_t | ble_dis_c_init (ble_dis_c_t *p_ble_dis_c, ble_dis_c_init_t *p_ble_dis_c_init) |
Function for initializing the Device Information service client module. More... | |
void | ble_dis_c_on_db_disc_evt (ble_dis_c_t *p_ble_dis_c, ble_db_discovery_evt_t *p_evt) |
Function for handling events from the database discovery module. More... | |
void | ble_dis_c_on_ble_evt (ble_evt_t const *p_ble_evt, void *p_context) |
Function for handling BLE events from the SoftDevice. More... | |
ret_code_t | ble_dis_c_read (ble_dis_c_t *p_ble_dis_c, ble_dis_c_char_type_t char_type) |
Function for reading different characteristics from DIS. More... | |
ret_code_t | ble_dis_c_handles_assign (ble_dis_c_t *p_ble_dis_c, uint16_t conn_handle, ble_dis_c_handle_t const *p_peer_handles) |
Function for assigning handles to this instance of dis_c. More... | |
Device information Service Client module.
This module contains the APIs and types exposed by the Device information Service Client module. These APIs and types can be used by the application to perform discovery of the Device information Service at the peer and interact with it.
#define BLE_DIS_C_ARRAY_DEF | ( | _name, | |
_cnt | |||
) |
Macro for defining multiple ble_dis_c instances.
_name | Name of the array of instances. |
_cnt | Number of instances to define. |
#define BLE_DIS_C_DEF | ( | _name | ) |
Macro for defining a ble_dis_c instance.
_name | Name of the instance. |
typedef void(* ble_dis_c_evt_handler_t)(ble_dis_c_t *p_ble_dis_c, ble_dis_c_evt_t const *p_evt) |
Event handler type.
This is the type of the event handler that should be provided by the application of this module to receive events.
DIS Client characteristic type.
enum ble_dis_c_evt_type_t |
DIS Client event type.
Enumerator | |
---|---|
BLE_DIS_C_EVT_DISCOVERY_COMPLETE |
Event indicating that the DIS and its characteristics were discovered. See ble_dis_c_evt_disc_complete_t. |
BLE_DIS_C_EVT_DIS_C_READ_RSP |
Event indicating that the client has received a read response from a peer. See ble_dis_c_evt_read_rsp_t. |
BLE_DIS_C_EVT_DIS_C_READ_RSP_ERROR |
Event indicating that the client's read request has failed. See ble_dis_c_evt_read_rsp_err_t. |
BLE_DIS_C_EVT_DISCONNECTED |
Event indicating that the DIS server has disconnected. |
ret_code_t ble_dis_c_handles_assign | ( | ble_dis_c_t * | p_ble_dis_c, |
uint16_t | conn_handle, | ||
ble_dis_c_handle_t const * | p_peer_handles | ||
) |
Function for assigning handles to this instance of dis_c.
Call this function when a link has been established with a peer to associate this link to this instance of the module. This makes it possible to handle several links and associate each link to a particular instance of this module. The connection handle and attribute handles will be provided from the discovery event BLE_DIS_C_EVT_DISCOVERY_COMPLETE.
[in] | p_ble_dis_c | Pointer to the DIS client structure instance to associate with these handles. |
[in] | conn_handle | Connection handle associated with the given DIS Instance. |
[in] | p_peer_handles | Attribute handles on the DIS server that you want this DIS client to interact with. |
NRF_SUCCESS | If the operation was successful. |
NRF_ERROR_NULL | If a p_ble_dis_c was a NULL pointer. |
ret_code_t ble_dis_c_init | ( | ble_dis_c_t * | p_ble_dis_c, |
ble_dis_c_init_t * | p_ble_dis_c_init | ||
) |
Function for initializing the Device Information service client module.
This function registers with the Database Discovery module for the DIS. Doing so will make the Database Discovery module look for the presence of a DIS instance at the peer when a discovery is started.
[in] | p_ble_dis_c | Pointer to the DIS client structure. |
[in] | p_ble_dis_c_init | Pointer to the DIS initialization structure containing the initialization information. |
NRF_SUCCESS | If the module was initialized successfully. |
NRF_ERROR_NULL | Any parameter is NULL. |
void ble_dis_c_on_ble_evt | ( | ble_evt_t const * | p_ble_evt, |
void * | p_context | ||
) |
Function for handling BLE events from the SoftDevice.
This function handles the BLE events received from the SoftDevice. If a BLE event is relevant to the DIS module, it is used to update internal variables and, if necessary, send events to the application.
[in] | p_ble_evt | Pointer to the BLE event. |
[in] | p_context | Pointer to the DIS client structure. |
void ble_dis_c_on_db_disc_evt | ( | ble_dis_c_t * | p_ble_dis_c, |
ble_db_discovery_evt_t * | p_evt | ||
) |
Function for handling events from the database discovery module.
This function will handle an event from the database discovery module, and determine if it relates to the discovery of DIS at the peer. If so, it will call the application's event handler indicating that DIS has been discovered at the peer. It also populates the event with the service related information before providing it to the application.
[in] | p_ble_dis_c | Pointer to the DIS client structure. |
[in] | p_evt | Pointer to the event received from the database discovery module. |
ret_code_t ble_dis_c_read | ( | ble_dis_c_t * | p_ble_dis_c, |
ble_dis_c_char_type_t | char_type | ||
) |
Function for reading different characteristics from DIS.
This function can be used to read different characteristics that are available inside DIS. The response data will be provided from the response event BLE_DIS_C_EVT_DIS_C_READ_RSP. The BLE_DIS_C_EVT_DIS_C_READ_RSP_ERROR event can be generated if the read operation is unsuccessful.
[in] | p_ble_dis_c | Pointer to the DIS client structure. |
[in] | char_type | Type of characteristic to read. |
NRF_SUCCESS | If the operation was successful. |
NRF_ERROR_NULL | If a p_ble_dis_c was a NULL pointer. |
NRF_ERROR_INVALID_PARAM | If a char_type is not valid. |
NRF_ERROR_INVALID_STATE | If connection handle or attribute handle is invalid. |
NRF_ERROR_NO_MEM | If the client request queue is full. |