nRF5 SDK v17.1.0
Modules | Data Structures | Macros | Typedefs | Enumerations | Functions
Device Information Service Client

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...
 

Detailed Description

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.

Note
The application must register this module as BLE event observer using the NRF_SDH_BLE_OBSERVER macro. Example:

Macro Definition Documentation

#define BLE_DIS_C_ARRAY_DEF (   _name,
  _cnt 
)

Macro for defining multiple ble_dis_c instances.

Parameters
_nameName of the array of instances.
_cntNumber of instances to define.
#define BLE_DIS_C_DEF (   _name)

Macro for defining a ble_dis_c instance.

Parameters
_nameName of the instance.

Typedef Documentation

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.

Enumeration Type Documentation

DIS Client characteristic type.

Enumerator
BLE_DIS_C_MANUF_NAME 

Manufacturer Name String characteristic.

BLE_DIS_C_MODEL_NUM 

Model Number String characteristic.

BLE_DIS_C_SERIAL_NUM 

Serial Number String characteristic.

BLE_DIS_C_HW_REV 

Hardware Revision String characteristic.

BLE_DIS_C_FW_REV 

Firmware Revision String characteristic.

BLE_DIS_C_SW_REV 

Software Revision String characteristic.

BLE_DIS_C_SYS_ID 

System ID characteristic.

BLE_DIS_C_CERT_LIST 

IEEE 11073-20601 Regulatory Certification Data List characteristic.

BLE_DIS_C_PNP_ID 

PnP ID characteristic.

BLE_DIS_C_CHAR_TYPES_NUM 

Number of all possible characteristic types.

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.

Function Documentation

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.

Parameters
[in]p_ble_dis_cPointer to the DIS client structure instance to associate with these handles.
[in]conn_handleConnection handle associated with the given DIS Instance.
[in]p_peer_handlesAttribute handles on the DIS server that you want this DIS client to interact with.
Return values
NRF_SUCCESSIf the operation was successful.
NRF_ERROR_NULLIf 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.

Parameters
[in]p_ble_dis_cPointer to the DIS client structure.
[in]p_ble_dis_c_initPointer to the DIS initialization structure containing the initialization information.
Return values
NRF_SUCCESSIf the module was initialized successfully.
NRF_ERROR_NULLAny parameter is NULL.
Returns
If functions from other modules return errors to this function (ble_db_discovery_evt_register), the SoftDevice Global Error Codes are propagated.
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.

Parameters
[in]p_ble_evtPointer to the BLE event.
[in]p_contextPointer 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.

Parameters
[in]p_ble_dis_cPointer to the DIS client structure.
[in]p_evtPointer 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.

Parameters
[in]p_ble_dis_cPointer to the DIS client structure.
[in]char_typeType of characteristic to read.
Return values
NRF_SUCCESSIf the operation was successful.
NRF_ERROR_NULLIf a p_ble_dis_c was a NULL pointer.
NRF_ERROR_INVALID_PARAMIf a char_type is not valid.
NRF_ERROR_INVALID_STATEIf connection handle or attribute handle is invalid.
NRF_ERROR_NO_MEMIf the client request queue is full.

Documentation feedback | Developer Zone | Subscribe | Updated