Cordio Stack and Cordio Profiles  r2p3-02rel0
wdx_defs.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Wireless Data Exchange Protocol Definitions.
6  *
7  * Copyright (c) 2013-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 WDX_DEFS_H
21 #define WDX_DEFS_H
22 
23 #ifdef __cplusplus
24 extern "C"
25 {
26 #endif
27 
28 /*! \addtogroup WIRELESS_DATA_EXCHANGE_PROFILE
29  * \{ */
30 
31 /**************************************************************************************************
32  Macros
33 **************************************************************************************************/
34 
35 /*! \brief Base UUID: 005fXXXX-2ff2-4ed5-b045-4C7463617865 */
36 #define WDX_UUID_PART1 0x65, 0x78, 0x61, 0x63, 0x74, 0x4c, 0x45, 0xb0, \
37  0xd5, 0x4e, 0xf2, 0x2f
38 /*! \brief Base UUID Part 2 */
39 #define WDX_UUID_PART2 0x5f, 0x00
40 
41 /*! \brief Macro for building UUIDs */
42 #define WDX_UUID_BUILD(part) WDX_UUID_PART1, UINT16_TO_BYTES(part), WDX_UUID_PART2
43 
44 /*! \brief WDX Service */
45 #define WDX_SVC_UUID 0xFEF6
46 
47 /*! \brief WDX Device Configuration Characteristic */
48 #define WDX_DC_UUID WDX_UUID_BUILD(0x0002)
49 
50 /*! \brief WDX File Transfer Control Characteristic */
51 #define WDX_FTC_UUID WDX_UUID_BUILD(0x0003)
52 
53 /*! \brief WDX File Transfer Data Characteristic */
54 #define WDX_FTD_UUID WDX_UUID_BUILD(0x0004)
55 
56 /*! \brief WDX Authentication Characteristic */
57 #define WDX_AU_UUID WDX_UUID_BUILD(0x0005)
58 
59 
60 /**************************************************************************************************
61  Constant Definitions
62 **************************************************************************************************/
63 
64 /** \name WDXS File List Configuration
65  *
66  */
67 /**@{*/
68 #define WDX_FLIST_HANDLE 0 /*!< \brief File List handle */
69 #define WDX_FLIST_FORMAT_VER 1 /*!< \brief File List version */
70 #define WDX_FLIST_HDR_SIZE 7 /*!< \brief File List header length */
71 #define WDX_FLIST_RECORD_SIZE 40 /*!< \brief File List record length */
72 /*! \brief File list max length. */
73 #define WDX_FLIST_MAX_LEN (WDX_FLIST_HDR_SIZE + (WDX_FLIST_RECORD_SIZE * (WSF_EFS_MAX_FILES-1)))
74 /**@}*/
75 
76 /*! \brief Device configuration characteristic message header length */
77 #define WDX_DC_HDR_LEN 2
78 
79 /** \name Device Configuration Characteristic oOperations
80  *
81  */
82 /**@{*/
83 #define WDX_DC_OP_GET 0x01 /*!< \brief Get a parameter value */
84 #define WDX_DC_OP_SET 0x02 /*!< \brief Set a parameter value */
85 #define WDX_DC_OP_UPDATE 0x03 /*!< \brief Send an update of a parameter value */
86 /**@}*/
87 
88 /** \name Device Control Characteristic Parameter IDs
89  *
90  */
91 /**@{*/
92 #define WDX_DC_ID_CONN_UPDATE_REQ 0x01 /*!< \brief Connection Parameter Update Request */
93 #define WDX_DC_ID_CONN_PARAM 0x02 /*!< \brief Current Connection Parameters */
94 #define WDX_DC_ID_DISCONNECT_REQ 0x03 /*!< \brief Disconnect Request */
95 #define WDX_DC_ID_CONN_SEC_LEVEL 0x04 /*!< \brief Connection Security Level */
96 #define WDX_DC_ID_SECURITY_REQ 0x05 /*!< \brief Security Request */
97 #define WDX_DC_ID_SERVICE_CHANGED 0x06 /*!< \brief Service Changed */
98 #define WDX_DC_ID_DELETE_BONDS 0x07 /*!< \brief Delete Bonds */
99 #define WDX_DC_ID_ATT_MTU 0x08 /*!< \brief Current ATT MTU */
100 #define WDX_DC_ID_PHY_UPDATE_REQ 0x09 /*!< \brief PHY update request */
101 #define WDX_DC_ID_PHY 0x0A /*!< \brief Current PHY */
102 #define WDX_DC_ID_BATTERY_LEVEL 0x20 /*!< \brief Battery level */
103 #define WDX_DC_ID_MODEL_NUMBER 0x21 /*!< \brief Device Model */
104 #define WDX_DC_ID_FIRMWARE_REV 0x22 /*!< \brief Device Firmware Revision */
105 #define WDX_DC_ID_ENTER_DIAGNOSTICS 0x23 /*!< \brief Enter Diagnostic Mode */
106 #define WDX_DC_ID_DIAGNOSTICS_COMPLETE 0x24 /*!< \brief Diagnostic Complete */
107 #define WDX_DC_ID_DISCONNECT_AND_RESET 0x25 /*!< \brief Disconnect and Reset */
108 /**@}*/
109 
110 /** \name Device Control Parameter Lengths
111  *
112  */
113 /**@{*/
114 #define WDX_DC_LEN_DATA_FORMAT 1 /*!< \brief Data format */
115 #define WDX_DC_LEN_SEC_LEVEL 1 /*!< \brief Security Level */
116 #define WDX_DC_LEN_ATT_MTU 2 /*!< \brief ATT MTU */
117 #define WDX_DC_LEN_BATTERY_LEVEL 1 /*!< \brief Battery level */
118 #define WDX_DC_LEN_CONN_PARAM_REQ 8 /*!< \brief Connection parameter request */
119 #define WDX_DC_LEN_CONN_PARAM 7 /*!< \brief Current connection parameters */
120 #define WDX_DC_LEN_PHY_UPDATE_REQ 5 /*!< \brief PHY update request */
121 #define WDX_DC_LEN_PHY 3 /*!< \brief Current PHY */
122 #define WDX_DC_LEN_DIAG_COMPLETE 0 /*!< \brief Diagnostic complete */
123 #define WDX_DC_LEN_DEVICE_MODEL 18 /*!< \brief Device Model */
124 #define WDX_DC_LEN_FIRMWARE_REV 16 /*!< \brief Firmware Revision */
125 /**@}*/
126 
127 /** \name File Transfer Control Characteristic Message Header Length
128  *
129  */
130 /**@{*/
131 #define WDX_FTC_HDR_LEN 1 /*!< \brief Header length. */
132 #define WDX_FTC_HANDLE_LEN 2 /*!< \brief Handle length. */
133 
134 /** \name File Transfer Control Characteristic Operations
135  *
136  */
137 /**@{*/
138 #define WDX_FTC_OP_NONE 0x00 /*!< \brief No operation */
139 #define WDX_FTC_OP_GET_REQ 0x01 /*!< \brief Get a file from the server */
140 #define WDX_FTC_OP_GET_RSP 0x02 /*!< \brief File get response */
141 #define WDX_FTC_OP_PUT_REQ 0x03 /*!< \brief Put a file to the server */
142 #define WDX_FTC_OP_PUT_RSP 0x04 /*!< \brief File put response */
143 #define WDX_FTC_OP_ERASE_REQ 0x05 /*!< \brief Erase a file on the server */
144 #define WDX_FTC_OP_ERASE_RSP 0x06 /*!< \brief File erase response */
145 #define WDX_FTC_OP_VERIFY_REQ 0x07 /*!< \brief Verify a file (e.g. check its CRC) */
146 #define WDX_FTC_OP_VERIFY_RSP 0x08 /*!< \brief File verify response */
147 #define WDX_FTC_OP_ABORT 0x09 /*!< \brief Abort a get, put, or list operation in progress */
148 #define WDX_FTC_OP_EOF 0x0a /*!< \brief End of file reached */
149 /**@}*/
150 
151 /** \name File Transfer Control Permissions
152  *
153  */
154 /**@{*/
155 #define WDX_FTC_GET_PERMITTED 0x01 /*!< \brief File Get Permitted */
156 #define WDX_FTC_PUT_PERMITTED 0x02 /*!< \brief File Put Permitted */
157 #define WDX_FTC_ERASE_PERMITTED 0x04 /*!< \brief File Erase Permitted */
158 #define WDX_FTC_VERIFY_PERMITTED 0x08 /*!< \brief File Verify Permitted */
159 /**@}*/
160 
161 /** \name File Transfer Control Characteristic Status
162  *
163  */
164 /**@{*/
165 #define WDX_FTC_ST_SUCCESS 0 /*!< \brief Success */
166 #define WDX_FTC_ST_INVALID_OP_FILE 1 /*!< \brief Invalid operation for this file */
167 #define WDX_FTC_ST_INVALID_HANDLE 2 /*!< \brief Invalid file handle */
168 #define WDX_FTC_ST_INVALID_OP_DATA 3 /*!< \brief Invalid operation data */
169 #define WDX_FTC_ST_IN_PROGRESS 4 /*!< \brief Operation in progress */
170 #define WDX_FTC_ST_VERIFICATION 5 /*!< \brief Verification failure */
171 /**@}*/
172 
173 /** \name File Transfer Control Transport
174  *
175  */
176 /**@{*/
177 #define WDX_FTC_TRANSPORT_TYPE 0 /*!< \brief Transport Type */
178 #define WDX_FTC_TRANSPORT_ID 0x0030 /*!< \brief Transport ID */
179 /**@}*/
180 
181 /*! \brief File transfer data characteristic message header length */
182 #define WDX_FTD_HDR_LEN 0
183 
184 /*! \brief Authentication message header length */
185 #define WDX_AU_HDR_LEN 1
186 
187 /** \name Authentication Characteristic Operations
188  *
189  */
190 /**@{*/
191 #define WDX_AU_OP_START 0x01 /*!< \brief Authentication start */
192 #define WDX_AU_OP_CHALLENGE 0x02 /*!< \brief Authentication challenge */
193 #define WDX_AU_OP_REPLY 0x03 /*!< \brief Authentication reply */
194 /**@}*/
195 
196 /** \name Proprietary ATT Error Codes
197  *
198  */
199 /**@{*/
200 #define WDX_APP_AUTH_REQUIRED 0x80 /*!< \brief Application authentication required */
201 #define WDX_AU_ST_INVALID_MESSAGE 0x81 /*!< \brief Authentication invalid message */
202 #define WDX_AU_ST_INVALID_STATE 0x82 /*!< \brief Authentication invalid state */
203 #define WDX_AU_ST_AUTH_FAILED 0x83 /*!< \brief Authentication failed */
204 /**@}*/
205 
206 /** \name Authentication Characteristic Authentication Level
207  *
208  */
209 /**@{*/
210 #define WDX_AU_LVL_NONE 0x00 /*!< \brief None */
211 #define WDX_AU_LVL_USER 0x01 /*!< \brief User level */
212 #define WDX_AU_LVL_MAINT 0x02 /*!< \brief Maintenance level */
213 #define WDX_AU_LVL_DEBUG 0x03 /*!< \brief Debug level */
214 /**@}*/
215 
216 /** \name Authenttication Characteristic Message Parameter Lengths
217  *
218  */
219 /**@{*/
220 #define WDX_AU_MSG_HDR_LEN 1 /*!< \brief Message header length */
221 #define WDX_AU_PARAM_LEN_START 2 /*!< \brief Authentication start */
222 #define WDX_AU_PARAM_LEN_CHALLENGE 16 /*!< \brief Authentication challenge */
223 #define WDX_AU_PARAM_LEN_REPLY 8 /*!< \brief Authentication reply */
224 /**@}*/
225 
226 /** \name Authenttication Characteristic Random Number and Key Lengths
227  *
228  */
229 /**@{*/
230 #define WDX_AU_RAND_LEN 16 /*!< \brief Authentication Random challenge length (bytes)*/
231 #define WDX_AU_KEY_LEN 16 /*!< \brief Authentication Key length (bytes) */
232 #define WDX_AU_HASH_LEN 8 /*!< \brief Authentication Hash length (bytes) */
233 /**@}*/
234 
235 /** \name WDXS Media Types
236  *
237  */
238 /**@{*/
239 #define WDX_FLASH_MEDIA 0 /*!< \brief Flash media type. */
240 #define WDX_OTA_MEDIA 1 /*!< \brief OTA media type. */
241 #define WDX_RAM_MEDIA 2 /*!< \brief RAM media type. */
242 #define WDX_STREAM_MEDIA 3 /*!< \brief Stream media type. */
243 /**@}*/
244 
245 /** \name WDXS File Transfer Control Command Message Lengths
246  *
247  */
248 /**@{*/
249 #define WDX_FTC_ABORT_LEN 3 /*!< \brief Abort message length. */
250 #define WDX_FTC_ERASE_LEN 3 /*!< \brief Erase message length. */
251 #define WDX_FTC_VERIFY_LEN 3 /*!< \brief Verify message length. */
252 #define WDX_FTC_PUT_LEN 16 /*!< \brief Put message length. */
253 #define WDX_FTC_GET_LEN 12 /*!< \brief Get message length. */
254 /**@}*/
255 
256 /*! \} */ /* WIRELESS_DATA_EXCHANGE_PROFILE */
257 
258 #ifdef __cplusplus
259 }
260 #endif
261 
262 #endif /* WDX_DEFS_H */