antfs_host_interface.hpp 32 KB

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