Cordio Stack and Cordio Profiles  r2p3-02rel0
svc_gyro.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Example gyroscope 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_GYRO_H
21 #define SVC_GYRO_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /*! \addtogroup GYROSCOPE_SENSOR_SERVICE
28  * \{ */
29 
30 /**************************************************************************************************
31  Handle Ranges
32 **************************************************************************************************/
33 
34 /** \name Gyroscope Sensor Service Handles
35  *
36  */
37 /**@{*/
38 #define GYRO_HANDLE_START 0x50 /*!< \brief Start handle. */
39 #define GYRO_HANDLE_END (GYRO_HANDLE_END_PLUS_ONE - 1) /*!< \brief End handle. */
40 
41 /**************************************************************************************************
42  Handles
43 **************************************************************************************************/
44 
45 /*! \brief Gyroscope service handles. */
46 enum
47 {
48  GYRO_HANDLE_SVC = GYRO_HANDLE_START, /*!< \brief Service declaration. */
49 
50  GYRO_HANDLE_DATA_CHR, /*!< \brief Data characteristic declaration. */
51  GYRO_HANDLE_DATA, /*!< \brief Data characteristic value. */
52  GYRO_HANDLE_DATA_CLIENT_CHR_CONFIG, /*!< \brief Data characteristic CCCD. */
53  GYRO_HANDLE_DATA_CHR_USR_DESCR, /*!< \brief Data characteristic user description. */
54 
55  GYRO_HANDLE_TEMPDATA_CHR, /*!< \brief Temporary data characteristic declaration. */
56  GYRO_HANDLE_TEMPDATA, /*!< \brief Temporary data characteristic value. */
57  GYRO_HANDLE_TEMPDATA_CLIENT_CHR_CONFIG, /*!< \brief Temporary data characteristic CCCD. */
58  GYRO_HANDLE_TEMPDATA_CHR_USR_DESCR, /*!< \brief Temporary data characteristic user description. */
59 
60  GYRO_HANDLE_CONFIG_CHR, /*!< \brief Configuration characteristic delcaration. */
61  GYRO_HANDLE_CONFIG, /*!< \brief Configuration characteristic value. */
62  GYRO_HANDLE_CONFIG_CHR_USR_DESCR, /*!< \brief Configuration characteristic user description. */
63 
64  GYRO_HANDLE_PERIOD_CHR, /*!< \brief Period characteristic declaration. */
65  GYRO_HANDLE_PERIOD, /*!< \brief Period characteristic value. */
66  GYRO_HANDLE_PERIOD_CHR_USR_DESCR, /*!< \brief Period characteristic user description. */
67 
68  GYRO_HANDLE_END_PLUS_ONE /*!< \brief Maximum handle. */
69 };
70 /**@}*/
71 
72 /**************************************************************************************************
73  Macros
74 **************************************************************************************************/
75 
76 /** \name Values for Config Attributes
77  *
78  */
79 /**@{*/
80 #define GYRO_ATT_CONFIG_DISABLE 0x00u /*!< \brief Disable */
81 #define GYRO_ATT_CONFIG_ENABLE 0x01u /*!< \brief Enable */
82 /**@}*/
83 
84 /** \name Values for Period Attributes.
85  *
86  */
87 /**@{*/
88 #define GYRO_ATT_PERIOD_MAX 250u /*!< \brief Maximum period */
89 #define GYRO_ATT_PERIOD_DEFAULT 100u /*!< \brief Default period */
90 #define GYRO_ATT_PERIOD_MIN 10u /*!< \brief Minimum period */
91 /**@}*/
92 
93 /*! \brief Sizes of attributes. */
94 #define GYRO_SIZE_CONFIG_ATT 1u /*!< \brief Configuration attribute size */
95 #define GYRO_SIZE_PERIOD_ATT 1u /*!< \brief Period attribute size */
96 #define GYRO_SIZE_DATA_ATT 6u /*!< \brief Data attribute size */
97 #define GYRO_SIZE_TEMPDATA_ATT 2u /*!< \brief Temp data attribute size */
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 SvcGyroAddGroup(void);
112 
113 /*************************************************************************************************/
114 /*!
115  * \brief Remove the services from the attribute server.
116  *
117  * \return None.
118  */
119 /*************************************************************************************************/
120 void SvcGyroRemoveGroup(void);
121 
122 /*************************************************************************************************/
123 /*!
124  * \brief Register callbacks for the service.
125  *
126  * \param writeCback Write callback function.
127  *
128  * \return None.
129  */
130 /*************************************************************************************************/
131 void SvcGyroCbackRegister(attsWriteCback_t writeCback);
132 
133 /*! \} */ /* GYROSCOPE_SENSOR_SERVICE */
134 
135 #ifdef __cplusplus
136 }
137 #endif
138 
139 #endif /* SVC_GYRO_H */
Temporary data characteristic declaration.
Definition: svc_gyro.h:55
Data characteristic value.
Definition: svc_gyro.h:51
Period characteristic value.
Definition: svc_gyro.h:65
Temporary data characteristic value.
Definition: svc_gyro.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
Configuration characteristic delcaration.
Definition: svc_gyro.h:60
#define GYRO_HANDLE_START
Start handle.
Definition: svc_gyro.h:38
Maximum handle.
Definition: svc_gyro.h:68
void SvcGyroAddGroup(void)
Add the services to the attribute server.
Temporary data characteristic CCCD.
Definition: svc_gyro.h:57
Service declaration.
Definition: svc_gyro.h:48
void SvcGyroRemoveGroup(void)
Remove the services from the attribute server.
Data characteristic CCCD.
Definition: svc_gyro.h:52
Temporary data characteristic user description.
Definition: svc_gyro.h:58
Period characteristic user description.
Definition: svc_gyro.h:66
Data characteristic declaration.
Definition: svc_gyro.h:50
Data characteristic user description.
Definition: svc_gyro.h:53
Period characteristic declaration.
Definition: svc_gyro.h:64
void SvcGyroCbackRegister(attsWriteCback_t writeCback)
Register callbacks for the service.
Configuration characteristic value.
Definition: svc_gyro.h:61
Configuration characteristic user description.
Definition: svc_gyro.h:62