xref: /nrf52832-nimble/packages/NimBLE-latest/nimble/host/services/ans/include/services/ans/ble_svc_ans.h (revision 042d53a763ad75cb1465103098bb88c245d95138)
1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements.  See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership.  The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License.  You may obtain a copy of the License at
9  *
10  *  http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied.  See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
20 #ifndef H_BLE_SVC_ANS_
21 #define H_BLE_SVC_ANS_
22 
23 struct ble_hs_cfg;
24 
25 /* 16 Bit Alert Notification Service UUID */
26 #define BLE_SVC_ANS_UUID16                                  0x1811
27 
28 /* 16 Bit Alert Notification Service Characteristic UUIDs */
29 #define BLE_SVC_ANS_CHR_UUID16_SUP_NEW_ALERT_CAT            0x2a47
30 #define BLE_SVC_ANS_CHR_UUID16_NEW_ALERT                    0x2a46
31 #define BLE_SVC_ANS_CHR_UUID16_SUP_UNR_ALERT_CAT            0x2a48
32 #define BLE_SVC_ANS_CHR_UUID16_UNR_ALERT_STAT               0x2a45
33 #define BLE_SVC_ANS_CHR_UUID16_ALERT_NOT_CTRL_PT            0x2a44
34 
35 /* Alert Notification Service Category ID Bit Masks
36  *
37  * TODO: Add remaining 2 optional categories */
38 #define BLE_SVC_ANS_CAT_BM_NONE                             0x00
39 #define BLE_SVC_ANS_CAT_BM_SIMPLE_ALERT                     0x01
40 #define BLE_SVC_ANS_CAT_BM_EMAIL                            0x02
41 #define BLE_SVC_ANS_CAT_BM_NEWS                             0x04
42 #define BLE_SVC_ANS_CAT_BM_CALL                             0x08
43 #define BLE_SVC_ANS_CAT_BM_MISSED_CALL                      0x10
44 #define BLE_SVC_ANS_CAT_BM_SMS                              0x20
45 #define BLE_SVC_ANS_CAT_BM_VOICE_MAIL                       0x40
46 #define BLE_SVC_ANS_CAT_BM_SCHEDULE                         0x80
47 
48 /* Alert Notification Service Category IDs
49  *
50  * TODO: Add remaining 2 optional categories */
51 #define BLE_SVC_ANS_CAT_ID_SIMPLE_ALERT                     0
52 #define BLE_SVC_ANS_CAT_ID_EMAIL                            1
53 #define BLE_SVC_ANS_CAT_ID_NEWS                             2
54 #define BLE_SVC_ANS_CAT_ID_CALL                             3
55 #define BLE_SVC_ANS_CAT_ID_MISSED_CALL                      4
56 #define BLE_SVC_ANS_CAT_ID_SMS                              5
57 #define BLE_SVC_ANS_CAT_ID_VOICE_MAIL                       6
58 #define BLE_SVC_ANS_CAT_ID_SCHEDULE                         7
59 
60 /* Number of valid ANS categories
61  *
62  * TODO: Add remaining 2 optional categories */
63 #define BLE_SVC_ANS_CAT_NUM                                 8
64 
65 /* Alert Notification Control Point Command IDs */
66 #define BLE_SVC_ANS_CMD_EN_NEW_ALERT_CAT                    0
67 #define BLE_SVC_ANS_CMD_EN_UNR_ALERT_CAT                    1
68 #define BLE_SVC_ANS_CMD_DIS_NEW_ALERT_CAT                   2
69 #define BLE_SVC_ANS_CMD_DIS_UNR_ALERT_CAT                   3
70 #define BLE_SVC_ANS_CMD_NOT_NEW_ALERT_IMMEDIATE             4
71 #define BLE_SVC_ANS_CMD_NOT_UNR_ALERT_IMMEDIATE             5
72 
73 /* Error Definitions */
74 #define BLE_SVC_ANS_ERR_CMD_NOT_SUPPORTED                   0xA0
75 
76 void ble_svc_ans_on_gap_connect(uint16_t conn_handle);
77 
78 int ble_svc_ans_new_alert_add(uint8_t cat_id,
79                               const char * info_str);
80 int ble_svc_ans_unr_alert_add(uint8_t cat_id);
81 
82 void ble_svc_ans_init(void);
83 
84 #endif
85 
86