WXK
2025-01-22 255c51174a0571340ef470184064a5c75d261d27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 
#ifndef H_BLE_SVC_ANS_
#define H_BLE_SVC_ANS_
 
#include <stdint.h>
 
struct ble_hs_cfg;
 
/* 16 Bit Alert Notification Service UUID */
#define BLE_SVC_ANS_UUID16                                  0x1811
 
/* 16 Bit Alert Notification Service Characteristic UUIDs */
#define BLE_SVC_ANS_CHR_UUID16_SUP_NEW_ALERT_CAT            0x2a47
#define BLE_SVC_ANS_CHR_UUID16_NEW_ALERT                    0x2a46
#define BLE_SVC_ANS_CHR_UUID16_SUP_UNR_ALERT_CAT            0x2a48
#define BLE_SVC_ANS_CHR_UUID16_UNR_ALERT_STAT               0x2a45
#define BLE_SVC_ANS_CHR_UUID16_ALERT_NOT_CTRL_PT            0x2a44
 
/* Alert Notification Service Category ID Bit Masks
 *
 * TODO: Add remaining 2 optional categories */
#define BLE_SVC_ANS_CAT_BM_NONE                             0x00
#define BLE_SVC_ANS_CAT_BM_SIMPLE_ALERT                     0x01
#define BLE_SVC_ANS_CAT_BM_EMAIL                            0x02
#define BLE_SVC_ANS_CAT_BM_NEWS                             0x04
#define BLE_SVC_ANS_CAT_BM_CALL                             0x08
#define BLE_SVC_ANS_CAT_BM_MISSED_CALL                      0x10
#define BLE_SVC_ANS_CAT_BM_SMS                              0x20
#define BLE_SVC_ANS_CAT_BM_VOICE_MAIL                       0x40
#define BLE_SVC_ANS_CAT_BM_SCHEDULE                         0x80
 
/* Alert Notification Service Category IDs
 *
 * TODO: Add remaining 2 optional categories */
#define BLE_SVC_ANS_CAT_ID_SIMPLE_ALERT                     0
#define BLE_SVC_ANS_CAT_ID_EMAIL                            1
#define BLE_SVC_ANS_CAT_ID_NEWS                             2
#define BLE_SVC_ANS_CAT_ID_CALL                             3
#define BLE_SVC_ANS_CAT_ID_MISSED_CALL                      4
#define BLE_SVC_ANS_CAT_ID_SMS                              5
#define BLE_SVC_ANS_CAT_ID_VOICE_MAIL                       6
#define BLE_SVC_ANS_CAT_ID_SCHEDULE                         7
 
/* Number of valid ANS categories
 *
 * TODO: Add remaining 2 optional categories */
#define BLE_SVC_ANS_CAT_NUM                                 8
 
/* Alert Notification Control Point Command IDs */
#define BLE_SVC_ANS_CMD_EN_NEW_ALERT_CAT                    0
#define BLE_SVC_ANS_CMD_EN_UNR_ALERT_CAT                    1
#define BLE_SVC_ANS_CMD_DIS_NEW_ALERT_CAT                   2
#define BLE_SVC_ANS_CMD_DIS_UNR_ALERT_CAT                   3
#define BLE_SVC_ANS_CMD_NOT_NEW_ALERT_IMMEDIATE             4
#define BLE_SVC_ANS_CMD_NOT_UNR_ALERT_IMMEDIATE             5
 
/* Error Definitions */
#define BLE_SVC_ANS_ERR_CMD_NOT_SUPPORTED                   0xA0
 
void ble_svc_ans_init(void);
 
void ble_svc_ans_on_gap_connect(uint16_t conn_handle);
 
int ble_svc_ans_new_alert_add(uint8_t cat_id, const char *info_str);
int ble_svc_ans_unr_alert_add(uint8_t cat_id);
 
#endif