dis_c.h
Go to the documentation of this file.
1
56 #ifndef __DIS_C_H__
57 #define __DIS_C_H__
58
59 #include "gr55xx_sys.h"
60 #include "ble_prf_types.h"
61 #include "custom_config.h"
62 #include <stdint.h>
63 #include <stdbool.h>
64
69 #define DIS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ?\
70 10 : CFG_MAX_CONNECTIONS)
71 #define DIS_C_STRING_LEN_MAX 128
77 #define DIS_C_11073_BODY_EMPTY 0
78 #define DIS_C_11073_BODY_IEEE 1
79 #define DIS_C_11073_BODY_CONTINUA 2
80 #define DIS_C_11073_BODY_EXP 254
90 typedef enum
91 {
92 DIS_C_EVT_INVALID,
93 DIS_C_EVT_DISCOVERY_COMPLETE,
94 DIS_C_EVT_DISCOVERY_FAIL,
95 DIS_C_EVT_DEV_INFORMATION_READ_RSP,
96 } dis_c_evt_type_t;
97
99 typedef enum
100 {
101 DIS_C_SYS_ID,
102 DIS_C_MODEL_NUM,
103 DIS_C_SERIAL_NUM,
104 DIS_C_HW_REV,
105 DIS_C_FW_REV,
106 DIS_C_SW_REV,
107 DIS_C_MANUF_NAME,
108 DIS_C_CERT_LIST,
109 DIS_C_PNP_ID,
110 DIS_C_CHARACTER_NB
111 } dis_c_char_type_t;
119 typedef struct
120 {
121 uint16_t dis_srvc_start_handle;
122 uint16_t dis_srvc_end_handle;
123 uint16_t dis_char_handle[DIS_C_CHARACTER_NB];
124 } dis_c_handles_t;
125
127 typedef struct
128 {
129 uint8_t *p_data;
130 uint16_t length;
131 } dis_c_string_t;
132
134 typedef struct
135 {
136 uint8_t manufacturer_id[5];
137 uint8_t org_unique_id[3];
138 } dis_c_sys_id_t;
139
141 typedef struct
142 {
143 uint8_t *p_list;
144 uint16_t list_length;
145 } dis_c_reg_cert_data_list_t;
146
148 typedef struct
149 {
150 uint8_t vendor_id_source;
151 uint16_t vendor_id;
152 uint16_t product_id;
153 uint16_t product_version;
154 } dis_c_pnp_id_t;
155
157 typedef struct
158 {
159 dis_c_char_type_t char_type;
160 union
161 {
162 dis_c_sys_id_t sys_id;
163 dis_c_string_t string_data;
164 dis_c_reg_cert_data_list_t cert_list;
165 dis_c_pnp_id_t pnp_id;
166 } encode_rst;
167 } ble_dis_c_read_rsp_t;
168
170 typedef struct
171 {
172 uint8_t conn_idx;
173 dis_c_evt_type_t evt_type;
174 ble_dis_c_read_rsp_t read_rsp;
175 } dis_c_evt_t;
183 typedef void (*dis_c_evt_handler_t)(dis_c_evt_t *p_evt);
199 sdk_err_t dis_client_init(dis_c_evt_handler_t evt_handler);
200
210 sdk_err_t dis_c_disc_srvc_start(uint8_t conn_idx);
211
222 sdk_err_t dis_c_char_value_read(uint8_t conn_idx, dis_c_char_type_t char_read_type);
225 #endif
226
DIS_C_EVT_DISCOVERY_COMPLETE
@ DIS_C_EVT_DISCOVERY_COMPLETE
Definition: dis_c.h:93
DIS_C_EVT_DISCOVERY_FAIL
@ DIS_C_EVT_DISCOVERY_FAIL
Definition: dis_c.h:94
ble_dis_c_read_rsp_t
Device Information Service Client Read Response encode structure.
Definition: dis_c.h:158
DIS_C_EVT_DEV_INFORMATION_READ_RSP
@ DIS_C_EVT_DEV_INFORMATION_READ_RSP
Definition: dis_c.h:95
ble_dis_c_read_rsp_t::pnp_id
dis_c_pnp_id_t pnp_id
Definition: dis_c.h:165
DIS_C_MANUF_NAME
@ DIS_C_MANUF_NAME
Definition: dis_c.h:107
dis_c_pnp_id_t::vendor_id_source
uint8_t vendor_id_source
Definition: dis_c.h:150
dis_c_evt_t::evt_type
dis_c_evt_type_t evt_type
Definition: dis_c.h:173
dis_c_evt_handler_t
void(* dis_c_evt_handler_t)(dis_c_evt_t *p_evt)
Device Information Service Client event handler type.
Definition: dis_c.h:183
ble_dis_c_read_rsp_t::sys_id
dis_c_sys_id_t sys_id
Definition: dis_c.h:162
dis_c_disc_srvc_start
sdk_err_t dis_c_disc_srvc_start(uint8_t conn_idx)
Discovery Device Information Service on peer.
DIS_C_PNP_ID
@ DIS_C_PNP_ID
Definition: dis_c.h:109
ble_dis_c_read_rsp_t::string_data
dis_c_string_t string_data
Definition: dis_c.h:163
dis_c_reg_cert_data_list_t
Response data for IEEE 11073-20601 Regulatory Certification Data List Structure.
Definition: dis_c.h:142
dis_c_reg_cert_data_list_t::p_list
uint8_t * p_list
Definition: dis_c.h:143
DIS_C_SERIAL_NUM
@ DIS_C_SERIAL_NUM
Definition: dis_c.h:103
dis_c_string_t::length
uint16_t length
Definition: dis_c.h:130
gr55xx_sys.h
GR55XX System API.
dis_c_string_t::p_data
uint8_t * p_data
Definition: dis_c.h:129
dis_c_pnp_id_t::product_id
uint16_t product_id
Definition: dis_c.h:152
DIS_C_FW_REV
@ DIS_C_FW_REV
Definition: dis_c.h:105
dis_c_reg_cert_data_list_t::list_length
uint16_t list_length
Definition: dis_c.h:144
dis_c_pnp_id_t::vendor_id
uint16_t vendor_id
Definition: dis_c.h:151
dis_c_evt_type_t
dis_c_evt_type_t
Device Information Service Client event type.
Definition: dis_c.h:91
DIS_C_SYS_ID
@ DIS_C_SYS_ID
Definition: dis_c.h:101
dis_c_pnp_id_t::product_version
uint16_t product_version
Definition: dis_c.h:153
dis_client_init
sdk_err_t dis_client_init(dis_c_evt_handler_t evt_handler)
Register DIS Client event handler.
ble_prf_types.h
Profile/Service Common Types.
dis_c_sys_id_t
Response data for System ID parameters.
Definition: dis_c.h:135
sdk_err_t
uint16_t sdk_err_t
SDK API result type.
Definition: ble_error.h:243
DIS_C_MODEL_NUM
@ DIS_C_MODEL_NUM
Definition: dis_c.h:102
dis_c_handles_t
Handles on the connected peer device needed to interact with it.
Definition: dis_c.h:120
DIS_C_CERT_LIST
@ DIS_C_CERT_LIST
Definition: dis_c.h:108
dis_c_pnp_id_t
Response data for PnP ID parameters.
Definition: dis_c.h:149
DIS_C_SW_REV
@ DIS_C_SW_REV
Definition: dis_c.h:106
dis_c_string_t
Response data for string-based DIS characteristics.
Definition: dis_c.h:128
DIS_C_EVT_INVALID
@ DIS_C_EVT_INVALID
Definition: dis_c.h:92
dis_c_evt_t::conn_idx
uint8_t conn_idx
Definition: dis_c.h:172
dis_c_handles_t::dis_srvc_start_handle
uint16_t dis_srvc_start_handle
Definition: dis_c.h:121
dis_c_evt_t
Device Information Service Client event.
Definition: dis_c.h:171
DIS_C_CHARACTER_NB
@ DIS_C_CHARACTER_NB
Definition: dis_c.h:110
DIS_C_HW_REV
@ DIS_C_HW_REV
Definition: dis_c.h:104
ble_dis_c_read_rsp_t::cert_list
dis_c_reg_cert_data_list_t cert_list
Definition: dis_c.h:164
ble_dis_c_read_rsp_t::char_type
dis_c_char_type_t char_type
Definition: dis_c.h:159
dis_c_handles_t::dis_srvc_end_handle
uint16_t dis_srvc_end_handle
Definition: dis_c.h:122
dis_c_char_type_t
dis_c_char_type_t
Device Information Service Client characteristic type.
Definition: dis_c.h:100
dis_c_evt_t::read_rsp
ble_dis_c_read_rsp_t read_rsp
Definition: dis_c.h:174
dis_c_char_value_read
sdk_err_t dis_c_char_value_read(uint8_t conn_idx, dis_c_char_type_t char_read_type)
Read Device Information Service characteristic value.