Cordio Stack and Cordio Profiles  r2p3-02rel0
svc_temp.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Example temperature sensor service implementation.
6 *
7  * Copyright (c) 2015-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_TEMP_H
21 #define SVC_TEMP_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /*! \addtogroup TEMPERATURE_SENSOR_SERVICE
28  * \{ */
29 
30 /**************************************************************************************************
31  Handle Ranges
32 **************************************************************************************************/
33 
34 /** \name Temperature Service Handles
35  *
36  */
37 /**@{*/
38 #define TEMP_HANDLE_START 0x60 /*!< \brief Start handle. */
39 #define TEMP_HANDLE_END (TEMP_HANDLE_END_PLUS_ONE - 1) /*!< \brief End handle. */
40 
41 /**************************************************************************************************
42  Handles
43 **************************************************************************************************/
44 
45 /*! \brief Temperature service handles. */
46 enum
47 {
48  TEMP_HANDLE_SVC = TEMP_HANDLE_START, /*!< \brief Service declaration. */
49 
50  TEMP_HANDLE_DATA_CHR, /*!< \brief Data characteristic declaration. */
51  TEMP_HANDLE_DATA, /*!< \brief Data characteristic value. */
52  TEMP_HANDLE_DATA_CLIENT_CHR_CONFIG, /*!< \brief Data characteristic CCCD. */
53  TEMP_HANDLE_DATA_CHR_USR_DESCR, /*!< \brief Data characteristic user description. */
54 
55  TEMP_HANDLE_CONFIG_CHR, /*!< \brief Configruation characteristic declaration. */
56  TEMP_HANDLE_CONFIG, /*!< \brief Configruation characteristic value. */
57  TEMP_HANDLE_CONFIG_CHR_USR_DESCR, /*!< \brief Configruation characteristic user description. */
58 
59  TEMP_HANDLE_PERIOD_CHR, /*!< \brief Period characteristc declaration. */
60  TEMP_HANDLE_PERIOD, /*!< \brief Period characteristc value. */
61  TEMP_HANDLE_PERIOD_CHR_USR_DESCR, /*!< \brief Period characteristc user description. */
62 
63  TEMP_HANDLE_END_PLUS_ONE /*!< \brief Maximum handle. */
64 };
65 /**@}*/
66 
67 /**************************************************************************************************
68  Macros
69 **************************************************************************************************/
70 
71 /** \name Configuration Attributes
72  *
73  */
74 /**@{*/
75 #define TEMP_ATT_CONFIG_DISABLE 0x00u /*!< \brief Disable */
76 #define TEMP_ATT_CONFIG_ENABLE 0x01u /*!< \brief Enable */
77 /**@}*/
78 
79 /** \name Values for Period Attributes
80  *
81  */
82 /**@{*/
83 #define TEMP_ATT_PERIOD_MAX 250u /*!< \brief Maximum period */
84 #define TEMP_ATT_PERIOD_DEFAULT 100u /*!< \brief Default period */
85 #define TEMP_ATT_PERIOD_MIN 10u /*!< \brief Minimum period */
86 /**@}*/
87 
88 /** \name Sizes of Attributes
89  *
90  */
91 /**@{*/
92 #define TEMP_SIZE_CONFIG_ATT 1u /*!< \brief Config Attribute size */
93 #define TEMP_SIZE_PERIOD_ATT 1u /*!< \brief Period Attribute size */
94 #define TEMP_SIZE_DATA_ATT 6u /*!< \brief Data Attribute size */
95 /**@}*/
96 
97 /**************************************************************************************************
98  Function Declarations
99 **************************************************************************************************/
100 
101 /*************************************************************************************************/
102 /*!
103  * \brief Add the services to the attribute server.
104  *
105  * \return None.
106  */
107 /*************************************************************************************************/
108 void SvcTempAddGroup(void);
109 
110 /*************************************************************************************************/
111 /*!
112  * \brief Remove the services from the attribute server.
113  *
114  * \return None.
115  */
116 /*************************************************************************************************/
117 void SvcTempRemoveGroup(void);
118 
119 /*************************************************************************************************/
120 /*!
121  * \brief Register callbacks for the service.
122  *
123  * \param writeCback Write callback function.
124  *
125  * \return None.
126  */
127 /*************************************************************************************************/
128 void SvcTempCbackRegister(attsWriteCback_t writeCback);
129 
130 /*! \} */ /* TEMPERATURE_SENSOR_SERVICE */
131 
132 #ifdef __cplusplus
133 }
134 #endif
135 
136 #endif /* SVC_TEMP_H */
Period characteristc value.
Definition: svc_temp.h:60
void SvcTempRemoveGroup(void)
Remove the services from the attribute server.
Configruation characteristic value.
Definition: svc_temp.h:56
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
Service declaration.
Definition: svc_temp.h:48
Maximum handle.
Definition: svc_temp.h:63
Data characteristic CCCD.
Definition: svc_temp.h:52
#define TEMP_HANDLE_START
Start handle.
Definition: svc_temp.h:38
Configruation characteristic declaration.
Definition: svc_temp.h:55
Data characteristic declaration.
Definition: svc_temp.h:50
Data characteristic user description.
Definition: svc_temp.h:53
Data characteristic value.
Definition: svc_temp.h:51
void SvcTempAddGroup(void)
Add the services to the attribute server.
void SvcTempCbackRegister(attsWriteCback_t writeCback)
Register callbacks for the service.
Configruation characteristic user description.
Definition: svc_temp.h:57
Period characteristc user description.
Definition: svc_temp.h:61
Period characteristc declaration.
Definition: svc_temp.h:59