InPlay API
in_ble_prf_bas.h
1 
13 #ifndef IN_BLE_PRF_BAS_H
14 #define IN_BLE_PRF_BAS_H
15 
25 #include <stdint.h>
26 #include "./ble/in_ble_prf.h"
27 #include "ble/in_ble_evt.h"
28 #define BLE_BASS_INSTANCES_MAX (2)
29 
30 /*
31  * Enumerations
32  ****************************************************************************************
33  */
34 
37 {
38  BASC_EVT_CODE = BAS_EVT_CODE +1,
39 
42 
43  BASS_EVT_CODE = BAS_EVT_CODE + 0x10,
44 
47 };
48 
51 {
58 
59  BLE_BASC_INFO_MAX,
60 };
61 
64 {
69 };
70 
73 {
76 
77  BLE_BAS_CHAR_MAX,
78 };
79 
82 {
87 
88  BLE_BAS_DESC_MAX,
89 };
90 
91 /*
92  * Structures
93  ****************************************************************************************
94  */
95 
96 typedef struct
97 {
99  uint8_t conidx;
101  uint8_t batt_level;
103  uint8_t bas_nb;
104 } ble_evt_basc_batt_level_ind_t;
105 
106 typedef struct
107 {
109  uint8_t conidx;
111  uint8_t ntf_cfg;
112 } ble_evt_bass_level_ntf_cfg_ind_t;
113 
114 typedef struct
115 {
117  ble_svc_t svc;
118 
121  ble_char_inf_t chars[BLE_BAS_CHAR_MAX];
122 
126  ble_char_desc_inf_t descs[BLE_BAS_DESC_MAX];
127 } ble_basc_content_t;
128 
130 typedef struct
131 {
133  uint8_t info;
135  uint8_t bas_nb;
136 
138  union
139  {
141  uint8_t batt_level;
143  uint16_t ntf_cfg;
146  } data;
148 
150 typedef struct
151 {
154 
155  /*The following params are for ANPS only*/
156 
159 
161  enum ble_att_perm sec_lvl;
162 
164  uint8_t bas_nb;
166  uint8_t features[BLE_BASS_INSTANCES_MAX];
168  ble_char_pres_fmt_t batt_level_pres_format[BLE_BASS_INSTANCES_MAX];
169 } ble_bas_prf_t;
170 
172 typedef struct
173 {
175  uint8_t ntf_cfg;
177  uint8_t old_batt_lvl[BLE_BASS_INSTANCES_MAX];
179 
180 /*
181  * APIs
182  ****************************************************************************************
183  */
184 
185 
198 int in_ble_basc_add(void *hdl, ble_bas_prf_t *p_prf, comp_cb callback);
199 
216 int in_ble_basc_enable(void *hdl, int conidx, int con_type, uint8_t bas_nb, ble_basc_content_t content[], comp_cb callback);
217 
231 int in_ble_basc_read_info_req(void *hdl, int conidx, int bas_nb, int basc_info, ble_basc_read_info_rsp_t *rsp, comp_cb callback);
232 
245 int in_ble_basc_ntf_req(void *hdl, uint8_t conidx, uint8_t bas_nb, uint16_t ntf_cfg, comp_cb callback);
246 
259 int in_ble_bass_add(void *hdl, ble_bas_prf_t *p_prf, comp_cb callback);
260 
273 int in_ble_bass_enable(void *hdl, int conidx, ble_bass_enable_req_t *p_req, comp_cb callback);
274 
287 int in_ble_bass_batt_level_upd_req(void *hdl, int conidx, uint8_t instance, uint8_t batt_lvl, comp_cb callback);
288 
289 
291 
292 #endif /* IN_BLE_PRF_BAS_H */
293 
Battery Level Characteristic support notifications.
Definition: in_ble_prf_bas.h:68
Battery Level.
Definition: in_ble_prf_bas.h:75
Parameters for the database creation.
Definition: in_ble_prf_bas.h:150
characteristic presentation information
Definition: in_ble_prf.h:111
characteristic description
Definition: in_ble_prf.h:208
uint8_t bas_nb
Battery Service Instance - From 0 to BASC_NB_BAS_INSTANCES_MAX-1.
Definition: in_ble_prf_bas.h:135
Parameters of the BASS_ENABLE_REQ message.
Definition: in_ble_prf_bas.h:172
ble_att_perm
Definition: in_ble_att.h:63
bool check_enc_key_size
If let the service check whether encryption key size is 16bytes (more security).
Definition: in_ble_prf_bas.h:158
characteristic info
Definition: in_ble_prf.h:195
ble_bass_char_type
Battery Service Characteristics.
Definition: in_ble_prf_bas.h:72
Battery Level Characteristic Presentation Format.
Definition: in_ble_prf_bas.h:84
int in_ble_basc_add(void *hdl, ble_bas_prf_t *p_prf, comp_cb callback)
Add Battery Client Service.
service handles
Definition: in_ble_prf.h:171
uint8_t batt_level
Battery Level - if info = BASC_BATT_LVL_VAL.
Definition: in_ble_prf_bas.h:141
Parameters of the BASC_READ_INFO_RSP message.
Definition: in_ble_prf_bas.h:130
bool multi_instance
If the service is multi-instance.
Definition: in_ble_prf_bas.h:153
int in_ble_bass_enable(void *hdl, int conidx, ble_bass_enable_req_t *p_req, comp_cb callback)
Enable BAS server service.
uint16_t ntf_cfg
Notification Configuration Value - if info = BASC_NTF_CFG.
Definition: in_ble_prf_bas.h:143
uint8_t info
Characteristic info.
Definition: in_ble_prf_bas.h:133
Indicate that the Battery Level value has been received,.
Definition: in_ble_prf_bas.h:41
int in_ble_basc_read_info_req(void *hdl, int conidx, int bas_nb, int basc_info, ble_basc_read_info_rsp_t *rsp, comp_cb callback)
Read peer info.
int in_ble_bass_batt_level_upd_req(void *hdl, int conidx, uint8_t instance, uint8_t batt_lvl, comp_cb callback)
Update battery level request.
Inform that Battery Level Notification Configuration has been changed - use to update bond data...
Definition: in_ble_prf_bas.h:46
Battery Level Client Characteristic Configuration.
Definition: in_ble_prf_bas.h:55
ble_basc_info
Peer battery info that can be read.
Definition: in_ble_prf_bas.h:50
ble_char_pres_fmt_t char_pres_format
Characteristic Presentation Format - if info = BASC_BATT_LVL_PRES_FORMAT.
Definition: in_ble_prf_bas.h:145
ble_bass_desc_type
Battery Service Descriptors.
Definition: in_ble_prf_bas.h:81
ble_bas_evt
Events defines for Battery Services.
Definition: in_ble_prf_bas.h:36
Battery Level Characteristic Presentation Format.
Definition: in_ble_prf_bas.h:57
uint8_t bas_nb
Number of BAS to add.
Definition: in_ble_prf_bas.h:164
int in_ble_basc_ntf_req(void *hdl, uint8_t conidx, uint8_t bas_nb, uint16_t ntf_cfg, comp_cb callback)
Configure notification.
Battery Level Characteristic doesn&#39;t support notifications.
Definition: in_ble_prf_bas.h:66
ble_bass_features
Features Flag Masks.
Definition: in_ble_prf_bas.h:63
Battery Level value.
Definition: in_ble_prf_bas.h:53
Battery Level Client Characteristic Configuration.
Definition: in_ble_prf_bas.h:86
int in_ble_bass_add(void *hdl, ble_bas_prf_t *p_prf, comp_cb callback)
Add Battery Server Service.
uint8_t ntf_cfg
Client Notification Configuration,.
Definition: in_ble_prf_bas.h:175
int in_ble_basc_enable(void *hdl, int conidx, int con_type, uint8_t bas_nb, ble_basc_content_t content[], comp_cb callback)
Enable BAS client service.