antfs_host_interface.hpp 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. /*
  2. This software is subject to the license described in the License.txt file
  3. included with this software distribution. You may not use this file except in compliance
  4. with this license.
  5. Copyright (c) Dynastream Innovations Inc. 2013
  6. All rights reserved.
  7. */
  8. #if !defined(ANTFS_HOST_INTERFACE_H)
  9. #define ANTFS_HOST_INTERFACE_H
  10. #include "types.h"
  11. #include "dsi_thread.h"
  12. #include "antfs_interface.h"
  13. //////////////////////////////////////////////////////////////////////////////////
  14. // Public Definitions
  15. //////////////////////////////////////////////////////////////////////////////////
  16. #define ANTFS_STATUS1_RESERVED7_BIT ((UCHAR) 0x80)
  17. #define ANTFS_STATUS1_DATA_AVAILABLE_BIT ((UCHAR) 0x20)
  18. #define ANTFS_STATUS1_UPLOAD_ENABLED_BIT ((UCHAR) 0x10)
  19. #define ANTFS_STATUS1_PAIRING_ENABLED_BIT ((UCHAR) 0x08)
  20. #define ANTFS_STATUS1_BEACON2_BIT ((UCHAR) 0x04)
  21. #define ANTFS_STATUS1_BEACON1_BIT ((UCHAR) 0x02)
  22. #define ANTFS_STATUS1_BEACON0_BIT ((UCHAR) 0x01)
  23. #define ANTFS_STATUS2_RESERVED7_BIT ((UCHAR) 0x80)
  24. #define ANTFS_STATUS2_RESERVED6_BIT ((UCHAR) 0x40)
  25. #define ANTFS_STATUS2_RESERVED5_BIT ((UCHAR) 0x20)
  26. #define ANTFS_STATUS2_RESERVED4_BIT ((UCHAR) 0x10)
  27. #define ANTFS_STATUS2_CLIENT_STATE3_BIT ((UCHAR) 0x08)
  28. #define ANTFS_STATUS2_CLIENT_STATE2_BIT ((UCHAR) 0x04)
  29. #define ANTFS_STATUS2_CLIENT_STATE1_BIT ((UCHAR) 0x02)
  30. #define ANTFS_STATUS2_CLIENT_STATE0_BIT ((UCHAR) 0x01)
  31. #define ANTFS_STATUS1_DEFAULT_SEARCH_MASK ((UCHAR) 0x38)
  32. #define ANTFS_STATUS2_DEFAULT_SEARCH_MASK ((UCHAR) 0x00)
  33. // ANT-FS Host Responses
  34. typedef enum
  35. {
  36. ANTFS_HOST_RESPONSE_NONE = 0,
  37. ANTFS_HOST_RESPONSE_INIT_PASS,
  38. ANTFS_HOST_RESPONSE_SERIAL_FAIL,
  39. ANTFS_HOST_RESPONSE_REQUEST_SESSION_FAIL,
  40. ANTFS_HOST_RESPONSE_CONNECT_PASS,
  41. ANTFS_HOST_RESPONSE_DISCONNECT_PASS,
  42. ANTFS_HOST_RESPONSE_CONNECTION_LOST,
  43. ANTFS_HOST_RESPONSE_AUTHENTICATE_NA,
  44. ANTFS_HOST_RESPONSE_AUTHENTICATE_PASS,
  45. ANTFS_HOST_RESPONSE_AUTHENTICATE_REJECT,
  46. ANTFS_HOST_RESPONSE_AUTHENTICATE_FAIL,
  47. ANTFS_HOST_RESPONSE_DOWNLOAD_PASS,
  48. ANTFS_HOST_RESPONSE_DOWNLOAD_REJECT,
  49. ANTFS_HOST_RESPONSE_DOWNLOAD_INVALID_INDEX,
  50. ANTFS_HOST_RESPONSE_DOWNLOAD_FILE_NOT_READABLE,
  51. ANTFS_HOST_RESPONSE_DOWNLOAD_NOT_READY,
  52. ANTFS_HOST_RESPONSE_DOWNLOAD_FAIL,
  53. ANTFS_HOST_RESPONSE_UPLOAD_PASS,
  54. ANTFS_HOST_RESPONSE_UPLOAD_REJECT,
  55. ANTFS_HOST_RESPONSE_UPLOAD_INVALID_INDEX,
  56. ANTFS_HOST_RESPONSE_UPLOAD_FILE_NOT_WRITEABLE,
  57. ANTFS_HOST_RESPONSE_UPLOAD_INSUFFICIENT_SPACE,
  58. ANTFS_HOST_RESPONSE_UPLOAD_FAIL,
  59. ANTFS_HOST_RESPONSE_ERASE_PASS,
  60. ANTFS_HOST_RESPONSE_ERASE_FAIL,
  61. ANTFS_HOST_RESPONSE_MANUAL_TRANSFER_PASS,
  62. ANTFS_HOST_RESPONSE_MANUAL_TRANSFER_TRANSMIT_FAIL,
  63. ANTFS_HOST_RESPONSE_MANUAL_TRANSFER_RESPONSE_FAIL,
  64. ANTFS_HOST_RESPONSE_CANCEL_DONE
  65. } ANTFS_HOST_RESPONSE;
  66. // ANT-FS Host States
  67. typedef enum
  68. {
  69. ANTFS_HOST_STATE_OFF = 0, // Object created, but not initialized
  70. ANTFS_HOST_STATE_IDLE, // Object initialized
  71. ANTFS_HOST_STATE_DISCONNECTING,
  72. ANTFS_HOST_STATE_REQUESTING_SESSION,
  73. ANTFS_HOST_STATE_SEARCHING, // LINK
  74. ANTFS_HOST_STATE_CONNECTED, // AUTH
  75. ANTFS_HOST_STATE_AUTHENTICATING,
  76. ANTFS_HOST_STATE_TRANSPORT,
  77. ANTFS_HOST_STATE_DOWNLOADING,
  78. ANTFS_HOST_STATE_UPLOADING,
  79. ANTFS_HOST_STATE_ERASING,
  80. ANTFS_HOST_STATE_SENDING,
  81. ANTFS_HOST_STATE_RECEIVING
  82. } ANTFS_HOST_STATE;
  83. typedef struct
  84. {
  85. ULONG ulDeviceID;
  86. USHORT usManufacturerID;
  87. USHORT usDeviceType;
  88. UCHAR ucAuthenticationType;
  89. UCHAR ucStatusByte1;
  90. UCHAR ucStatusByte2;
  91. } ANTFS_DEVICE_PARAMETERS;
  92. //////////////////////////////////////////////////////////////////////////////////
  93. // Public Function Prototypes
  94. //////////////////////////////////////////////////////////////////////////////////
  95. // TODO: Is this class used for anything? Do we need it?
  96. class ANTFSHostInterface
  97. {
  98. public:
  99. virtual ~ANTFSHostInterface(){}
  100. virtual void Close(void) = 0;
  101. /////////////////////////////////////////////////////////////////
  102. // Stops any pending actions, closes all resources and cleans
  103. // up any dynamic memory being used by the library.
  104. /////////////////////////////////////////////////////////////////
  105. virtual ANTFS_HOST_STATE GetStatus(void) = 0;
  106. /////////////////////////////////////////////////////////////////
  107. // Returns the current library status.
  108. /////////////////////////////////////////////////////////////////
  109. virtual ANTFS_HOST_RESPONSE WaitForResponse(ULONG ulMilliseconds_) = 0;
  110. /////////////////////////////////////////////////////////////////
  111. // Wait for a response from the ANTFSHost object.
  112. // Parameters:
  113. // ulMilliseconds_: Set this value to the minimum time to
  114. // wait before returning. If the value is
  115. // 0, the function will return immediately.
  116. // If the value is DSI_THREAD_INFINITE, the
  117. // function will not time out.
  118. // If one or more responses are pending before the timeout
  119. // expires the function will return the first response that
  120. // occured. If no response is pending at the time the timeout
  121. // expires, ANTFS_HOST_RESPONSE_NONE is returned.
  122. /////////////////////////////////////////////////////////////////
  123. virtual void Cancel(void) = 0;
  124. /////////////////////////////////////////////////////////////////
  125. // Cancels any pending actions and returns the library to the
  126. // appropriate ANTFS layer if possible. ie if the library was
  127. // executing a download command in the transport layer, the
  128. // library would be returned to ANTFS_HOST_STATE_TRANSPORT after
  129. // execution of this function.
  130. // A response of ANTFS_HOST_RESPONSE_CANCEL_DONE will be sent
  131. // back to the application when the cancel operation is
  132. // complete.
  133. /////////////////////////////////////////////////////////////////
  134. virtual USHORT AddSearchDevice(ANTFS_DEVICE_PARAMETERS *pstDeviceSearchMask_, ANTFS_DEVICE_PARAMETERS *pstDeviceParameters_) = 0;
  135. /////////////////////////////////////////////////////////////////
  136. // Adds a set of parameters for which to search to the internal
  137. // search device list.
  138. // Parameters:
  139. // *pstDeviceSearchMask_: A pointer to an
  140. // ANTFS_DEVICE_PARAMETERS structure. Set a
  141. // member to zero (0) to wildcard search for
  142. // it. Otherwise, set the bits that you want
  143. // to be matched to 1 in each member. Members
  144. // that are integer values will be treated the
  145. // same as bit fields for the purposes for the mask.
  146. // *pstDeviceParameters_: A pointer to an
  147. // ANTFS_DEVICE_PARAMETERS structure. Set
  148. // the member to the desired search value.
  149. // A member in this structure is ignored if
  150. // the associated member in the
  151. // *pstDeviceSearchMask_ parameter is set
  152. // to zero (0) for wildcard.
  153. // Returns a handle the the search device entry. If the return
  154. // value is NULL, the function failed adding the device entry.
  155. // This means that the device list is already full.
  156. // Operation:
  157. // Note that the default search masks should normally be applied
  158. // to the ucStatusByte1 and ucStatusByte2 members of the
  159. // *pstDeviceSearchMask_ parameter. Eg;
  160. // pstMyDeviceSearchMask->ucStatusByte1 =
  161. // ANTFS_STATUS1_DEFAULT_SEARCH_MASK & ucMyStatus1Criteria;
  162. // Setting bits outside the masks, especially reserved bits, may
  163. // lead to undesired behaviour.
  164. /////////////////////////////////////////////////////////////////
  165. virtual void RemoveSearchDevice(USHORT usHandle_) = 0;
  166. /////////////////////////////////////////////////////////////////
  167. // Removes a device entry from the internal search list.
  168. // Parameters:
  169. // usHandle_: Handle to the device entry to be removed
  170. // from the list.
  171. /////////////////////////////////////////////////////////////////
  172. virtual void ClearSearchDeviceList(void) = 0;
  173. /////////////////////////////////////////////////////////////////
  174. // Clears the internal search device list.
  175. /////////////////////////////////////////////////////////////////
  176. virtual ANTFS_RETURN SearchForDevice(UCHAR ucSearchRadioFrequency_ = ANTFS_RF_FREQ, UCHAR ucConnectRadioFrequency_ = ANTFS_DEFAULT_TRANSPORT_FREQ, USHORT usRadioChannelID_ = 0, BOOL bUseRequestPage_ = FALSE) = 0;
  177. /////////////////////////////////////////////////////////////////
  178. // Begins a search for ANTFS remote devices.
  179. // Parameters:
  180. // ucSearchRadioFrequency_: This specifies the frequency on
  181. // which to search for devices. This
  182. // frequency is calculated as
  183. // (ucSearchRadioFrequency_ * 1 MHz +
  184. // 2400 MHz). MAX_UCHAR (0xFF) is reserved.
  185. // ucConnectRadioFrequency_: This specifies the frequency
  186. // on which the connection communication
  187. // will occur. This frequency is calculated
  188. // as (ucConnectRadioFrequency_ * 1 MHz +
  189. // 2400 MHz). If ucConnectRadioFrequency_
  190. // is set to ANTFS_AUTO_FREQUENCY_SELECTION
  191. // (0xFF), then the library will use an
  192. // adaptive frequency-hopping scheme.
  193. // usRadioChannelID_: This specifies the channel ID for the
  194. // the ANT channel search. Set to zero to
  195. // wildcard.
  196. // bUseRequestPage_: Specifies whether the search will include
  197. // ANT-FS broadcast devices, using a request
  198. // page to begin an ANT-FS session
  199. // Returns ANTFS_RETURN_PASS if successful. Otherwise, it returns
  200. // ANTFS_RETURN_FAIL if the library is in the wrong state, or
  201. // ANTFS_RETURN_BUSY if the library is busy with another request.
  202. // Operation:
  203. // Once this function is called successfully, the application
  204. // must wait for the response from the ANTFSHost object.
  205. // Possible responses are:
  206. // ANTFS_HOST_RESPONSE_CONNECT_PASS
  207. // ANTFS__HOST_RESPONSE_SERIAL_FAIL
  208. // The library will continue to search for devices until a device
  209. // is found, the Cancel() function is called, an error occurs, or
  210. // the library is closed.
  211. /////////////////////////////////////////////////////////////////
  212. virtual BOOL GetFoundDeviceParameters(ANTFS_DEVICE_PARAMETERS *pstDeviceParameters_, UCHAR *aucFriendlyName_, UCHAR *pucBufferSize_) = 0;
  213. /////////////////////////////////////////////////////////////////
  214. // Copies the parameters of the most recently found device to the
  215. // supplied parameter.
  216. // Parameters:
  217. // *ptsDeviceParameters_: A pointer to a structure that will
  218. // receive a copy of the device parameters.
  219. // *aucFriendlyName_: A pointer to a buffer where the remote
  220. // device friendly name will be copied.
  221. // *pucBufferSize_: Pointer to a UCHAR variable that should contain the
  222. // maximum size of the buffer pointed to by aucFriendlyName_.
  223. // After the function returns, the UCHAR variable
  224. // will be set to reflect the size of friendly name string
  225. // that has been copied to aucFriendlyName_.
  226. // Returns TRUE if successful. Otherwise, it returns FALSE.
  227. /////////////////////////////////////////////////////////////////
  228. virtual BOOL GetUploadStatus(ULONG *pulByteProgress_, ULONG *pulTotalLength_) = 0;
  229. /////////////////////////////////////////////////////////////////
  230. // Gets the transfer progress of a pending or a complete
  231. // upload.
  232. // Parameters:
  233. // *pulByteProgress_: Pointer to a ULONG that will receive
  234. // the current byte progress of a pending or
  235. // complete upload.
  236. // *pulTotalLength_: Pointer to a ULONG that will receive the
  237. // total length of the file being uploaded.
  238. // Returns TRUE if successful. Otherwise, it returns FALSE.
  239. // Operation:
  240. // A data upload occurs when information is requested to be sent to
  241. // a remote device. This function may be called at any point
  242. // during an upload as a progress indicator. After the upload
  243. // is complete, this information is valid until another request
  244. // for a data transfer is made.
  245. /////////////////////////////////////////////////////////////////
  246. virtual BOOL GetDownloadStatus(ULONG *pulByteProgress_, ULONG *pulTotalLength_) = 0;
  247. /////////////////////////////////////////////////////////////////
  248. // Gets the transfer progress of a pending or a complete
  249. // download.
  250. // Parameters:
  251. // *pulByteProgress_: Pointer to a ULONG that will receive
  252. // the current byte progress of a pending or
  253. // complete download.
  254. // *pulTotalLength_: Pointer to a ULONG that will receive the
  255. // total expected length of the download.
  256. // Returns TRUE if successful. Otherwise, it returns FALSE.
  257. // Operation:
  258. // A data download occurs when information is requested from a
  259. // remote device. This function may be called at any point
  260. // during a download as a progress indicator. After the transfer
  261. // is complete, this information is valid until another request
  262. // for a data transfer is made.
  263. /////////////////////////////////////////////////////////////////
  264. virtual BOOL GetTransferData(ULONG *pulDataSize_ , void *pvData_ = NULL) = 0;
  265. /////////////////////////////////////////////////////////////////
  266. // Gets the received data from a transfer (download/manual transfer).
  267. //
  268. // Parameters:
  269. // *ulDataSize_ : Pointer to a ULONG that will receive
  270. // the size of the data available in bytes.
  271. // *pvData_ : Pointer to a buffer where the received data
  272. // will be copied. NULL can be passed to this
  273. // parameter so that the size can be retried
  274. // without copying any data. The application
  275. // can then call this function again to after it
  276. // has allocated a buffer of sufficient size to
  277. // handle the data.
  278. // Returns TRUE if successful. Otherwise, it returns FALSE.
  279. /////////////////////////////////////////////////////////////////
  280. virtual ANTFS_RETURN Authenticate(UCHAR ucAuthenticationType_, UCHAR *pucAuthenticationString_, UCHAR ucLength_, UCHAR *aucResponseBuffer_, UCHAR *pucResponseBufferSize_, ULONG ulResponseTimeout_) = 0;
  281. /////////////////////////////////////////////////////////////////
  282. // Request to pair with the connected remote device.
  283. // Parameters:
  284. // ucAuthenticationType_: The type of authentication to
  285. // execute on the remote device.
  286. // *pucAuthenticationString_: A string that may be used in
  287. // conjunction with the particular
  288. // authentication type in use (e.g. a
  289. // password or a friendly name.
  290. // ucLength_: The length of the authentication string,
  291. // including any '\n' terminator. This
  292. // parameter may be set to zero if an
  293. // authentication string is not required.
  294. // *pucResponseBuffer_: Pointer to the buffer where additional
  295. // data from the response will be saved. This will
  296. // include data such as passwords and friendly names.
  297. // This memory must be allocated by the application.
  298. // *pucResponseBufferSize_: Pointer to UCHAR varible that contains the
  299. // size of the buffer pointed to by pucResponseBuffer_.
  300. // After the response has be recived, the UCHAR variable
  301. // will be set to reflect the size of the new data received
  302. // in pucResponseBuffer_.
  303. // ulResponseTimeout_: Number of miliseconds to wait for a response after
  304. // the authenticate command is sent.
  305. // Returns ANTFS_RETURN_PASS if successful. Otherwise, it returns
  306. // ANTFS_RETURN_FAIL if the library is in the wrong state, or
  307. // ANTFS_RETURN_BUSY if the library is busy with another request.
  308. // Operation:
  309. // Once the request is posted, the application must wait for the
  310. // response from the ANTFSHost object. Possible responses are:
  311. // ANTFS_HOST_RESPONSE_AUTHENTICATE_NA
  312. // ANTFS_HOST_RESPONSE_AUTHENTICATE_PASS
  313. // ANTFS_HOST_RESPONSE_AUTHENTICATE_REJECT
  314. // ANTFS_HOST_RESPONSE_AUTHENTICATE_FAIL
  315. // ANTFS_HOST_RESPONSE_CONNECTION_LOST
  316. // ANTFS_HOST_RESPONSE_SERIAL_FAIL
  317. // Upon receiving the ANTFS_HOST_RESPONSE_AUTHENTICATE_PASS, an
  318. // authentication string provided by the remoted device may be
  319. // available in the response buffer. This depends on the
  320. // authentication type used. The transport
  321. // layer connection is also only established after receiving
  322. // ANTFS_HOST_RESPONSE_AUTHENTICATE_PASS .
  323. /////////////////////////////////////////////////////////////////
  324. virtual ANTFS_RETURN Disconnect(USHORT usBlackoutTime_, UCHAR ucDisconnectType_ = 0, UCHAR ucTimeDuration_ = 0, UCHAR ucAppSpecificDuration_ = 0) = 0;
  325. /////////////////////////////////////////////////////////////////
  326. // Disconnect from a remote device. Optionally put that device
  327. // on a blackout list for a period of time. The application can
  328. // also request the remote device to become undiscoverable for a
  329. // specified time/application specific duration.
  330. // Parameters:
  331. // usBlackoutTime_: The number of seconds the device ID
  332. // should remain on the blackout list. If
  333. // set to zero (0), then the device will
  334. // not be put on the blackout list. If set
  335. // to MAX_USHORT (0xFFFF), the device will
  336. // remain on the blackout list until
  337. // explicitly removed, or until the blackout
  338. // list is reset.
  339. // ucDisconnectType_: Specifies whether the client should
  340. // return to LINK state or broadcast mode
  341. // (ANT-FS broadcast)
  342. // ucTimeDuration_: Time, in 30 seconds increments, the client
  343. // device will remain undiscoverable after
  344. // disconnect has been requested. Set to 0 to
  345. // disable.
  346. // ucAppSpecificDuration_: Application specific duration the client
  347. // shall remain undiscoverable after disconnection.
  348. // This field is left to the developer, or defined
  349. // in an ANT+ Device Profile. Set to 0 to disable.
  350. // Returns ANTFS_RETURN_PASS if successful. Otherwise, it returns
  351. // ANTFS_RETURN_FAIL if the library is in the wrong state, or
  352. // ANTFS_RETURN_BUSY if the library is busy with another request.
  353. // Operation:
  354. // Once the request is posted, the application must wait for the
  355. // response from the ANTFSHost object. Possible responses are:
  356. // ANTFS_HOST_RESPONSE_DISCONNECT_PASS
  357. // ANTFS_HOST_RESPONSE_CONNECTION_LOST
  358. // ANTFS_HOST_RESPONSE_SERIAL_FAIL
  359. // The remote device will not show up in any search results for
  360. // the duration specified in usBlackoutTime_. This allows the
  361. // host to more easily find other devices in crowded
  362. // environments. The host can also request the remote device to
  363. // become undiscoverable, to more easily find other devices, however
  364. // not all client devices might implement this feature. Not all
  365. // client devices support a broadcast mode.
  366. /////////////////////////////////////////////////////////////////
  367. virtual BOOL Blackout(ULONG ulDeviceID_, USHORT usManufacturerID_, USHORT usDeviceType_, USHORT usBlackoutTime_) = 0;
  368. /////////////////////////////////////////////////////////////////
  369. // Put the device on a blackout list for a period of time.
  370. // Parameters:
  371. // ulDeviceID_: The device ID of a specific device.
  372. // usManufacturerID_: The specific manufacturer ID.
  373. // usDeviceType_: The specific device type.
  374. // usBlackoutTime_: The number of seconds the device ID
  375. // should remain on the blackout list. If
  376. // set to zero (0), then the device will
  377. // not be put on the blackout list. If set
  378. // to MAX_USHORT (0xFFFF), the device will
  379. // remain on the blackout list until
  380. // explicitly removed, or until the blackout
  381. // list is reset.
  382. // Returns TRUE if successful. Otherwise, it returns FALSE.
  383. // A wildcard parameter (0) is not allowed in any of the device
  384. // ID parameters and will result in returning FALSE.
  385. // Operation:
  386. // The remote device will not show up in any search results for
  387. // the duration specified in usBlackoutTime_. This allows the
  388. // host to more easily find other devices in crowded
  389. // environments.
  390. /////////////////////////////////////////////////////////////////
  391. virtual BOOL RemoveBlackout(ULONG ulDeviceID_, USHORT usManufacturerID_, USHORT usDeviceType_) = 0;
  392. /////////////////////////////////////////////////////////////////
  393. // Remove the device from the blackout list.
  394. // Parameters:
  395. // ulDeviceID_: The device ID of a specific device.
  396. // usManufacturerID_: The specific manufacturer ID.
  397. // usDeviceType_: The specific device type.
  398. // Returns TRUE if successful. Returns FALSE if the device is
  399. // not found in the blackout list. A wildcard parameter (0) is
  400. // not allowed in any of the device ID parameters and will result
  401. // in returning FALSE.
  402. /////////////////////////////////////////////////////////////////
  403. virtual void ClearBlackoutList(void) = 0;
  404. /////////////////////////////////////////////////////////////////
  405. // Clears the blackout list.
  406. /////////////////////////////////////////////////////////////////
  407. virtual ANTFS_RETURN Download(USHORT usFileIndex_, ULONG ulDataOffset_, ULONG ulMaxDataLength_, ULONG ulMaxBlockSize_ = 0) = 0;
  408. /////////////////////////////////////////////////////////////////
  409. // Request a download of a file from the authenticated device.
  410. // Parameters:
  411. // usFileIndex_: The file number to be downloaded. Some
  412. // file numbers are reserved for special
  413. // purposes, such as the device directory
  414. // (0). Consult the ANT_FS specification
  415. // and any docs for specific device types.
  416. // ulDataOffset_: The byte offset from where to begin
  417. // transferring the data.
  418. // ulMaxDataLength_: ULONG varible that contains the maximum
  419. // number of bytes to download. Set to 0 if
  420. // if the host does not wish to limit the
  421. // size of the download.
  422. // ulMaxBlockSize_: Maximum number of bytes that the host
  423. // wishes to download in a single block.
  424. // Set to zero to disable.
  425. // Returns ANTFS_RETURN_PASS if successful. Otherwise, it returns
  426. // ANTFS_RETURN_FAIL if the library is in the wrong state, or
  427. // ANTFS_RETURN_BUSY if the library is busy with another request.
  428. // Operation:
  429. // Once the request is posted, the application must wait for the
  430. // response from the ANTFSHost object. Possible responses are:
  431. // ANTFS_HOST_RESPONSE_DOWNLOAD_PASS
  432. // ANTFS_HOST_RESPONSE_DOWNLOAD_REJECT
  433. // ANTFS_HOST_RESPONSE_DOWNLOAD_FAIL
  434. // ANTFS_HOST_RESPONSE_CONNECTION_LOST
  435. // ANTFS_HOST_RESPONSE_SERIAL_FAIL
  436. // Upon receiving ANTFS_HOST_RESPONSE_DOWNLOAD_PASS the downloaed data
  437. // will be available in the transfer buffer. See GetTransferData().
  438. /////////////////////////////////////////////////////////////////
  439. virtual ANTFS_RETURN Upload(USHORT usFileIndex_, ULONG ulDataOffset_, ULONG ulDataLength_, void *pvData_, BOOL bForceOffset_ = TRUE, ULONG ulMaxBlockSize_ = 0) = 0;
  440. /////////////////////////////////////////////////////////////////
  441. // Request an upload of a file to the authenticated device.
  442. // Parameters:
  443. // usFileIndex_: The file number to be uploaded. Some
  444. // file numbers are reserved for special
  445. // purposes, such as the device directory
  446. // (0). Consult the ANT_FS specification
  447. // and any docs for specific device types.
  448. // ulDataOffset_: The byte offset from where to begin
  449. // transferring the data.
  450. // ulDataLength_: The byte length of data to be uploaded
  451. // to the remote device.
  452. // Return value:
  453. // *pvData_: Pointer to the location where the data
  454. // to be uploaded is stored.
  455. // bForceOffset_: Set to TRUE (default) to enforce the
  456. // provided byte data offset. Set to FALSE
  457. // to continue a transfer, indicating that
  458. // the host will continue the upload at the
  459. // last data offset specified by the client
  460. // in the Upload Response.
  461. // ulMaxBlockSize_: Maximum block size that the host can send
  462. // in a single block of data. Set to zero
  463. // to disable
  464. // Returns ANTFS_RETURN_PASS if successful. Otherwise, it returns
  465. // ANTFS_RETURN_FAIL if the library is in the wrong state, or
  466. // ANTFS_RETURN_BUSY if the library is busy with another request.
  467. // Operation:
  468. // Once the request is posted, the application must wait for the
  469. // response from the ANTFSHost object. Possible responses are:
  470. // ANTFS_HOST_RESPONSE_UPLOAD_PASS
  471. // ANTFS_HOST_RESPONSE_UPLOAD_REJECT
  472. // ANTFS_HOST_RESPONSE_UPLOAD_FAIL
  473. // ANTFS_HOST_RESPONSE_CONNECTION_LOST
  474. // ANTFS_HOST_RESPONSE_SERIAL_FAIL
  475. /////////////////////////////////////////////////////////////////
  476. virtual ANTFS_RETURN ManualTransfer(USHORT usFileIndex_, ULONG ulDataOffset_, ULONG ulDataLength_, void *pvData_) = 0;
  477. /////////////////////////////////////////////////////////////////
  478. // Send data directly to the device without requesting first.
  479. // This is especially useful for communicating small pieces of
  480. // data to the device. Another use is the implementation of a
  481. // higher-level communication protocol. Care must be taken to
  482. // ensure the device can handle the amount of data being sent
  483. // using this method.
  484. // usFileIndex_: The file number to be uploaded. Some
  485. // file numbers are reserved for special
  486. // purposes, such as the device directory
  487. // (0). Consult the ANT_FS specification
  488. // and any docs for specific device types.
  489. // ulDataOffset_: The byte offset from where to begin
  490. // transferring the data. Note that this
  491. // value will always get rounded up to the
  492. // next higher multiple of 8. Under normal
  493. // use, this parameter should always be set
  494. // to zero, and the only time it would be
  495. // non-zero is for retrying ManualTransfer()
  496. // from a known offset.
  497. // ulDataLength_: The byte length of data to be sent to
  498. // the remote device.
  499. // *pvData_: The Pointer to a buffer where the
  500. // data to be sent is stored.
  501. // Returns ANTFS_RETURN_PASS if successful. Otherwise, it returns
  502. // ANTFS_RETURN_FAIL if the library is in the wrong state, or
  503. // ANTFS_RETURN_BUSY if the library is busy with another request.
  504. // Operation:
  505. // Once the request is posted, the application must wait for the
  506. // response from the ANTFSHost object. Possible responses are:
  507. // ANTFS_HOST_RESPONSE_MANUAL_TRANSFER_PASS
  508. // ANTFS_HOST_RESPONSE_MANUAL_TRANSFER_TRANSMIT_FAIL
  509. // ANTFS_HOST_RESPONSE_MANUAL_TRANSFER_RESPONSE_FAIL
  510. // ANTFS_HOST_RESPONSE_CONNECTION_LOST
  511. // ANTFS_HOST_RESPONSE_SERIAL_FAIL
  512. // Upon receiving ANTFS_HOST_RESPONSE_MANUAL_TRANSFER_PASS the downloaed data
  513. // will be available in the transfer buffer. See GetTransferData().
  514. /////////////////////////////////////////////////////////////////
  515. virtual ANTFS_RETURN EraseData(USHORT usFileIndex_) = 0;
  516. /////////////////////////////////////////////////////////////////
  517. // Request the erasure of a file on the authenticated remote
  518. // device.
  519. // Parameters:
  520. // usFileIndex_: The file number of the file to be erased.
  521. // Returns ANTFS_RETURN_PASS if successful. Otherwise, it returns
  522. // ANTFS_RETURN_FAIL if the library is in the wrong state, or
  523. // ANTFS_RETURN_BUSY if the library is busy with another request.
  524. // Operation:
  525. // Once the request is posted, the application must wait for the
  526. // response from the ANTFSHost object. Possible responses are:
  527. // ANTFS_HOST_RESPONSE_ERASE_PASS
  528. // ANTFS_HOST_RESPONSE_ERASE_FAIL
  529. // ANTFS_HOST_RESPONSE_CONNECTION_LOST
  530. // ANTFS_HOST_RESPONSE_SERIAL_FAIL
  531. /////////////////////////////////////////////////////////////////
  532. virtual BOOL EnablePing(BOOL bEnable_) = 0;
  533. /////////////////////////////////////////////////////////////////
  534. // Enables ping message to be sent to the remote device periodically.
  535. // This can be used to keep the remote device from timing out during
  536. // operations that wait for user input (i.e. pairing).
  537. // Parameters:
  538. // bEnable_: Periodic ping enable.
  539. // Returns TRUE if successful. Otherwise, it returns FALSE.
  540. /////////////////////////////////////////////////////////////////
  541. };
  542. #endif // !defined(ANTFS_HOST_INTERFACE_H)