Cordio Stack and Cordio Profiles  r2p3-02rel0
svc_cps.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Example Cycling Power 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_CPS_H
21 #define SVC_CPS_H
22 
23 #include "att_api.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 /*! \addtogroup CYCLING_POWER_SERVICE
30  * \{ */
31 
32 /**************************************************************************************************
33 Constants
34 **************************************************************************************************/
35 
36 /** \name Cycling Power Feature Bits
37  * Cycle Power Feature Bits of the Feature Characteristic.
38  */
39 /**@{*/
40 #define CPP_PPBS_FEATURE_BIT (1<<0) /*!< \brief Pedal Power Balance Supported Feature Mask Bit */
41 #define CPP_ATS_FEATURE_BIT (1<<1) /*!< \brief Accumulated Torque Supported Feature Mask Bit */
42 #define CPP_WRDS_FEATURE_BIT (1<<2) /*!< \brief Wheel Revolution Data Supported Feature Mask Bit */
43 #define CPP_CRDS_FEATURE_BIT (1<<3) /*!< \brief Crank Revolution Data Supported Feature Mask Bit */
44 #define CPP_EMS_FEATURE_BIT (1<<4) /*!< \brief Extreme Magnitudes Supported Feature Mask Bit */
45 #define CPP_EAS_FEATURE_BIT (1<<5) /*!< \brief Extreme Angles Supported Feature Mask Bit */
46 #define CPP_TABDSAS_FEATURE_BIT (1<<6) /*!< \brief Top and Bottom Dead Spot Angles Supported Feature Mask Bit */
47 #define CPP_AES_FEATURE_BIT (1<<7) /*!< \brief Accumulated Energy Supported Feature Mask Bit */
48 #define CPP_OCIS_FEATURE_BIT (1<<8) /*!< \brief Offset Compensation Indicator Supported Feature Mask Bit */
49 #define CPP_OCS_FEATURE_BIT (1<<9) /*!< \brief Offset Compensation Supported Feature Mask Bit */
50 #define CPP_CPMCCM_FEATURE_BIT (1<<10) /*!< \brief Cycling Power Measurement Characteristic Content Masking Supported Offset Compensation Supported Feature Mask Bit */
51 #define CPP_MSLS_FEATURE_BIT (1<<11) /*!< \brief Multiple Sensor Locations Supported Feature Mask Bit */
52 #define CPP_CLAS_FEATURE_BIT (1<<12) /*!< \brief Crank Length Adjustment Supported Feature Mask Bit */
53 #define CPP_CHLAS_FEATURE_BIT (1<<13) /*!< \brief Chain Length Adjustment Supported Feature Mask Bit */
54 #define CPP_CHWAS_FEATURE_BIT (1<<14) /*!< \brief Chain Weight Adjustment Supported Feature Mask Bit */
55 #define CPP_SLAS_FEATURE_BIT (1<<15) /*!< \brief Span Length Adjustment Supported Feature Mask Bit */
56 #define CPP_SMC_FEATURE_BIT (1<<16) /*!< \brief Sensor Measurement Contex (0: FORCE, 1: TORQUE) */
57 #define CPP_IMDS_FEATURE_BIT (1<<17) /*!< \brief Instantaneous Measurement Direction Supported */
58 #define CPP_FCDS_FEATURE_BIT (1<<18) /*!< \brief Factory Calibration Date Supported Feature Mask Bit */
59 #define CPP_EOCS_FEATURE_BIT (1<<19) /*!< \brief Enhanced Offset Compensation Supported Feature Mask Bit */
60 #define CPP_DSS_FEATURE_BIT (1<<20) /*!< \brief Distribute System Support Feature Mask Bit */
61 
62 /*! \brief TODO: Set to all supported features */
63 #define CPP_ALL_FEATURES (0xff) /*!< \brief All Supported Feature Mask */
64 /**@}*/
65 
66 /**************************************************************************************************
67  Handle Ranges
68 **************************************************************************************************/
69 
70 /** \name Cycling Power Service Handles
71  *
72  */
73 /**@{*/
74 #define CPS_START_HDL 0x0400 /*!< \brief Start handle. */
75 #define CPS_END_HDL (CPS_MAX_HDL - 1) /*!< \brief End handle. */
76 
77 /**************************************************************************************************
78  Handles
79 **************************************************************************************************/
80 
81 /*! \brief Cycling Power Service Handles */
82 enum
83 {
84  CPS_SVC_HDL = CPS_START_HDL, /*!< \brief Cycling Power Server Service declaration */
85  CPS_CPF_CH_HDL, /*!< \brief Cycling Power Feature characteristic */
86  CPS_CPF_HDL, /*!< \brief Cycling Power Feature */
87  CPS_CPM_CH_HDL, /*!< \brief Cycling Power Measurement characteristic */
88  CPS_CPM_HDL, /*!< \brief Cycling Power Measurement */
89  CPS_CPM_CH_CCC_HDL, /*!< \brief Cycling Power Measurement Client Characteristic Configuration Descriptor */
90  CPS_CPSL_CH_HDL, /*!< \brief Cycling Power Sensor Location characteristic */
91  CPS_CPSL_HDL, /*!< \brief Cycling Power Sensor Location */
92  CPS_MAX_HDL /*!< \brief Maximum handle. */
93 };
94 /**@}*/
95 
96 /**************************************************************************************************
97  Function Declarations
98 **************************************************************************************************/
99 
100 /*************************************************************************************************/
101 /*!
102  * \brief Add the services to the attribute server.
103  *
104  * \return None.
105  */
106 /*************************************************************************************************/
107 void SvcCpsAddGroup(void);
108 
109 /*************************************************************************************************/
110 /*!
111  * \brief Remove the services from the attribute server.
112  *
113  * \return None.
114  */
115 /*************************************************************************************************/
116 void SvcCpsRemoveGroup(void);
117 
118 /*************************************************************************************************/
119 /*!
120  * \brief Register callbacks for the service.
121  *
122  * \param readCback Read callback function.
123  * \param writeCback Write callback function.
124  *
125  * \return None.
126  */
127 /*************************************************************************************************/
128 void SvcCpsCbackRegister(attsReadCback_t readCback, attsWriteCback_t writeCback);
129 
130 /*! \} */ /* CYCLING_POWER_SERVICE */
131 
132 #ifdef __cplusplus
133 };
134 #endif
135 
136 #endif /* SVC_CPS_H */
Cycling Power Feature.
Definition: svc_cps.h:86
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
#define CPS_START_HDL
Start handle.
Definition: svc_cps.h:74
Maximum handle.
Definition: svc_cps.h:92
void SvcCpsCbackRegister(attsReadCback_t readCback, attsWriteCback_t writeCback)
Register callbacks for the service.
Cycling Power Feature characteristic.
Definition: svc_cps.h:85
void SvcCpsRemoveGroup(void)
Remove the services from the attribute server.
Cycling Power Sensor Location.
Definition: svc_cps.h:91
Cycling Power Sensor Location characteristic.
Definition: svc_cps.h:90
Cycling Power Server Service declaration.
Definition: svc_cps.h:84
void SvcCpsAddGroup(void)
Add the services to the attribute server.
Cycling Power Measurement characteristic.
Definition: svc_cps.h:87
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
Attribute protocol client and server API.
Cycling Power Measurement Client Characteristic Configuration Descriptor.
Definition: svc_cps.h:89
Cycling Power Measurement.
Definition: svc_cps.h:88