Cordio Stack and Cordio Profiles  r2p3-02rel0
wdxc_api.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Wireless Data Exchange profile application interface.
6  *
7  * Copyright (c) 2017-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 WDXC_API_H
21 #define WDXC_API_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /*! \addtogroup WIRELESS_DATA_EXCHANGE_PROFILE
28  * \{ */
29 
30 /**************************************************************************************************
31  Macros
32 **************************************************************************************************/
33 
34 /*! \brief WDXC enumeration of handle indexes of characteristics to be discovered */
35 enum
36 {
37  WDXC_DC_HDL_IDX, /*!< \brief WDX Device Configuration */
38  WDXC_DC_CCC_HDL_IDX, /*!< \brief WDX Device Configuration CCC descriptor */
39  WDXC_FTC_HDL_IDX, /*!< \brief WDX File Transfer Control */
40  WDXC_FTC_CCC_HDL_IDX, /*!< \brief WDX File Transfer Control CCC descriptor */
41  WDXC_FTD_HDL_IDX, /*!< \brief WDX File Transfer Data */
42  WDXC_FTD_CCC_HDL_IDX, /*!< \brief WDX File Transfer Data CCC descriptor */
43  WDXC_AU_HDL_IDX, /*!< \brief WDX Authenticationa */
44  WDXC_AU_CCC_HDL_IDX, /*!< \brief WDX Authentication CCC descriptor */
45  WDXC_HDL_LIST_LEN /*!< \brief WDX handle list length. */
46 };
47 
48 /**************************************************************************************************
49  Data Types
50 **************************************************************************************************/
51 
52 
53 /**************************************************************************************************
54  Global Variables
55 **************************************************************************************************/
56 
57 /**************************************************************************************************
58  Callback Function Datatypes
59 **************************************************************************************************/
60 
61 /*************************************************************************************************/
62 /*!
63  * \brief WDXC File Transfer Data callback.
64  *
65  * \param connId Connection ID.
66  * \param handle Handle of the file.
67  * \param len length of pData in bytes.
68  * \param pData File data.
69  *
70  * \return None.
71  */
72 /*************************************************************************************************/
73 typedef void WdxcFtdCallback_t(dmConnId_t connId, uint16_t handle, uint16_t len, uint8_t *pData);
74 
75 /*************************************************************************************************/
76 /*!
77  * \brief WDXC File Transfer Control callback.
78  *
79  * \param connId Connection ID.
80  * \param handle Handle of the file.
81  * \param op Control operation.
82  * \param status Status of operation.
83  *
84  * \return None.
85  */
86 /*************************************************************************************************/
87 typedef void WdxcFtcCallback_t(dmConnId_t connId, uint16_t handle, uint8_t op, uint8_t status);
88 
89 /**************************************************************************************************
90  Function Declarations
91 **************************************************************************************************/
92 
93 /*************************************************************************************************/
94 /*!
95  * \brief Initialize the WDXC.
96  *
97  * \param pFtdCallback Application Callback for File Transfer Data.
98  * \param pFtcCallback Application Callback for File Transfer Control.
99  *
100  * \return None.
101  */
102 /*************************************************************************************************/
103 void WdxcInit(WdxcFtdCallback_t *pFtdCallback, WdxcFtcCallback_t *pFtcCallback);
104 
105 /*************************************************************************************************/
106 /*!
107  * \brief Called by application to notify the WDXC of DM and ATT Events.
108  *
109  * \param pEvt Pointer to the Event
110  *
111  * \return None.
112  */
113 /*************************************************************************************************/
114 void WdxcProcMsg(wsfMsgHdr_t *pEvt);
115 
116 /*************************************************************************************************/
117 /*!
118  * \brief Perform service and characteristic discovery for Wireless Data Exchange service.
119  * Parameter pHdlList must point to an array of length \ref WDXC_HDL_LIST_LEN.
120  * If discovery is successful the handles of discovered characteristics and
121  * descriptors will be set in pHdlList.
122  *
123  * \param connId Connection identifier.
124  * \param pHdlList Characteristic handle list.
125  *
126  * \return None.
127  */
128 /*************************************************************************************************/
129 void WdxcWdxsDiscover(dmConnId_t connId, uint16_t *pHdlList);
130 
131 /*************************************************************************************************/
132 /*!
133  * \brief Perform File Discovery
134  *
135  * \param connId Connection ID.
136  * \param pFileInfo Buffer to hold information about files
137  * \param maxFiles Size of pFileInfo in number of \ref wsfEfsFileInfo_t objects
138  *
139  * \note When file discovery completes, the ftcCallback() will be called with operator equal to
140  * \ref WDX_FTC_OP_EOF and file handle equal to \ref WDX_FLIST_HANDLE.
141  *
142  * \return None.
143  */
144 /*************************************************************************************************/
145 void WdxcDiscoverFiles(dmConnId_t connId, wsfEfsFileInfo_t *pFileInfo, uint8_t maxFiles);
146 
147 /*************************************************************************************************/
148 /*!
149  * \brief Send a request to start a stream of a given file handle on the given connection.
150  *
151  * \param connId Connection ID.
152  * \param fileHdl Handle of the file.
153  *
154  * \return none.
155  */
156 /*************************************************************************************************/
157 void WdxcStreamStart(dmConnId_t connId, uint16_t fileHdl);
158 
159 /*************************************************************************************************/
160 /*!
161  * \brief Stop the active stream.
162  *
163  * \param connId Connection ID.
164  *
165  * \return None.
166  */
167 /*************************************************************************************************/
168 void WdxcStreamStop(dmConnId_t connId);
169 
170 /*************************************************************************************************/
171 /*!
172  * \brief Send a request to abort a wdx operation.
173  *
174  * \param connId Connection ID.
175  * \param fileHdl Handle of file to abort operation on peer device
176  *
177  * \return None.
178  */
179 /*************************************************************************************************/
180 void WdxcFtcSendAbort(dmConnId_t connId, uint16_t fileHdl);
181 
182 /*************************************************************************************************/
183 /*!
184  * \brief Send a request to erase a file.
185  *
186  * \param connId Connection ID.
187  * \param fileHdl Handle of file to erase on peer device
188  *
189  * \return None.
190  */
191 /*************************************************************************************************/
192 void WdxcFtcSendEraseFile(dmConnId_t connId, uint16_t fileHdl);
193 
194 /*************************************************************************************************/
195 /*!
196  * \brief Send a request to verify a file.
197  *
198  * \param connId Connection ID.
199  * \param fileHdl Handle of file to verify on peer device
200  *
201  * \return None.
202  */
203 /*************************************************************************************************/
204 void WdxcFtcSendVerifyFile(dmConnId_t connId, uint16_t fileHdl);
205 
206 /*************************************************************************************************/
207 /*!
208  * \brief Send a request to put a block of data into a file on the peer device
209  *
210  * \param connId Connection ID.
211  * \param fileHdl Handle of file on peer device
212  * \param offset The offset from the beginning of the file in bytes
213  * \param len The number of bytes to put
214  * \param fileSize The size of the file in bytes
215  * \param type reserved
216  *
217  * \return None.
218  */
219 /*************************************************************************************************/
220 void WdxcFtcSendPutReq(dmConnId_t connId, uint16_t fileHdl, uint32_t offset,
221  uint32_t len, uint32_t fileSize, uint8_t type);
222 
223 /*************************************************************************************************/
224 /*!
225  * \brief Send a request to perform a get a block of data from a file on the peer device
226  *
227  * \param connId Connection ID.
228  * \param fileHdl Handle of file to verify on peer device
229  * \param offset The offset from the beginning of the file in bytes
230  * \param len The number of bytes to get
231  * \param type reserved
232  *
233  * \return None.
234  */
235 /*************************************************************************************************/
236 void WdxcFtcSendGetReq(dmConnId_t connId, uint16_t fileHdl, uint32_t offset, uint32_t len, uint8_t type);
237 
238 /*************************************************************************************************/
239 /*!
240  * \brief Send a data block to the peer device
241  *
242  * \param connId Connection ID.
243  * \param len Size of pData in bytes
244  * \param pData Data to put to the file
245  *
246  * \return None.
247  */
248 /*************************************************************************************************/
249 void WdxcFtdSendBlock(dmConnId_t connId, uint32_t len, uint8_t *pData);
250 
251 /*! \} */ /* WIRELESS_DATA_EXCHANGE_PROFILE */
252 
253 #ifdef __cplusplus
254 };
255 #endif
256 
257 #endif /* WDXC_MAIN_H */
void WdxcStreamStop(dmConnId_t connId)
Stop the active stream.
void WdxcFtcSendAbort(dmConnId_t connId, uint16_t fileHdl)
Send a request to abort a wdx operation.
void WdxcFtcSendVerifyFile(dmConnId_t connId, uint16_t fileHdl)
Send a request to verify a file.
void WdxcDiscoverFiles(dmConnId_t connId, wsfEfsFileInfo_t *pFileInfo, uint8_t maxFiles)
Perform File Discovery.
uint8_t dmConnId_t
Connection identifier.
Definition: dm_api.h:501
void WdxcFtdCallback_t(dmConnId_t connId, uint16_t handle, uint16_t len, uint8_t *pData)
WDXC File Transfer Data callback.
Definition: wdxc_api.h:73
void WdxcWdxsDiscover(dmConnId_t connId, uint16_t *pHdlList)
Perform service and characteristic discovery for Wireless Data Exchange service. Parameter pHdlList m...
WDX Device Configuration.
Definition: wdxc_api.h:37
void WdxcProcMsg(wsfMsgHdr_t *pEvt)
Called by application to notify the WDXC of DM and ATT Events.
File Listing Information.
Definition: wsf_efs.h:135
void WdxcFtcSendPutReq(dmConnId_t connId, uint16_t fileHdl, uint32_t offset, uint32_t len, uint32_t fileSize, uint8_t type)
Send a request to put a block of data into a file on the peer device.
WDX File Transfer Data CCC descriptor.
Definition: wdxc_api.h:42
void WdxcFtcSendGetReq(dmConnId_t connId, uint16_t fileHdl, uint32_t offset, uint32_t len, uint8_t type)
Send a request to perform a get a block of data from a file on the peer device.
WDX Device Configuration CCC descriptor.
Definition: wdxc_api.h:38
WDX Authentication CCC descriptor.
Definition: wdxc_api.h:44
unsigned long uint32_t
Unsigned 32-bit value.
Definition: wsf_types.h:71
void WdxcFtcSendEraseFile(dmConnId_t connId, uint16_t fileHdl)
Send a request to erase a file.
WDX File Transfer Control CCC descriptor.
Definition: wdxc_api.h:40
void WdxcInit(WdxcFtdCallback_t *pFtdCallback, WdxcFtcCallback_t *pFtcCallback)
Initialize the WDXC.
WDX File Transfer Data.
Definition: wdxc_api.h:41
WDX File Transfer Control.
Definition: wdxc_api.h:39
WDX handle list length.
Definition: wdxc_api.h:45
void WdxcFtcCallback_t(dmConnId_t connId, uint16_t handle, uint8_t op, uint8_t status)
WDXC File Transfer Control callback.
Definition: wdxc_api.h:87
WDX Authenticationa.
Definition: wdxc_api.h:43
unsigned short uint16_t
Unsigned 16-bit value.
Definition: wsf_types.h:67
void WdxcFtdSendBlock(dmConnId_t connId, uint32_t len, uint8_t *pData)
Send a data block to the peer device.
Common message structure passed to event handler.
Definition: wsf_os.h:97
unsigned char uint8_t
Unsigned 8-bit value.
Definition: wsf_types.h:63
void WdxcStreamStart(dmConnId_t connId, uint16_t fileHdl)
Send a request to start a stream of a given file handle on the given connection.