Mistake on this page?
Report an issue in GitHub or email us
svc_core.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Example GATT and GAP service implementations.
6  *
7  * Copyright (c) 2009-2019 Arm Ltd. All Rights Reserved.
8  *
9  * Copyright (c) 2019-2020 Packetcraft, Inc.
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  * http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  */
23 /*************************************************************************************************/
24 
25 #ifndef SVC_CORE_H
26 #define SVC_CORE_H
27 
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 /*! \addtogroup GATT_AND_GAP_SERVICE
34  * \{ */
35 
36 /**************************************************************************************************
37  Handle Ranges
38 **************************************************************************************************/
39 /** \name GAP Service Handles
40  * \note GAP -- RPAO characterstic added only when DM Privacy enabled
41  */
42 /**@{*/
43 #define GAP_START_HDL 0x01 /*!< \brief GAP start handle */
44 #define GAP_END_HDL (GAP_MAX_HDL - 3) /*!< \brief GAP end handle */
45 /**@}*/
46 
47 /** \name GATT Service Handles
48  *
49  */
50 /**@{*/
51 #define GATT_START_HDL 0x10 /*!< \brief GATT start handle */
52 #define GATT_END_HDL (GATT_MAX_HDL - 1) /*!< \brief GATT end handle */
53 /**@}*/
54 
55 /**************************************************************************************************
56  Handles
57 **************************************************************************************************/
58 
59 /** \name GAP Service Handles
60  *
61  */
62 /**@{*/
63 /*! \brief GAP service handle */
64 enum
65 {
66  GAP_SVC_HDL = GAP_START_HDL, /*!< \brief GAP service declaration */
67  GAP_DN_CH_HDL, /*!< \brief Device name characteristic */
68  GAP_DN_HDL, /*!< \brief Device name */
69  GAP_AP_CH_HDL, /*!< \brief Appearance characteristic */
70  GAP_AP_HDL, /*!< \brief Appearance */
71  GAP_CAR_CH_HDL, /*!< \brief Central address resolution characteristic */
72  GAP_CAR_HDL, /*!< \brief Central address resolution */
73  GAP_RPAO_CH_HDL, /*!< \brief Resolvable private address only characteristic */
74  GAP_RPAO_HDL, /*!< \brief Resolvable private address only */
75  GAP_MAX_HDL /*!< \brief GAP maximum handle */
76 };
77 /**@}*/
78 
79 /** \name GATT Service Handles
80  *
81  */
82 /**@{*/
83 /*! \brief GATT service handles */
84 enum
85 {
86  GATT_SVC_HDL = GATT_START_HDL, /*!< \brief GATT service declaration */
87  GATT_SC_CH_HDL, /*!< \brief Service changed characteristic */
88  GATT_SC_HDL, /*!< \brief Service changed */
89  GATT_SC_CH_CCC_HDL, /*!< \brief Service changed client characteristic configuration descriptor */
90  GATT_CSF_CH_HDL, /*!< \brief Client supported features characteristic */
91  GATT_CSF_HDL, /*!< \brief Client supported features */
92  GATT_DBH_CH_HDL, /*!< \brief Database hash characteristic */
93  GATT_DBH_HDL, /*!< \brief Database hash */
94  GATT_SSF_CH_HDL, /*!< \brief Server supported features characteristic */
95  GATT_SSF_HDL, /*!< \brief Server supported features */
96  GATT_MAX_HDL /*!< \brief GATT maximum handle */
97 };
98 /**@}*/
99 
100 /**************************************************************************************************
101  Function Declarations
102 **************************************************************************************************/
103 
104 /*************************************************************************************************/
105 /*!
106  * \brief Add the services to the attribute server.
107  *
108  * \return None.
109  */
110 /*************************************************************************************************/
111 void SvcCoreAddGroup(void);
112 
113 /*************************************************************************************************/
114 /*!
115  * \brief Remove the services from the attribute server.
116  *
117  * \return None.
118  */
119 /*************************************************************************************************/
120 void SvcCoreRemoveGroup(void);
121 
122 /*************************************************************************************************/
123 /*!
124  * \brief Register callbacks for the service.
125  *
126  * \param readCback Read callback function.
127  * \param writeCback Write callback function.
128  *
129  * \return None.
130  */
131 /*************************************************************************************************/
132 void SvcCoreGattCbackRegister(attsReadCback_t readCback, attsWriteCback_t writeCback);
133 
134 /*************************************************************************************************/
135 /*!
136  * \brief Register callbacks for the service.
137  *
138  * \param readCback Read callback function.
139  * \param writeCback Write callback function.
140  *
141  * \return None.
142  */
143 /*************************************************************************************************/
144 void SvcCoreGapCbackRegister(attsReadCback_t readCback, attsWriteCback_t writeCback);
145 
146 /*************************************************************************************************/
147 /*!
148  * \brief Update the central address resolution attribute value.
149  *
150  * \param value New value.
151  *
152  * \return None.
153  */
154 /*************************************************************************************************/
155 void SvcCoreGapCentAddrResUpdate(bool_t value);
156 
157 /*************************************************************************************************/
158 /*!
159  * \brief Add the Resolvable Private Address Only (RPAO) characteristic to the GAP service.
160  * The RPAO characteristic should be added only when DM Privacy is enabled.
161  *
162  * \return None.
163  */
164 /*************************************************************************************************/
165 void SvcCoreGapAddRpaoCh(void);
166 
167 /*************************************************************************************************/
168 /*!
169  * \brief Set the Server Supported Features (SSF) bitmask.
170  *
171  * \param value New value.
172  *
173  * \return None.
174  */
175 /*************************************************************************************************/
176 void SvcCoreGattSetSsf(uint8_t value);
177 
178 /*! \} */ /* GATT_AND_GAP_SERVICE */
179 
180 #ifdef __cplusplus
181 };
182 #endif
183 
184 #endif /* SVC_CORE_H */
185 
Central address resolution characteristic.
Definition: svc_core.h:71
Server supported features characteristic.
Definition: svc_core.h:94
Device name.
Definition: svc_core.h:68
uint8_t(* attsWriteCback_t)(dmConnId_t connId, uint16_t handle, uint8_t operation, uint16_t offset, uint16_t len, uint8_t *pValue, attsAttr_t *pAttr)
Attribute group write callback.
Definition: att_api.h:272
GATT maximum handle.
Definition: svc_core.h:96
void SvcCoreGapAddRpaoCh(void)
Add the Resolvable Private Address Only (RPAO) characteristic to the GAP service. The RPAO characteri...
void SvcCoreGapCbackRegister(attsReadCback_t readCback, attsWriteCback_t writeCback)
Register callbacks for the service.
Appearance characteristic.
Definition: svc_core.h:69
Service changed.
Definition: svc_core.h:88
Service changed characteristic.
Definition: svc_core.h:87
Resolvable private address only.
Definition: svc_core.h:74
Client supported features.
Definition: svc_core.h:91
#define GAP_START_HDL
GAP start handle.
Definition: svc_core.h:43
void SvcCoreGattSetSsf(uint8_t value)
Set the Server Supported Features (SSF) bitmask.
Central address resolution.
Definition: svc_core.h:72
void SvcCoreGattCbackRegister(attsReadCback_t readCback, attsWriteCback_t writeCback)
Register callbacks for the service.
GAP start handle.
Definition: svc_core.h:66
Database hash characteristic.
Definition: svc_core.h:92
Device name characteristic.
Definition: svc_core.h:67
Client supported features characteristic.
Definition: svc_core.h:90
Resolvable private address only characteristic.
Definition: svc_core.h:73
uint8_t(* attsReadCback_t)(dmConnId_t connId, uint16_t handle, uint8_t operation, uint16_t offset, attsAttr_t *pAttr)
Attribute group read callback.
Definition: att_api.h:253
GAP maximum handle.
Definition: svc_core.h:75
Database hash.
Definition: svc_core.h:93
GATT start handle.
Definition: svc_core.h:86
Server supported features.
Definition: svc_core.h:95
#define GATT_START_HDL
GATT start handle.
Definition: svc_core.h:51
void SvcCoreRemoveGroup(void)
Remove the services from the attribute server.
Appearance.
Definition: svc_core.h:70
void SvcCoreAddGroup(void)
Add the services to the attribute server.
Service changed client characteristic configuration descriptor.
Definition: svc_core.h:89
void SvcCoreGapCentAddrResUpdate(bool_t value)
Update the central address resolution attribute value.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.