Cordio Stack and Cordio Profiles  r2p3-02rel0
svc_hid.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Human Interface Device 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_HID_H
21 #define SVC_HID_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /*! \addtogroup HUMAN_INTERFACE_DEVICE_SERVICE
28  * \{ */
29 
30 /**************************************************************************************************
31 Macros
32 **************************************************************************************************/
33 
34 /*! \brief HID Service */
35 #define HID_SVC_UUID ATT_UUID_HID_SERVICE
36 
37 /** \name HID Spec Version
38  *
39  */
40 /**@{*/
41 /*! \brief HID Spec Version: 1.11 */
42 #define HID_VERSION 0x0111
43 /**@}*/
44 
45 /** \name HID Report Types
46  *
47  */
48 /**@{*/
49 #define HID_REPORT_TYPE_INPUT 0x01 /*!< \brief Input type. */
50 #define HID_REPORT_TYPE_OUTPUT 0x02 /*!< \brief Output type. */
51 #define HID_REPORT_TYPE_FEATURE 0x03 /*!< \brief Feature type. */
52 /**@}*/
53 
54 /** \name HID Protocol Mode Types
55  *
56  */
57 /**@{*/
58 #define HID_PROTOCOL_MODE_BOOT 0x00 /*!< \brief Boot mode. */
59 #define HID_PROTOCOL_MODE_REPORT 0x01 /*!< \brief Report mode. */
60 /**@}*/
61 
62 /** \name HID Control Point Values
63  *
64  */
65 /**@{*/
66 #define HID_CONTROL_POINT_SUSPEND 0x00 /*!< \brief Suspend. */
67 #define HID_CONTROL_POINT_RESUME 0x01 /*!< \brief Resume. */
68 /**@}*/
69 
70 /*! \brief Max length of the report map value */
71 #define HID_MAX_REPORT_MAP_LEN 512
72 
73 /*! \brief Max length of an output report value */
74 #define HID_MAX_REPORT_LEN 32
75 
76 /*! \brief Initial length of the report map value */
77 #define HID_INIT_REPORT_MAP_LEN 1
78 
79 /**************************************************************************************************
80  Handle Ranges
81 **************************************************************************************************/
82 
83 /** \name HID Service Handles
84  *
85  */
86 /**@{*/
87 #define HID_START_HDL 0x100 /*!< \brief Start handle. */
88 #define HID_END_HDL (HID_MAX_HDL - 1) /*!< \brief End handle. */
89 
90 /**************************************************************************************************
91  Handles
92 **************************************************************************************************/
93 /*! \brief Proprietary Service Handles Common to HID Devices */
94 enum
95 {
96  HID_SVC_HDL = HID_START_HDL, /*!< \brief Proprietary Service Declaration */
97  HID_INFO_CH_HDL, /*!< \brief HID Information Characteristic Declaration */
98  HID_INFO_HDL, /*!< \brief HID Information Value */
99  HID_REPORT_MAP_CH_HDL, /*!< \brief HID Report Map Characteristic Declaration */
100  HID_REPORT_MAP_HDL, /*!< \brief HID Report Map Value */
101  HID_EXTERNAL_REPORT_HDL, /*!< \brief HID External Report Descriptor */
102  HID_CONTROL_POINT_CH_HDL, /*!< \brief HID Control Point Characteristic Declaration */
103  HID_CONTROL_POINT_HDL, /*!< \brief HID Control Point Value */
104  HID_KEYBOARD_BOOT_IN_CH_HDL, /*!< \brief HID Keyboard Boot Input Characteristic Declaration */
105  HID_KEYBOARD_BOOT_IN_HDL, /*!< \brief HID Keyboard Boot Input Value */
106  HID_KEYBOARD_BOOT_IN_CH_CCC_HDL, /*!< \brief HID Keyboard Boot Input CCC Descriptor */
107  HID_KEYBOARD_BOOT_OUT_CH_HDL, /*!< \brief HID Keyboard Boot Output Characteristic Declaration */
108  HID_KEYBOARD_BOOT_OUT_HDL, /*!< \brief HID Keyboard Boot Output Value */
109  HID_MOUSE_BOOT_IN_CH_HDL, /*!< \brief HID Mouse Boot Input Characteristic Declaration */
110  HID_MOUSE_BOOT_IN_HDL, /*!< \brief HID Mouse Boot Input Value */
111  HID_MOUSE_BOOT_IN_CH_CCC_HDL, /*!< \brief HID Mouse Boot Input CCC Descriptor */
112  HID_INPUT_REPORT_1_CH_HDL, /*!< \brief HID Input Report Characteristic Declaration */
113  HID_INPUT_REPORT_1_HDL, /*!< \brief HID Input Report Value */
114  HID_INPUT_REPORT_1_CH_CCC_HDL, /*!< \brief HID Input Report CCC Descriptor */
115  HID_INPUT_REPORT_1_REFERENCE_HDL, /*!< \brief HID Input Report Reference Descriptor */
116  HID_INPUT_REPORT_2_CH_HDL, /*!< \brief HID Input Report Characteristic Declaration */
117  HID_INPUT_REPORT_2_HDL, /*!< \brief HID Input Report Value */
118  HID_INPUT_REPORT_2_CH_CCC_HDL, /*!< \brief HID Input Report CCC Descriptor */
119  HID_INPUT_REPORT_2_REFERENCE_HDL, /*!< \brief HID Input Report Reference Descriptor */
120  HID_INPUT_REPORT_3_CH_HDL, /*!< \brief HID Input Report Characteristic Declaration */
121  HID_INPUT_REPORT_3_HDL, /*!< \brief HID Input Report Value */
122  HID_INPUT_REPORT_3_CH_CCC_HDL, /*!< \brief HID Input Report CCC Descriptor */
123  HID_INPUT_REPORT_3_REFERENCE_HDL, /*!< \brief HID Input Report Reference Descriptor */
124  HID_OUTPUT_REPORT_CH_HDL, /*!< \brief HID Output Report Characteristic Declaration */
125  HID_OUTPUT_REPORT_HDL, /*!< \brief HID Output Report Value */
126  HID_OUTPUT_REPORT_REFERENCE_HDL, /*!< \brief HID Output Report Reference Descriptor */
127  HID_FEATURE_REPORT_CH_HDL, /*!< \brief HID Feature Report Characteristic Declaration */
128  HID_FEATURE_REPORT_HDL, /*!< \brief HID Feature Report Value */
129  HID_FEATURE_REPORT_REFERENCE_HDL, /*!< \brief HID Feature Report Reference Descriptor */
130  HID_PROTOCOL_MODE_CH_HDL, /*!< \brief HID Protocol Mode Characteristic Declaration */
131  HID_PROTOCOL_MODE_HDL, /*!< \brief HID Protocol Mode Value */
132  HID_MAX_HDL /*!< \brief Maximum handle. */
133 };
134 /**@}*/
135 
136 /*************************************************************************************************/
137 /*!
138  * \brief Add the services to the attribute server.
139  *
140  * \return None.
141  */
142 /*************************************************************************************************/
143 void SvcHidAddGroup(void);
144 
145 /*************************************************************************************************/
146 /*!
147  * \brief Remove the services from the attribute server.
148  *
149  * \return None.
150  */
151 /*************************************************************************************************/
152 void SvcHidRemoveGroup(void);
153 
154 /*************************************************************************************************/
155 /*!
156  * \brief Register a read and write callback functions for the ATT Group.
157  *
158  * \param writeCb Write callback function
159  * \param readCb Read callback function
160  *
161  * \return None.
162  */
163 /*************************************************************************************************/
164 void SvcHidRegister(attsWriteCback_t writeCb, attsReadCback_t readCb);
165 
166 /*************************************************************************************************/
167 /*!
168  * \brief Add the Hid Service using the dynamic attribute subsystem.
169  *
170  * \return None.
171  */
172 /*************************************************************************************************/
173 void *SvcHidAddGroupDyn(void);
174 
175 /*! \} */ /* HUMAN_INTERFACE_DEVICE_SERVICE */
176 
177 #ifdef __cplusplus
178 }
179 #endif
180 
181 #endif /* SVC_HID_H */
182 
HID Mouse Boot Input Characteristic Declaration.
Definition: svc_hid.h:109
HID Feature Report Characteristic Declaration.
Definition: svc_hid.h:127
HID Output Report Value.
Definition: svc_hid.h:125
HID Mouse Boot Input Value.
Definition: svc_hid.h:110
Proprietary Service Declaration.
Definition: svc_hid.h:96
HID Input Report Value.
Definition: svc_hid.h:121
HID Output Report Characteristic Declaration.
Definition: svc_hid.h:124
HID Protocol Mode Value.
Definition: svc_hid.h:131
HID Report Map Value.
Definition: svc_hid.h:100
void * SvcHidAddGroupDyn(void)
Add the Hid Service using the dynamic attribute subsystem.
HID Report Map Characteristic Declaration.
Definition: svc_hid.h:99
HID Input Report Characteristic Declaration.
Definition: svc_hid.h:120
HID Output Report Reference Descriptor.
Definition: svc_hid.h:126
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
HID Keyboard Boot Output Value.
Definition: svc_hid.h:108
HID Control Point Value.
Definition: svc_hid.h:103
HID Mouse Boot Input CCC Descriptor.
Definition: svc_hid.h:111
HID Information Characteristic Declaration.
Definition: svc_hid.h:97
HID External Report Descriptor.
Definition: svc_hid.h:101
HID Input Report CCC Descriptor.
Definition: svc_hid.h:122
HID Keyboard Boot Input CCC Descriptor.
Definition: svc_hid.h:106
HID Feature Report Value.
Definition: svc_hid.h:128
HID Input Report Reference Descriptor.
Definition: svc_hid.h:119
HID Input Report Characteristic Declaration.
Definition: svc_hid.h:112
HID Feature Report Reference Descriptor.
Definition: svc_hid.h:129
Maximum handle.
Definition: svc_hid.h:132
HID Input Report CCC Descriptor.
Definition: svc_hid.h:118
HID Input Report Reference Descriptor.
Definition: svc_hid.h:115
void SvcHidRemoveGroup(void)
Remove the services from the attribute server.
HID Input Report Reference Descriptor.
Definition: svc_hid.h:123
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
HID Input Report Value.
Definition: svc_hid.h:117
HID Keyboard Boot Input Value.
Definition: svc_hid.h:105
HID Control Point Characteristic Declaration.
Definition: svc_hid.h:102
void SvcHidRegister(attsWriteCback_t writeCb, attsReadCback_t readCb)
Register a read and write callback functions for the ATT Group.
HID Protocol Mode Characteristic Declaration.
Definition: svc_hid.h:130
HID Information Value.
Definition: svc_hid.h:98
HID Keyboard Boot Input Characteristic Declaration.
Definition: svc_hid.h:104
HID Input Report Characteristic Declaration.
Definition: svc_hid.h:116
#define HID_START_HDL
Start handle.
Definition: svc_hid.h:87
HID Input Report CCC Descriptor.
Definition: svc_hid.h:114
HID Keyboard Boot Output Characteristic Declaration.
Definition: svc_hid.h:107
void SvcHidAddGroup(void)
Add the services to the attribute server.
HID Input Report Value.
Definition: svc_hid.h:113