InPlay API
in_ble_prf_anp.h
1 
13 #ifndef IN_BLE_PRF_ANP_H
14 #define IN_BLE_PRF_ANP_H
15 
25 #include <stdint.h>
26 #include "./ble/in_ble_prf.h"
27 
30 {
31  BLE_ANP_SUPP_CAT_ID_SPL_ALERT_SUP = 0x01,
32  BLE_ANP_SUPP_CAT_ID_EMAIL_SUP = 0x02,
33  BLE_ANP_SUPP_CAT_ID_NEWS_SUP = 0x04,
34  BLE_ANP_SUPP_CAT_ID_CALL_SUP = 0x08,
35  BLE_ANP_SUPP_CAT_ID_MISSED_CALL_SUP = 0x10,
36  BLE_ANP_SUPP_CAT_ID_SMS_MMS_SUP = 0x20,
37  BLE_ANP_SUPP_CAT_ID_VOICE_MAIL_SUP = 0x40,
38  BLE_ANP_SUPP_CAT_ID_SCHEDULE_SUP = 0x80,
39  BLE_ANP_SUPP_CAT_ID_HIGH_PRTY_ALERT = 0x0100,
40  BLE_ANP_SUPP_CAT_ID_INST_MSG = 0x0200,
41 };
42 /*#define BLE_ANP_SUPP_CAT_ID_SPL_ALERT_SUP (0x01)
43 #define BLE_ANP_SUPP_CAT_ID_EMAIL_SUP (0x02)
44 #define BLE_ANP_SUPP_CAT_ID_NEWS_SUP (0x04)
45 #define BLE_ANP_SUPP_CAT_ID_CALL_SUP (0x08)
46 #define BLE_ANP_SUPP_CAT_ID_MISSED_CALL_SUP (0x10)
47 #define BLE_ANP_SUPP_CAT_ID_SMS_MMS_SUP (0x20)
48 #define BLE_ANP_SUPP_CAT_ID_VOICE_MAIL_SUP (0x40)
49 #define BLE_ANP_SUPP_CAT_ID_SCHEDULE_SUP (0x80)
51 #define BLE_ANP_SUPP_CAT_ID_HIGH_PRTY_ALERT (0x0100)
52 #define BLE_ANP_SUPP_CAT_ID_INST_MSG (0x0200)
53 */
55 #define BLE_ANS_NEW_ALERT_STRING_INFO_MAX_LEN (18)
56 
58 /*enum ble_anp_category_id
59 {
61  BLE_CAT_ID_SPL_ALERT = 0,
63  BLE_CAT_ID_EMAIL,
65  BLE_CAT_ID_NEWS,
67  BLE_CAT_ID_CALL,
69  BLE_CAT_ID_MISSED_CALL,
71  BLE_CAT_ID_SMS_MMS,
73  BLE_CAT_ID_VOICE_MAIL,
75  BLE_CAT_ID_SCHEDULE,
77  BLE_CAT_ID_HIGH_PRTY_ALERT,
79  BLE_CAT_ID_INST_MSG,
80 
81  BLE_CAT_ID_NB,
82 
84  BLE_CAT_ID_ALL_SUPPORTED_CAT = 255,
85 };*/
86 
88 /*enum ble_anp_ctnl_pt_cmd_id
89 {
91  BLE_CMD_ID_EN_NEW_IN_ALERT_NTF = 0,
93  BLE_CMD_ID_EN_UNREAD_CAT_STATUS_NTF,
95  BLE_CMD_ID_DIS_NEW_IN_ALERT_NTF,
97  BLE_CMD_ID_DIS_UNREAD_CAT_STATUS_NTF,
99  BLE_CMD_ID_NTF_NEW_IN_ALERT_IMM,
101  BLE_CMD_ID_NTF_UNREAD_CAT_STATUS_IMM,
102 
103  BLE_CMD_ID_NB,
104 };*/
105 
106 /*typedef struct
107 {
109  ble_svc_t svc;
110 
112  ble_char_inf_t chars[5];
113 
115  ble_char_desc_inf_t descs[2];
116 } ble_anpc_service_info_t;*/
117 
118 typedef struct
119 {
122 
123  /*The following params are for ANPS only*/
124 
127 
129  enum ble_att_perm sec_lvl;
130 
131  enum ble_anp_ntf_category_id_bits supp_new_alert_cat;
132  enum ble_anp_ntf_category_id_bits supp_unread_alert_cat;
133 } ble_anp_prf_t;
134 
137 {
140  BLE_ANP_UNREAD_ALERT,
141 };
142 
144 typedef struct
145 {
146  //Supported New Alert Category Characteristic value. refer to
147  //"RW BLE Alert Notification Profile Interface Specification"
148  //Category ID Field Keys @ref in anp_common.h
149  uint16_t supp_new_alert_cat;
150  //Supported Unread Alert Category Characteristic value
151  uint16_t supp_unread_alert_cat;
153 
154 typedef struct
155 {
156  uint16_t new_alert_ntf_cfg;
157  uint16_t unread_alert_status_ntf_cfg;
158 } ble_anp_ntf_cfg_t;
159 
160 /*typedef struct
161 {
162  ble_anp_ntf_cfg_t enable;
163  ble_anpc_service_info_t ans_svc;
164 } ble_anpc_cfg_t;*/
165 
166 typedef struct
167 {
169  uint8_t conidx;
170 
171  //refer to "anp_alert_codes" in anp_common.h
172  uint8_t alert_type;
173 
174  uint16_t supp_alert_cat;
175 } ble_evt_supp_alert_cat_t;
176 
177 typedef struct
178 {
180  uint8_t conidx;
181 
183  uint8_t info_str_len;
184 
186  enum ble_anp_ntf_category_id_bits cat_id;
187 
189  uint8_t nb_new_alert;
191  uint8_t str_info[18];
192 } ble_evt_new_alert_t;
193 
194 typedef struct
195 {
197  uint8_t conidx;
198 
200  uint8_t cat_id;
202  uint8_t nb_unread_alert;
203 } ble_evt_unread_alert_t;
204 
207 {
208  BLE_EVT_ANPC_NEW_ALERT = ANP_EVT_CODE +1,
209 
210  BLE_EVT_ANPC_UNREAD_ALERT,
211 
212  //Informed that Control Point has been written by peer device
213  BLE_EVT_ANPS_NTF_IMMEDIATE_REQ_IND,
214 
215  //Informed that value of one of the two Client Characteristic Configuration Descriptors has been
216  //written by the peer device
217  BLE_EVT_ANPS_NTF_STATUS_UPDATE_IND,
218 
219  BLE_EVT_ANPS_NTF_CAT_STATUS_UPDATE_IND,
220 };
221 
222 typedef struct
223 {
225  uint8_t conidx;
226 
227  //refer to `anp_alert_codes`
228  uint8_t alert_type;
229 
230  //refer to `Alert Category ID Bit Mask 0 Masks`
231  uint16_t cat_id;
232 } ble_evt_anps_ntf_immediate_req_ind_t;
233 
234 typedef struct
235 {
236  // Connection index
237  uint8_t conidx;
238 
239  enum ble_anp_alert_type alert_type;
240  enum ble_ntf_cfg ntf_status;
241 } ble_evt_anps_ntf_status_update_ind_t;
242 
243 typedef struct
244 {
245  // Connection index
246  uint8_t conidx;
247 
248  enum ble_anp_alert_type alert_type;
249  enum ble_ntf_cfg ntf_status;
250  enum ble_anp_ntf_category_id_bits cat_id;
251 } ble_evt_anps_ntf_cat_status_update_ind_t;
252 
253 typedef struct
254 {
256  uint8_t info_str_len;
257 
259  uint8_t cat_id;
260 
262  uint8_t nb_new_alert;
264  uint8_t str_info[BLE_ANS_NEW_ALERT_STRING_INFO_MAX_LEN];
265 } ble_anp_new_alert_value;
266 
267 typedef struct
268 {
270  uint8_t cat_id;
272  uint8_t nb_unread_alert;
273 } ble_anp_unread_alert_status;
274 
275 typedef union
276 {
278  ble_anp_new_alert_value new_alert;
280  ble_anp_unread_alert_status unread_alert_status;
281 } ble_anp_notify_alert_value;
282 
283 /*
284  * APIs
285  ****************************************************************************************
286  */
287 
288 
301 int in_ble_anps_add(void *hdl, ble_anp_prf_t *p_prf, comp_cb callback);
302 
316 int in_ble_anps_enable(void *hdl, int conidx, struct anps_enable_rsp *p_rsp, comp_cb callback);
317 
332 int in_ble_anps_notify_alert(void *hdl, int conidx, enum ble_anp_alert_type alert_type, ble_anp_notify_alert_value value, struct anps_cmp_evt *p_rsp, comp_cb callback) ;
333 
346 int in_ble_anpc_add(void *hdl, ble_anp_prf_t *p_prf, comp_cb callback);
347 
360 int in_ble_anpc_enable(void *hdl, int conidx, struct anpc_enable_rsp *p_rsp, comp_cb callback);
361 
377 int in_ble_anpc_get_ntf_supp_categroy(void *hdl, int conidx, enum ble_anp_alert_type alert_type, enum ble_anp_ntf_category_id_bits *p_supp_cat, comp_cb callback);
378 
394 int in_ble_anpc_get_ntf_status(void *hdl, int conidx, enum ble_anp_alert_type alert_type, enum ble_ntf_cfg *p_alert_ntf_cfg, comp_cb callback);
395 
411 int in_ble_anpc_set_ntf_status(void *hdl, int conidx, enum ble_anp_alert_type alert_type, enum ble_ntf_cfg alert_ntf_cfg, comp_cb callback);
412 
429 int in_ble_anpc_set_ntf_cat_status(void *hdl, int conidx,
430  enum ble_anp_alert_type alert_type,
431  enum ble_anp_ntf_category_id_bits cat_id,
432  enum ble_ntf_cfg ntf_cfg, comp_cb callback);
433 
449 int in_ble_anpc_req_ntf_immediately(void *hdl, int conidx,
450  enum ble_anp_alert_type alert_type,
451  enum ble_anp_ntf_category_id_bits cat_id, comp_cb callback);
453 
454 #endif /* IN_BLE_PRF_BAS_H */
455 
int in_ble_anps_enable(void *hdl, int conidx, struct anps_enable_rsp *p_rsp, comp_cb callback)
Enable ANP service.
ble_att_perm
Definition: in_ble_att.h:63
int in_ble_anpc_add(void *hdl, ble_anp_prf_t *p_prf, comp_cb callback)
Add ANP Client Service.
bool check_enc_key_size
If let the service check whether encryption key size is 16bytes (more security).
Definition: in_ble_prf_anp.h:126
int in_ble_anps_notify_alert(void *hdl, int conidx, enum ble_anp_alert_type alert_type, ble_anp_notify_alert_value value, struct anps_cmp_evt *p_rsp, comp_cb callback)
Send new alert notification or indication to peer device.
int in_ble_anpc_set_ntf_status(void *hdl, int conidx, enum ble_anp_alert_type alert_type, enum ble_ntf_cfg alert_ntf_cfg, comp_cb callback)
Get ANP server notification status.
int in_ble_anpc_req_ntf_immediately(void *hdl, int conidx, enum ble_anp_alert_type alert_type, enum ble_anp_ntf_category_id_bits cat_id, comp_cb callback)
Ask ANP server to send notification immediately for individual category.
bool multi_instance
If the service is multi-instance.
Definition: in_ble_prf_anp.h:121
ble_anp_ntf_category_id_bits
Alert Category ID Bit Mask 0 Masks.
Definition: in_ble_prf_anp.h:29
int in_ble_anps_add(void *hdl, ble_anp_prf_t *p_prf, comp_cb callback)
Add ANP Server Service.
int in_ble_anpc_set_ntf_cat_status(void *hdl, int conidx, enum ble_anp_alert_type alert_type, enum ble_anp_ntf_category_id_bits cat_id, enum ble_ntf_cfg ntf_cfg, comp_cb callback)
Set ANP server notification status for individual category.
#define BLE_ANS_NEW_ALERT_STRING_INFO_MAX_LEN
New Alert Characteristic Value - Text String Information Max Length.
Definition: in_ble_prf_anp.h:55
int in_ble_anpc_enable(void *hdl, int conidx, struct anpc_enable_rsp *p_rsp, comp_cb callback)
Enable ANP client.
int in_ble_anpc_get_ntf_status(void *hdl, int conidx, enum ble_anp_alert_type alert_type, enum ble_ntf_cfg *p_alert_ntf_cfg, comp_cb callback)
Get ANP server notification status.
ble_ntf_cfg
Notification config.
Definition: in_ble_prf.h:79
int in_ble_anpc_get_ntf_supp_categroy(void *hdl, int conidx, enum ble_anp_alert_type alert_type, enum ble_anp_ntf_category_id_bits *p_supp_cat, comp_cb callback)
Get ANP server supported category.
New Alert.
Definition: in_ble_prf_anp.h:139
Category ID Field Keys.
Definition: in_ble_prf_anp.h:118
ble_anp_evt
Events defines for ANP Services.
Definition: in_ble_prf_anp.h:206
Parameters of the ANPS_ENABLE_REQ message.
Definition: in_ble_prf_anp.h:144
ble_anp_alert_type
Alert codes.
Definition: in_ble_prf_anp.h:136