Cordio Stack and Cordio Profiles  r2p3-02rel0
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-2018 Arm Ltd. All Rights Reserved.
8  * ARM Ltd. confidential and proprietary.
9  *
10  * IMPORTANT. Your use of this file is governed by a Software License Agreement
11  * ("Agreement") that must be accepted in order to download or otherwise receive a
12  * copy of this file. You may not use or copy this file for any purpose other than
13  * as described in the Agreement. If you do not agree to all of the terms of the
14  * Agreement do not use this file and delete all copies in your possession or control;
15  * if you do not have a copy of the Agreement, you must contact ARM Ltd. prior
16  * to any use, copying or further distribution of this software.
17  */
18 /*************************************************************************************************/
19 
20 #ifndef SVC_CORE_H
21 #define SVC_CORE_H
22 
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /*! \addtogroup GATT_AND_GAP_SERVICE
29  * \{ */
30 
31 
32 /**************************************************************************************************
33  Handle Ranges
34 **************************************************************************************************/
35 /** \name GAP Service Handles
36  * \note GAP -- RPAO characterstic added only when DM Privacy enabled
37  */
38 /**@{*/
39 #define GAP_START_HDL 0x01 /*!< \brief GAP start handle */
40 #define GAP_END_HDL (GAP_MAX_HDL - 3) /*!< \brief GAP end handle */
41 /**@}*/
42 
43 /** \name GATT Service Handles
44  *
45  */
46 /**@{*/
47 #define GATT_START_HDL 0x10 /*!< \brief GATT start handle */
48 #define GATT_END_HDL (GATT_MAX_HDL - 1) /*!< \brief GATT end handle */
49 /**@}*/
50 
51 /**************************************************************************************************
52  Handles
53 **************************************************************************************************/
54 
55 /** \name GAP Service Handles
56  *
57  */
58 /**@{*/
59 /*! \brief GAP service handle */
60 enum
61 {
62  GAP_SVC_HDL = GAP_START_HDL, /*!< \brief GAP service declaration */
63  GAP_DN_CH_HDL, /*!< \brief Device name characteristic */
64  GAP_DN_HDL, /*!< \brief Device name */
65  GAP_AP_CH_HDL, /*!< \brief Appearance characteristic */
66  GAP_AP_HDL, /*!< \brief Appearance */
67  GAP_CAR_CH_HDL, /*!< \brief Central address resolution characteristic */
68  GAP_CAR_HDL, /*!< \brief Central address resolution */
69  GAP_RPAO_CH_HDL, /*!< \brief Resolvable private address only characteristic */
70  GAP_RPAO_HDL, /*!< \brief Resolvable private address only */
71  GAP_MAX_HDL /*!< \brief GAP maximum handle */
72 };
73 /**@}*/
74 
75 /** \name GATT Service Handles
76  *
77  */
78 /**@{*/
79 /*! \brief GATT service handles */
80 enum
81 {
82  GATT_SVC_HDL = GATT_START_HDL, /*!< \brief GATT service declaration */
83  GATT_SC_CH_HDL, /*!< \brief Service changed characteristic */
84  GATT_SC_HDL, /*!< \brief Service changed */
85  GATT_SC_CH_CCC_HDL, /*!< \brief Service changed client characteristic configuration descriptor */
86  GATT_MAX_HDL /*!< \brief GATT maximum handle */
87 };
88 /**@}*/
89 
90 /**************************************************************************************************
91  Function Declarations
92 **************************************************************************************************/
93 
94 /*************************************************************************************************/
95 /*!
96  * \brief Add the services to the attribute server.
97  *
98  * \return None.
99  */
100 /*************************************************************************************************/
101 void SvcCoreAddGroup(void);
102 
103 /*************************************************************************************************/
104 /*!
105  * \brief Remove the services from the attribute server.
106  *
107  * \return None.
108  */
109 /*************************************************************************************************/
110 void SvcCoreRemoveGroup(void);
111 
112 /*************************************************************************************************/
113 /*!
114  * \brief Register callbacks for the service.
115  *
116  * \param readCback Read callback function.
117  * \param writeCback Write callback function.
118  *
119  * \return None.
120  */
121 /*************************************************************************************************/
122 void SvcCoreGattCbackRegister(attsReadCback_t readCback, attsWriteCback_t writeCback);
123 
124 /*************************************************************************************************/
125 /*!
126  * \brief Register callbacks for the service.
127  *
128  * \param readCback Read callback function.
129  * \param writeCback Write callback function.
130  *
131  * \return None.
132  */
133 /*************************************************************************************************/
134 void SvcCoreGapCbackRegister(attsReadCback_t readCback, attsWriteCback_t writeCback);
135 
136 /*************************************************************************************************/
137 /*!
138  * \brief Update the central address resolution attribute value.
139  *
140  * \param value New value.
141  *
142  * \return None.
143  */
144 /*************************************************************************************************/
146 
147 /*************************************************************************************************/
148 /*!
149  * \brief Add the Resolvable Private Address Only (RPAO) characteristic to the GAP service.
150  * The RPAO characteristic should be added only when DM Privacy is enabled.
151  *
152  * \return None.
153  */
154 /*************************************************************************************************/
155 void SvcCoreGapAddRpaoCh(void);
156 
157 /*! \} */ /* GATT_AND_GAP_SERVICE */
158 
159 #ifdef __cplusplus
160 };
161 #endif
162 
163 #endif /* SVC_CORE_H */
164 
GATT service declaration.
Definition: svc_core.h:82
Service changed characteristic.
Definition: svc_core.h:83
Resolvable private address only characteristic.
Definition: svc_core.h:69
uint8_t bool_t
Boolean data type.
Definition: wsf_types.h:78
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:237
Appearance characteristic.
Definition: svc_core.h:65
Central address resolution.
Definition: svc_core.h:68
Resolvable private address only.
Definition: svc_core.h:70
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.
GAP maximum handle.
Definition: svc_core.h:71
GAP service declaration.
Definition: svc_core.h:62
#define GAP_START_HDL
GAP start handle.
Definition: svc_core.h:39
Central address resolution characteristic.
Definition: svc_core.h:67
Service changed.
Definition: svc_core.h:84
void SvcCoreGattCbackRegister(attsReadCback_t readCback, attsWriteCback_t writeCback)
Register callbacks for the service.
Device name.
Definition: svc_core.h:64
GATT maximum handle.
Definition: svc_core.h:86
Appearance.
Definition: svc_core.h:66
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:218
Device name characteristic.
Definition: svc_core.h:63
#define GATT_START_HDL
GATT start handle.
Definition: svc_core.h:47
void SvcCoreRemoveGroup(void)
Remove the services from the attribute server.
Service changed client characteristic configuration descriptor.
Definition: svc_core.h:85
void SvcCoreAddGroup(void)
Add the services to the attribute server.
void SvcCoreGapCentAddrResUpdate(bool_t value)
Update the central address resolution attribute value.