Cordio Stack and Cordio Profiles  r2p3-02rel0
svc_batt.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Example Battery service implementation.
6  *
7  * Copyright (c) 2011-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_BATT_H
21 #define SVC_BATT_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /*! \addtogroup BATTERY_SERVICE
28  * \{ */
29 
30 /**************************************************************************************************
31  Handle Ranges
32 **************************************************************************************************/
33 
34 /** \name Battery Service Handles
35  *
36  */
37 /**@{*/
38 #define BATT_START_HDL 0x60 /*!< \brief Service start handle. */
39 #define BATT_END_HDL (BATT_MAX_HDL - 1) /*!< \brief Service end handle. */
40 
41 /**************************************************************************************************
42  Handles
43 **************************************************************************************************/
44 
45 /*! \brief Battery Service Handles */
46 enum
47 {
48  BATT_SVC_HDL = BATT_START_HDL, /*!< \brief Battery service declaration */
49  BATT_LVL_CH_HDL, /*!< \brief Battery level characteristic */
50  BATT_LVL_HDL, /*!< \brief Battery level */
51  BATT_LVL_CH_CCC_HDL, /*!< \brief Battery level CCCD */
52  BATT_MAX_HDL /*!< \brief Maximum handle. */
53 };
54 /**@}*/
55 
56 /**************************************************************************************************
57  Function Declarations
58 **************************************************************************************************/
59 
60 /*************************************************************************************************/
61 /*!
62  * \brief Add the services to the attribute server.
63  *
64  * \return None.
65  */
66 /*************************************************************************************************/
67 void SvcBattAddGroup(void);
68 
69 /*************************************************************************************************/
70 /*!
71  * \brief Remove the services from the attribute server.
72  *
73  * \return None.
74  */
75 /*************************************************************************************************/
76 void SvcBattRemoveGroup(void);
77 
78 /*************************************************************************************************/
79 /*!
80  * \brief Register callbacks for the service.
81  *
82  * \param readCback Read callback function.
83  * \param writeCback Write callback function.
84  *
85  * \return None.
86  */
87 /*************************************************************************************************/
88 void SvcBattCbackRegister(attsReadCback_t readCback, attsWriteCback_t writeCback);
89 
90 /*************************************************************************************************/
91 /*!
92  * \brief Add the battery service using the dynamic attribute subsystem.
93  *
94  * \return None.
95  */
96 /*************************************************************************************************/
97 void *SvcBattAddGroupDyn(void);
98 
99 /*! \} */ /* BATTERY_SERVICE */
100 
101 #ifdef __cplusplus
102 };
103 #endif
104 
105 #endif /* SVC_BATT_H */
106 
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
Battery level characteristic.
Definition: svc_batt.h:49
Battery service declaration.
Definition: svc_batt.h:48
Battery level.
Definition: svc_batt.h:50
void SvcBattAddGroup(void)
Add the services to the attribute server.
#define BATT_START_HDL
Service start handle.
Definition: svc_batt.h:38
void * SvcBattAddGroupDyn(void)
Add the battery service using the dynamic attribute subsystem.
void SvcBattRemoveGroup(void)
Remove the services from the attribute server.
Battery level CCCD.
Definition: svc_batt.h:51
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
void SvcBattCbackRegister(attsReadCback_t readCback, attsWriteCback_t writeCback)
Register callbacks for the service.
Maximum handle.
Definition: svc_batt.h:52