Cordio Stack and Cordio Profiles  r2p3-02rel0
svc_cscs.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Example Cycling Speed and Cadence Service Server implementation.
6  *
7  * Copyright (c) 2016-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_CSCS_H
21 #define SVC_CSCS_H
22 
23 #include "att_api.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 /*! \addtogroup CYCLING_SPEED_AND_CADENCE_SERVICE
30  * \{ */
31 
32 /**************************************************************************************************
33 Constants
34 **************************************************************************************************/
35 
36 /** \name CSC Feature Bits
37  * Cycle Speed and Cadence Feature Bits of the Feature Characteristic.
38  */
39 /**@{*/
40 
41 #define CSCS_WRDS_FEATURE_BIT (1<<0) /*!< \brief Wheel Revolution Data Supported Feature Mask Bit */
42 #define CSCS_CRDS_FEATURE_BIT (1<<1) /*!< \brief Crank Revolution Data Supported Feature Mask Bit */
43 #define CSCS_MSLS_FEATURE_BIT (1<<2) /*!< \brief Multiple Sensor Locations Supporte Feature Mask Bit */
44 
45 /*! \brief TODO: Set to all supported features */
46 #define CSCS_ALL_FEATURES (0x3) /*!< \brief All Supported Feature Mask */
47 /**@}*/
48 
49 /**************************************************************************************************
50  Handle Ranges
51 **************************************************************************************************/
52 
53 /** \name Cycling Speed and Cadence Service Handles
54  *
55  */
56 /**@{*/
57 #define CSCS_START_HDL 0x0450 /*!< \brief Start handle. */
58 #define CSCS_END_HDL (CSCS_MAX_HDL - 1) /*!< \brief End handle. */
59 
60 /**************************************************************************************************
61  Handles
62 **************************************************************************************************/
63 
64 /*! \brief Cycling Speed Service Handles */
65 enum
66 {
67  CSCS_SVC_HDL = CSCS_START_HDL, /*!< \brief Cycling Speed Server Service declaration */
68  CSCS_CSF_CH_HDL, /*!< \brief Cycling Speed Feature characteristic */
69  CSCS_CSF_HDL, /*!< \brief Cycling Speed Feature */
70  CSCS_CSM_CH_HDL, /*!< \brief Cycling Speed Measurement characteristic */
71  CSCS_CSM_HDL, /*!< \brief Cycling Speed Measurement */
72  CSCS_CSM_CH_CCC_HDL, /*!< \brief Cycling Speed Measurement Client Characteristic Configuration Descriptor */
73  CSCS_SL_CH_HDL, /*!< \brief Cycling Speed Sensor Location characteristic */
74  CSCS_SL_HDL, /*!< \brief Cycling Speed Sensor Location */
75  CSCS_MAX_HDL /*!< \brief Maximum handle. */
76 };
77 /**@}*/
78 
79 /**************************************************************************************************
80  Function Declarations
81 **************************************************************************************************/
82 
83 /*************************************************************************************************/
84 /*!
85  * \brief Add the services to the attribute server.
86  *
87  * \return None.
88  */
89 /*************************************************************************************************/
90 void SvcCscsAddGroup(void);
91 
92 /*************************************************************************************************/
93 /*!
94  * \brief Remove the services from the attribute server.
95  *
96  * \return None.
97  */
98 /*************************************************************************************************/
99 void SvcCscsRemoveGroup(void);
100 
101 /*************************************************************************************************/
102 /*!
103  * \brief Register callbacks for the service.
104  *
105  * \param readCback Read callback function.
106  * \param writeCback Write callback function.
107  *
108  * \return None.
109  */
110 /*************************************************************************************************/
111 void SvcCscsCbackRegister(attsReadCback_t readCback, attsWriteCback_t writeCback);
112 
113 /*! \} */ /* CYCLING_SPEED_AND_CADENCE_SERVICE */
114 
115 #ifdef __cplusplus
116 };
117 #endif
118 
119 #endif /* SVC_CSCS_H */
Cycling Speed Feature.
Definition: svc_cscs.h:69
Maximum handle.
Definition: svc_cscs.h:75
Cycling Speed Sensor Location characteristic.
Definition: svc_cscs.h:73
Cycling Speed Server Service declaration.
Definition: svc_cscs.h:67
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
Cycling Speed Measurement characteristic.
Definition: svc_cscs.h:70
#define CSCS_START_HDL
Start handle.
Definition: svc_cscs.h:57
Cycling Speed Feature characteristic.
Definition: svc_cscs.h:68
void SvcCscsAddGroup(void)
Add the services to the attribute server.
void SvcCscsCbackRegister(attsReadCback_t readCback, attsWriteCback_t writeCback)
Register callbacks for the service.
Cycling Speed Measurement Client Characteristic Configuration Descriptor.
Definition: svc_cscs.h:72
Cycling Speed Measurement.
Definition: svc_cscs.h:71
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
Cycling Speed Sensor Location.
Definition: svc_cscs.h:74
void SvcCscsRemoveGroup(void)
Remove the services from the attribute server.
Attribute protocol client and server API.