antfs_host_channel.hpp 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982
  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_CHANNEL_HPP)
  9. #define ANTFS_HOST_CHANNEL
  10. #include "types.h"
  11. #include "dsi_thread.h"
  12. #include "dsi_timer.hpp"
  13. #include "dsi_framer_ant.hpp"
  14. #include "dsi_debug.hpp"
  15. #include "dsi_response_queue.hpp"
  16. #include "dsi_ant_message_processor.hpp"
  17. #include "antfsmessage.h"
  18. #include "antfs_host_interface.hpp"
  19. //////////////////////////////////////////////////////////////////////////////////
  20. // Public Definitions
  21. //////////////////////////////////////////////////////////////////////////////////
  22. #define DIRECT_TRANSFER_SIZE ((MAX_USHORT + 1) * 8)
  23. #define MAX_IGNORE_LIST_SIZE 2048
  24. UCHAR const aucTransportFrequencyList[16] = {3 ,7 ,15,20,25,29,34,40,45,49,54,60,65,70,75,80};
  25. #define TRANSPORT_FREQUENCY_LIST_SIZE ((UCHAR)sizeof(aucTransportFrequencyList))
  26. #define SEARCH_DEVICE_LIST_MAX_SIZE 512
  27. typedef struct
  28. {
  29. USHORT usHandle;
  30. ANTFS_DEVICE_PARAMETERS sDeviceParameters;
  31. ANTFS_DEVICE_PARAMETERS sDeviceSearchMask;
  32. } DEVICE_PARAMETERS_ITEM;
  33. typedef struct
  34. {
  35. USHORT usID;
  36. USHORT usManufacturerID;
  37. USHORT usDeviceType;
  38. USHORT usTimeout;
  39. } IGNORE_LIST_ITEM;
  40. /////////////////////////////////////////////////////////////////
  41. // This class implements the ANT-FS Host specification.
  42. // It is intended to be used together with another class that manages
  43. // the connection to an ANT USB stick (e.g. DSIANTDevice or
  44. // .NET ANT_Device).
  45. /////////////////////////////////////////////////////////////////
  46. class ANTFSHostChannel : public ANTFSHostInterface, public DSIANTMessageProcessor
  47. {
  48. private:
  49. //////////////////////////////////////////////////////////////////////////////////
  50. // Private Definitions
  51. //////////////////////////////////////////////////////////////////////////////////
  52. enum ENUM_ANTFS_REQUEST
  53. {
  54. ANTFS_REQUEST_NONE = 0,
  55. ANTFS_REQUEST_INIT, // Init()
  56. ANTFS_REQUEST_SESSION_REQ, // RequestSession()
  57. ANTFS_REQUEST_SEARCH, // SearchForDevice()
  58. ANTFS_REQUEST_ID, // Request ID
  59. ANTFS_REQUEST_PING, // Ping
  60. ANTFS_REQUEST_PAIR, // Pair
  61. ANTFS_REQUEST_PROCEED, // ProceedToTransport
  62. ANTFS_REQUEST_AUTHENTICATE, // Authenticate()
  63. ANTFS_REQUEST_CONNECT, // Connect
  64. ANTFS_REQUEST_DISCONNECT, // Disconnect()
  65. ANTFS_REQUEST_CHANGE_LINK, // ChangeTransportChannelParameters()
  66. ANTFS_REQUEST_DOWNLOAD, // Download()
  67. ANTFS_REQUEST_UPLOAD, // Upload()
  68. ANTFS_REQUEST_MANUAL_TRANSFER, // ManualTransfer()
  69. ANTFS_REQUEST_ERASE, // EraseData()
  70. ANTFS_REQUEST_CONNECTION_LOST, // Internal, keep these at the end of the list order is important
  71. ANTFS_REQUEST_HANDLE_SERIAL_ERROR, // Internal
  72. ANTFS_REQUEST_SERIAL_ERROR_HANDLED // Internal
  73. };
  74. enum RETURN_STATUS
  75. {
  76. RETURN_FAIL = 0,
  77. RETURN_PASS,
  78. RETURN_STOP,
  79. RETURN_REJECT,
  80. RETURN_NA,
  81. RETURN_SERIAL_ERROR
  82. };
  83. //////////////////////////////////////////////////////////////////////////////////
  84. // Private Variables
  85. //////////////////////////////////////////////////////////////////////////////////
  86. DSIResponseQueue<ANTFS_HOST_RESPONSE> clResponseQueue;
  87. volatile BOOL bIgnoreListRunning;
  88. volatile BOOL bForceFullInit;
  89. BOOL bInitFailed;
  90. BOOL bPingEnabled;
  91. BOOL bForceUploadOffset;
  92. BOOL bRequestPageEnabled;
  93. UCHAR aucResponseBuf[MESG_MAX_SIZE_VALUE];
  94. UCHAR aucRxBuf[MESG_MAX_SIZE_VALUE];
  95. UCHAR aucTxBuf[MESG_MAX_SIZE_VALUE];
  96. UCHAR aucRemoteFriendlyName[FRIENDLY_NAME_MAX_LENGTH];
  97. UCHAR ucRemoteFriendlyNameLength;
  98. UCHAR ucAuthType;
  99. UCHAR aucTxPassword[TX_PASSWORD_MAX_LENGTH];
  100. volatile UCHAR ucTxPasswordLength;
  101. volatile UCHAR ucPasswordLength;
  102. UCHAR *pucUploadData;
  103. UCHAR *pucResponseBuffer;
  104. UCHAR *pucResponseBufferSize;
  105. ULONG ulAuthResponseTimeout;
  106. ULONG ulHostSerialNumber;
  107. ULONG ulFoundBeaconHostID;
  108. UCHAR ucChannelStatus;
  109. UCHAR ucRejectCode;
  110. UCHAR ucDisconnectType;
  111. UCHAR ucUndiscoverableTimeDuration;
  112. UCHAR ucUndiscoverableAppSpecificDuration;
  113. ANTFS_DEVICE_PARAMETERS stFoundDeviceParameters;
  114. volatile USHORT usFoundBeaconPeriod;
  115. volatile USHORT usFoundANTFSDeviceID;
  116. volatile USHORT usFoundANTFSManufacturerID;
  117. volatile USHORT usFoundANTFSDeviceType;
  118. volatile UCHAR ucFoundANTDeviceType;
  119. volatile UCHAR ucFoundANTTransmitType;
  120. volatile BOOL bFoundDeviceHasData;
  121. volatile BOOL bFoundDeviceUploadEnabled;
  122. volatile BOOL bFoundDeviceInPairingMode;
  123. volatile UCHAR ucFoundDeviceAuthenticationType;
  124. volatile UCHAR ucFoundDeviceState;
  125. volatile BOOL bFoundDevice;
  126. volatile BOOL bFoundDeviceIsValid;
  127. volatile BOOL bNewRxEvent;
  128. // Download Data
  129. UCHAR *pucTransferBuffer;
  130. UCHAR *pucTransferBufferDynamic;
  131. UCHAR aucTransferBufferFixed[MAX_USHORT + 16];
  132. UCHAR aucSendDirectBuffer[8 + DIRECT_TRANSFER_SIZE];
  133. volatile ULONG ulTransferArrayIndex;
  134. volatile ULONG ulPacketCount;
  135. volatile ULONG ulUploadIndexProgress;
  136. volatile BOOL bTxError;
  137. volatile BOOL bRxError;
  138. volatile BOOL bReceivedBurst;
  139. volatile BOOL bReceivedResponse;
  140. volatile ULONG ulTransferTotalBytesRemaining;
  141. volatile ULONG ulTransferBytesInBlock;
  142. volatile BOOL bTransfer;
  143. ULONG ulHostBlockSize;
  144. DSI_THREAD_ID hANTFSThread; // Handle for the ANTFS thread.
  145. DSI_MUTEX stMutexResponseQueue; // Mutex used with the response queue
  146. DSI_MUTEX stMutexCriticalSection; // Mutex used with the wait condition
  147. DSI_MUTEX stMutexIgnoreListAccess; // Mutex used with the ignore list
  148. DSI_CONDITION_VAR stCondANTFSThreadExit; // Event to signal the ANTFS thread has ended.
  149. DSI_CONDITION_VAR stCondRequest; // Event to signal there is a new request
  150. DSI_CONDITION_VAR stCondRxEvent; // Event to signal there is a new Rx message or failure
  151. DSI_CONDITION_VAR stCondWaitForResponse; // Event to signal there is a new response to the application
  152. volatile USHORT usSerialWatchdog;
  153. volatile BOOL bKillThread;
  154. volatile BOOL bANTFSThreadRunning;
  155. volatile BOOL bCancel; // Internal cancel parameter to use if not configured
  156. volatile BOOL *pbCancel;
  157. DSIFramerANT *pclANT;
  158. // ANT Channel parameters
  159. UCHAR ucNetworkNumber;
  160. //UCHAR ucChannelNumber;
  161. USHORT usRadioChannelID;
  162. UCHAR ucTheDeviceType;
  163. UCHAR ucTheTransmissionType;
  164. USHORT usTheMessagePeriod;
  165. UCHAR aucTheNetworkkey[8];
  166. UCHAR ucTheProxThreshold;
  167. volatile USHORT usSearchManufacturerID;
  168. volatile USHORT usSearchDeviceType;
  169. volatile USHORT usBlackoutTime;
  170. volatile UCHAR ucTransportLayerRadioFrequency;
  171. UCHAR ucSearchRadioFrequency;
  172. USHORT usTransferDataFileIndex;
  173. volatile ULONG ulTransferDataOffset;
  174. volatile ULONG ulTransferByteSize;
  175. volatile ULONG ulTransferBufferSize;
  176. volatile BOOL bLargeData;
  177. // Ignore List variables
  178. volatile USHORT usListIndex;
  179. IGNORE_LIST_ITEM astIgnoreList[MAX_IGNORE_LIST_SIZE];
  180. BOOL bTimerThreadInitDone;
  181. DSITimer *pclQueueTimer;
  182. volatile UCHAR ucLinkResponseRetries;
  183. UCHAR ucStrikes;
  184. volatile UCHAR ucTransportBeaconTicks;
  185. UCHAR ucTransportChannelPeriodSelection;
  186. UCHAR ucTransportFrequencySelection;
  187. UCHAR ucTransportFrequencyStaleCount;
  188. UCHAR ucCurrentTransportFreqElement;
  189. UCHAR aucFrequencyTable[TRANSPORT_FREQUENCY_LIST_SIZE];
  190. DEVICE_PARAMETERS_ITEM asDeviceParametersList[SEARCH_DEVICE_LIST_MAX_SIZE];
  191. USHORT usDeviceListSize;
  192. volatile ANTFS_HOST_STATE eANTFSState;
  193. volatile ENUM_ANTFS_REQUEST eANTFSRequest;
  194. //////////////////////////////////////////////////////////////////////////////////
  195. // Private Function Prototypes
  196. //////////////////////////////////////////////////////////////////////////////////
  197. BOOL ReportDownloadProgress(void);
  198. BOOL ReInitDevice(void);
  199. void ResetHostState(void);
  200. RETURN_STATUS AttemptSearch(void);
  201. RETURN_STATUS AttemptConnect(void);
  202. RETURN_STATUS AttemptRequestSession(void);
  203. RETURN_STATUS AttemptSwitchFrequency(void);
  204. RETURN_STATUS AttemptDisconnect(void);
  205. void Ping(void);
  206. RETURN_STATUS AttemptDownload(void);
  207. RETURN_STATUS UploadLoop(void);
  208. RETURN_STATUS AttemptUpload(void);
  209. RETURN_STATUS AttemptManualTransfer(void);
  210. RETURN_STATUS Receive(void);
  211. RETURN_STATUS AttemptErase(void);
  212. RETURN_STATUS AttemptAuthenticate(void);
  213. // ANT Callback Functions
  214. BOOL FilterANTMessages(ANT_MESSAGE* pstMessage_, UCHAR ucANTChannel_);
  215. BOOL ANTProtocolEventProcess(UCHAR ucChannel_, UCHAR ucMessageCode_);
  216. BOOL ANTChannelEventProcess(UCHAR ucChannel_, UCHAR ucMessageCode_);
  217. void QueueTimerCallback(void);
  218. static DSI_THREAD_RETURN QueueTimerStart(void *pvParameter_);
  219. void HandleSerialError(void);
  220. void IncFreqStaleCount(UCHAR ucInc);
  221. void PopulateTransportFreqTable(void);
  222. UCHAR CheckForNewTransportFreq(void);
  223. void ANTFSThread(void);
  224. static DSI_THREAD_RETURN ANTFSThreadStart(void *pvParameter_);
  225. BOOL IsDeviceMatched(ANTFS_DEVICE_PARAMETERS *psDeviceParameters_, BOOL bPartialID_);
  226. void AddResponse(ANTFS_HOST_RESPONSE eResponse_);
  227. public:
  228. //////////////////////////////////////////////////////////////////////////////////
  229. // Public Function Prototypes
  230. //////////////////////////////////////////////////////////////////////////////////
  231. ANTFSHostChannel();
  232. ~ANTFSHostChannel();
  233. BOOL Init(DSIFramerANT* pclANT_, UCHAR ucChannel_);
  234. /////////////////////////////////////////////////////////////////
  235. // Begins to initialize the ANTFSHostChannel object.
  236. // Returns TRUE if successful. Otherwise, it returns FALSE.
  237. // Parameters:
  238. // *pclANT_: Pointer to a DSIFramerANT object.
  239. // ucChannel_: Channel number to use for the ANT-FS host
  240. // Operation:
  241. // This function is used from a class managing the connection
  242. // to ANT (e.g. DSIANTDevice or .NET ANT_Device), to
  243. // initialize the ANTFSHostChannel object. It is not possible
  244. // to change the channel number once ANT-FS is running.
  245. // The function returns immediately, and the ANTFSHostChannel object
  246. // will send a response of ANTFS_HOST_RESPONSE_INIT_PASS.
  247. // IT IS NOT NECESSARY TO CALL THIS FUNCTION DIRECTLY FROM USER APPLICATIONS.
  248. /////////////////////////////////////////////////////////////////
  249. void Close(void);
  250. /////////////////////////////////////////////////////////////////
  251. // Stops any pending actions, closes all threads and cleans
  252. // up any dynamic memory being used by the library.
  253. // Operation:
  254. // This function is used from a class managing the connection
  255. // to ANT (e.g. DSIANTDevice or .NET ANT_Device), to
  256. // clean up any resources in use by the ANT-FS host.
  257. // IT IS NOT NECESSARY TO CALL THIS FUNCTION DIRECTLY FROM USER APPLICATIONS.
  258. /////////////////////////////////////////////////////////////////
  259. void ProcessMessage(ANT_MESSAGE* pstMessage_, USHORT usMesgSize_);
  260. /////////////////////////////////////////////////////////////////
  261. // Processes incoming ANT messages as per the ANT-FS Technology
  262. // Specification
  263. // Parameters:
  264. // pstMessage_: Pointer to an ANT message structure
  265. // usMesgSize_: ANT message size
  266. // Operation:
  267. // This function is used from a class managing the connection
  268. // to ANT (e.g. DSIANTDevice or .NET ANT_Device).
  269. // IT IS NOT NECESSARY TO CALL THIS FUNCTION DIRECTLY FROM USER APPLICATIONS.
  270. /////////////////////////////////////////////////////////////////
  271. void ProcessDeviceNotification(ANT_DEVICE_NOTIFICATION eCode_, void* pvParameter_);
  272. /////////////////////////////////////////////////////////////////
  273. // Processes device level notifications
  274. // Parameters:
  275. // eCode_: Device notification event code
  276. // pvParameter_: Pointer to struct defining specific parameters related
  277. // to the event code
  278. // Operation:
  279. // This function si used from a class managing the connection
  280. // to ANT (e.g. DSIANTDevice or .NET ANT_Device).
  281. // IT IS NOT NECESSARY TO CALL THIS FUNCTION DIRECTLY FROM USER APPLICATIONS.
  282. /////////////////////////////////////////////////////////////////
  283. void Cancel(void);
  284. /////////////////////////////////////////////////////////////////
  285. // Cancels any pending actions and returns the library to the
  286. // appropriate ANTFS layer if possible. ie if the library was
  287. // executing a download command in the transport layer, the
  288. // library would be returned to ANTFS_HOST_STATE_TRANSPORT after
  289. // execution of this function.
  290. /////////////////////////////////////////////////////////////////
  291. void SetChannelID(UCHAR ucDeviceType_, UCHAR ucTransmissionType_);
  292. /////////////////////////////////////////////////////////////////
  293. // Configures the ANT channel ID for the ANT-FS Host channel
  294. // Parameters:
  295. // ucDeviceType_: ANT Channel Device Type
  296. // ucTransmissionType_: ANT Channel Transmission Type
  297. // Operation:
  298. // Changes to the channel ID are only applied after calling
  299. // SearchForDevice.
  300. /////////////////////////////////////////////////////////////////
  301. void SetChannelPeriod(USHORT usChannelPeriod_);
  302. /////////////////////////////////////////////////////////////////
  303. // Configures the ANT channel period for the ANT-FS Host channel
  304. // Parameters:
  305. // usChannelPeriod_: Channel period to use while in link state
  306. // Operation:
  307. // Changes to the channel ID are only applied after calling
  308. // SearchForDevice. If using ANT-FS broadcast, this is the
  309. // channel period the host will return to when using the
  310. // Disconnect command with the Return To Broadcast option.
  311. // To change the channel period while an ANT-FS session is open,
  312. // use SwitchFrequency().
  313. /////////////////////////////////////////////////////////////////
  314. // TODO: Does this function make sense here, or should it just assign the network number?
  315. // The ANTFSHost wrapper class could continue to provide this one for backwards compatibility
  316. void SetNetworkKey(UCHAR ucNetwork_, UCHAR ucNetworkkey[]);
  317. /////////////////////////////////////////////////////////////////
  318. // Configures the ANT network key for the ANT-FS channel
  319. // Parameters:
  320. // ucNetwork_: Network number (0 - 2)
  321. // ucNetworkkey: Array containing the 8 byte network key
  322. // Operation:
  323. // Changes to the network key are only applied after calling
  324. // SearchForDevice.
  325. /////////////////////////////////////////////////////////////////
  326. void SetProximitySearch(UCHAR ucSearchThreshold_);
  327. /////////////////////////////////////////////////////////////////
  328. // Sets the value for the proximity bin setting for searching.
  329. // Note: If applying this value fails when attempting to start search,
  330. // it is ignored to maintain compatibility with devices that
  331. // do not support this feature. This means that a real failure can occur
  332. // on a device that actually does support it, and it will be missed. The
  333. // debug log will show if this command fails.
  334. // Parameters:
  335. // ucSearchThreshold_: Desired proximity bin from 0-10 (If value is
  336. // set higher then 10, it is automatically capped at 10)
  337. // Operation:
  338. // Changes to the proximity search bin are only applied after calling
  339. // SearchForDevice.
  340. /////////////////////////////////////////////////////////////////
  341. void SetSerialNumber(ULONG ulSerialNumber_);
  342. /////////////////////////////////////////////////////////////////
  343. // Configures the host serial number.
  344. // Parameters:
  345. // ulSerialNumber_: 4-byte host serial number
  346. /////////////////////////////////////////////////////////////////
  347. BOOL EnablePing(BOOL bEnable_);
  348. /////////////////////////////////////////////////////////////////
  349. // Enables ping message to be sent to the remote device periodically.
  350. // This can be used to keep the remote device from timing out during
  351. // operations that wait for user input (i.e. pairing)
  352. // Parameters:
  353. // bEnable_: Periodic ping enable.
  354. // Returns TRUE if successful. Otherwise, it returns FALSE.
  355. /////////////////////////////////////////////////////////////////
  356. BOOL GetEnabled(void);
  357. /////////////////////////////////////////////////////////////////
  358. // Returns the current status of ANT-FS message processing
  359. // Returns TRUE if ANT-FS is enabled. Otherwise, it returns FALSE.
  360. // Operation:
  361. // This function is used from a class managing the connection
  362. // to ANT (e.g. DSIANTDevice or .NET ANT_Device).
  363. // IT IS NOT NECESSARY TO CALL THIS FUNCTION DIRECTLY FROM USER APPLICATIONS.
  364. /////////////////////////////////////////////////////////////////
  365. ANTFS_HOST_STATE GetStatus(void);
  366. /////////////////////////////////////////////////////////////////
  367. // Returns the current library status.
  368. /////////////////////////////////////////////////////////////////
  369. BOOL GetFoundDeviceParameters(ANTFS_DEVICE_PARAMETERS *pstDeviceParameters_, UCHAR *aucFriendlyName_, UCHAR *pucBufferSize_);
  370. /////////////////////////////////////////////////////////////////
  371. // Copies the parameters of the most recently found device to the
  372. // supplied parameter.
  373. // Parameters:
  374. // *ptsDeviceParameters_: A pointer to a structure that will
  375. // receive a copy of the device parameters.
  376. // *aucFriendlyName_: A pointer to a buffer where the remote
  377. // device friendly name will be copied.
  378. // *pucBufferSize_: Pointer to a UCHAR variable that should contain the
  379. // maximum size of the buffer pointed to by aucFriendlyName_.
  380. // After the function returns, the UCHAR variable
  381. // will be set to reflect the size of friendly name string
  382. // that has been copied to aucFriendlyName_.
  383. // Returns TRUE if successful. Otherwise, it returns FALSE.
  384. /////////////////////////////////////////////////////////////////
  385. BOOL GetFoundDeviceChannelID(USHORT *pusDeviceNumber_ = (USHORT *)NULL, UCHAR *pucDeviceType_ = (UCHAR *)NULL, UCHAR *pucTransmitType_ = (UCHAR *)NULL);
  386. /////////////////////////////////////////////////////////////////
  387. // Copies the ANT channel ID of the most recently found device to
  388. // the supplied parameters.
  389. // Parameters:
  390. // *pusDeviceNumber_: A pointer to a USHORT variable that will
  391. // receive the ANT device number of the device.
  392. // *pucDeviceType_: A pointer to a UCHAR variable that will
  393. // hold the device type of the found device.
  394. // *pucTransmitType_: Pointer to a UCHAR variable that will
  395. // receive the transmission type of the found
  396. // device
  397. // Returns TRUE if successful. Otherwise, it returns FALSE.
  398. /////////////////////////////////////////////////////////////////
  399. BOOL GetUploadStatus(ULONG *pulByteProgress_, ULONG *pulTotalLength_);
  400. /////////////////////////////////////////////////////////////////
  401. // Gets the transfer progress of a pending or a complete
  402. // upload.
  403. // Parameters:
  404. // *pulByteProgress_: Pointer to a ULONG that will receive
  405. // the current byte progress of a pending or
  406. // complete upload.
  407. // *pulTotalLength_: Pointer to a ULONG that will receive the
  408. // total length of the file being uploaded.
  409. // Returns TRUE if successful. Otherwise, it returns FALSE.
  410. // Operation:
  411. // A data upload occurs when information is requested to be sent to
  412. // a remote device. This function may be called at any point
  413. // during an upload as a progress indicator. After the upload
  414. // is complete, this information is valid until another request
  415. // for a data transfer is made.
  416. /////////////////////////////////////////////////////////////////
  417. BOOL GetDownloadStatus(ULONG *pulByteProgress_, ULONG *pulTotalLength_);
  418. /////////////////////////////////////////////////////////////////
  419. // Gets the transfer progress of a pending or a complete
  420. // download.
  421. // Parameters:
  422. // *pulByteProgress_: Pointer to a ULONG that will receive
  423. // the current byte progress of a pending or
  424. // complete download.
  425. // *pulTotalLength_: Pointer to a ULONG that will receive the
  426. // total expected length of the download.
  427. // Returns TRUE if successful. Otherwise, it returns FALSE.
  428. // Operation:
  429. // A data download occurs when information is requested from a
  430. // remote device. This function may be called at any point
  431. // during a download as a progress indicator. After the transfer
  432. // is complete, this information is valid until another request
  433. // for a data transfer is made.
  434. /////////////////////////////////////////////////////////////////
  435. BOOL GetTransferData(ULONG *pulDataSize_ , void *pvData_ = NULL);
  436. /////////////////////////////////////////////////////////////////
  437. // Gets the received data from a transfer (download/manual transfer).
  438. //
  439. // Parameters:
  440. // *ulDataSize_ : Pointer to a ULONG that will receive
  441. // the size of the data available in bytes.
  442. // *pvData_ : Pointer to a buffer where the received data
  443. // will be copied. NULL can be passed to this
  444. // parameter so that the size can be retried
  445. // without copying any data. The application
  446. // can then call this function again to after it
  447. // has allocated a buffer of sufficient size to
  448. // handle the data.
  449. // Returns TRUE if successful. Otherwise, it returns FALSE.
  450. /////////////////////////////////////////////////////////////////
  451. BOOL RecoverTransferData(ULONG *pulDataSize_ , void *pvData_ = NULL);
  452. /////////////////////////////////////////////////////////////////
  453. // Gets the partially received data from a failed transfer (download/manual transfer).
  454. //
  455. // Parameters:
  456. // *ulDataSize_ : Pointer to a ULONG that will receive
  457. // the size of the data available in bytes.
  458. // *pvData_ : Pointer to a buffer where the received data
  459. // will be copied. NULL can be passed to this
  460. // parameter so that the size can be retried
  461. // without copying any data. The application
  462. // can then call this function again to after it
  463. // has allocated a buffer of sufficient size to
  464. // handle the data.
  465. // Returns TRUE if successful. Otherwise, it returns FALSE.
  466. /////////////////////////////////////////////////////////////////
  467. UCHAR GetVersion(UCHAR *pucVersionString_, UCHAR ucBufferSize_);
  468. /////////////////////////////////////////////////////////////////
  469. // Copies at most ucBufferSize_ characters from the version
  470. // string into the supplied pucVersionString_ buffer.
  471. // Parameters:
  472. // *pucVersionString_ Pointer to a buffer of characters into
  473. // which to receive the version string.
  474. // ucBufferSize_ The maximum number of characters to
  475. // copy into *pucVersionString_.
  476. // Returns the number of characters copied to *pucVersionString_.
  477. // Operation:
  478. // If the version string has fewer than ucBufferSize_
  479. // characters, the *pucVersionString_ will be padded with a
  480. // '\n'.
  481. /////////////////////////////////////////////////////////////////
  482. ANTFS_RETURN RequestSession(UCHAR ucBroadcastRadioFrequency_ = ANTFS_RF_FREQ, UCHAR ucConnectRadioFrequency_ = ANTFS_DEFAULT_TRANSPORT_FREQ);
  483. /////////////////////////////////////////////////////////////////
  484. // Requests an ANT-FS session from currently connected broadcast
  485. // device
  486. // Parameters:
  487. // ucBroadcastRadioFrequency_: This specifies the frequency on
  488. // which the broadcast device is transmitting.
  489. // This frequency is calculated as
  490. // (ucBroadcastRadioFrequency_ * 1 MHz +
  491. // 2400 MHz). MAX_UCHAR (0xFF) is reserved.
  492. // ucConnectRadioFrequency_: This specifies the frequency
  493. // on which the connection communication
  494. // will occur. This frequency is calculated
  495. // as (ucConnectRadioFrequency_ * 1 MHz +
  496. // 2400 MHz). If ucConnectRadioFrequency_
  497. // is set to ANTFS_AUTO_FREQUENCY_SELECTION
  498. // (0xFF), then the library will use an
  499. // adaptive frequency-hopping scheme.
  500. // Returns ANTFS_RETURN_PASS if successful. Otherwise, it returns
  501. // ANTFS_RETURN_FAIL if the library is in the wrong state, or
  502. // ANTFS_RETURN_BUSY if the library is busy with another request.
  503. // Operation:
  504. // Once this function is called successfully, the application
  505. // must wait for the response from the ANTFSHost object.
  506. // Possible responses are:
  507. // ANTFS_HOST_RESPONSE_CONNECT_PASS
  508. // ANTFS_HOST_RESPONSE_REQUEST_SESSION_FAIL,
  509. // ANTFS_HOST_RESPONSE_SERIAL_FAIL
  510. // To return to broadcast state, use the Disconnect() function.
  511. /////////////////////////////////////////////////////////////////
  512. ANTFS_RETURN SearchForDevice(UCHAR ucSearchRadioFrequency_ = ANTFS_RF_FREQ, UCHAR ucConnectRadioFrequency_ = ANTFS_DEFAULT_TRANSPORT_FREQ, USHORT usRadioChannelID_ = 0, BOOL bUseRequestPage_ = FALSE);
  513. /////////////////////////////////////////////////////////////////
  514. // Begins a search for ANTFS remote devices.
  515. // Parameters:
  516. // ucSearchRadioFrequency_: This specifies the frequency on
  517. // which to search for devices. This
  518. // frequency is calculated as
  519. // (ucSearchRadioFrequency_ * 1 MHz +
  520. // 2400 MHz). MAX_UCHAR (0xFF) is reserved.
  521. // ucConnectRadioFrequency_: This specifies the frequency
  522. // on which the connection communication
  523. // will occur. This frequency is calculated
  524. // as (ucConnectRadioFrequency_ * 1 MHz +
  525. // 2400 MHz). If ucConnectRadioFrequency_
  526. // is set to ANTFS_AUTO_FREQUENCY_SELECTION
  527. // (0xFF), then the library will use an
  528. // adaptive frequency-hopping scheme.
  529. // usRadioChannelID_: This specifies the channel ID for the
  530. // the ANT channel search. Set to zero to
  531. // wildcard.
  532. // bUseRequestPage_: Specifies whether the search will include
  533. // ANT-FS broadcast devices, using a request
  534. // page to begin an ANT-FS session
  535. // Returns ANTFS_RETURN_PASS if successful. Otherwise, it returns
  536. // ANTFS_RETURN_FAIL if the library is in the wrong state, or
  537. // ANTFS_RETURN_BUSY if the library is busy with another request.
  538. // Operation:
  539. // Once this function is called successfully, the application
  540. // must wait for the response from the ANTFSHost object.
  541. // Possible responses are:
  542. // ANTFS_HOST_RESPONSE_CONNECT_PASS
  543. // ANTFS_HOST_RESPONSE_SERIAL_FAIL
  544. // The library will continue to search for devices until a device
  545. // is found, the Cancel() function is called, an error occurs, or
  546. // the library is closed.
  547. /////////////////////////////////////////////////////////////////
  548. ANTFS_RETURN Authenticate(UCHAR ucAuthenticationType_, UCHAR *pucAuthenticationString_, UCHAR ucLength_, UCHAR *aucResponseBuffer_, UCHAR *pucResponseBufferSize_, ULONG ulResponseTimeout_);
  549. /////////////////////////////////////////////////////////////////
  550. // Request to establish an authenticated session with the connected
  551. // remote device.
  552. // Parameters:
  553. // ucAuthenticationType_: The type of authentication to
  554. // execute on the remote device.
  555. // *pucAuthenticationString_: A string that may be used in
  556. // conjunction with the particular
  557. // authentication type in use (e.g. a
  558. // password or a friendly name.
  559. // ucLength_: The length of the authentication string,
  560. // including any '\n' terminator. This
  561. // parameter may be set to zero if an
  562. // authentication string is not required.
  563. // *pucResponseBuffer_: Pointer to the buffer where additional
  564. // data from the response will be saved. This will
  565. // include data such as passwords and friendly names.
  566. // This memory must be allocated by the application.
  567. // *pucResponseBufferSize_: Pointer to UCHAR varible that contains the
  568. // size of the buffer pointed to by pucResponseBuffer_.
  569. // After the response has be recived, the UCHAR variable
  570. // will be set to reflect the size of the new data received
  571. // in pucResponseBuffer_.
  572. // ulResponseTimeout_: Number of miliseconds to wait for a response after
  573. // the authenticate command is sent.
  574. // Returns ANTFS_RETURN_PASS if successful. Otherwise, it returns
  575. // ANTFS_RETURN_FAIL if the library is in the wrong state, or
  576. // ANTFS_RETURN_BUSY if the library is busy with another request.
  577. // Operation:
  578. // Once the request is posted, the application must wait for the
  579. // response from the ANTFSHost object. Possible responses are:
  580. // ANTFS_HOST_RESPONSE_AUTHENTICATE_NA
  581. // ANTFS_HOST_RESPONSE_AUTHENTICATE_PASS
  582. // ANTFS_HOST_RESPONSE_AUTHENTICATE_REJECT
  583. // ANTFS_HOST_RESPONSE_AUTHENTICATE_FAIL
  584. // ANTFS_HOST_RESPONSE_CONNECTION_LOST
  585. // ANTFS_HOST_RESPONSE_SERIAL_FAIL
  586. // Upon receiving the ANTFS_HOST_RESPONSE_AUTHENTICATE_PASS, an
  587. // authentication string provided by the remoted device may be
  588. // available in the response buffer. This depends on the
  589. // authentication type used. The transport
  590. // layer connection is also only established after receiving
  591. // ANTFS_HOST_RESPONSE_AUTHENTICATE_PASS .
  592. /////////////////////////////////////////////////////////////////
  593. ANTFS_RETURN Download(USHORT usFileIndex_, ULONG ulDataOffset_, ULONG ulMaxDataLength_, ULONG ulMaxBlockSize_ = 0);
  594. /////////////////////////////////////////////////////////////////
  595. // Request a download of a file from the authenticated device.
  596. // Parameters:
  597. // usFileIndex_: The file number to be downloaded. Some
  598. // file numbers are reserved for special
  599. // purposes, such as the device directory
  600. // (0). Consult the ANT_FS specification
  601. // and any docs for specific device types.
  602. // ulDataOffset_: The byte offset from where to begin
  603. // transferring the data.
  604. // ulMaxDataLength_: ULONG varible that contains the maximum
  605. // number of bytes to download. Set to 0 if
  606. // if the host does not wish to limit the
  607. // size of the download.
  608. // ulMaxBlockSize_: Maximum number of bytes that the host
  609. // wishes to download in a single block.
  610. // Set to zero to disable.
  611. // Returns ANTFS_RETURN_PASS if successful. Otherwise, it returns
  612. // ANTFS_RETURN_FAIL if the library is in the wrong state, or
  613. // ANTFS_RETURN_BUSY if the library is busy with another request.
  614. // Operation:
  615. // Once the request is posted, the application must wait for the
  616. // response from the ANTFSHost object. Possible responses are:
  617. // ANTFS_HOST_RESPONSE_DOWNLOAD_PASS
  618. // ANTFS_HOST_RESPONSE_DOWNLOAD_REJECT
  619. // ANTFS_HOST_RESPONSE_DOWNLOAD_FAIL
  620. // ANTFS_HOST_RESPONSE_CONNECTION_LOST
  621. // ANTFS_HOST_RESPONSE_SERIAL_FAIL
  622. // Upon receiving ANTFS_HOST_RESPONSE_DOWNLOAD_PASS the downloaed data
  623. // will be available in the transfer buffer. See GetTransferData().
  624. /////////////////////////////////////////////////////////////////
  625. ANTFS_RETURN Upload(USHORT usFileIndex_, ULONG ulDataOffset_, ULONG ulDataLength_, void *pvData_, BOOL bForceOffset_ = TRUE, ULONG ulMaxBlockSize_ = 0);
  626. /////////////////////////////////////////////////////////////////
  627. // Request an upload of a file to the authenticated device.
  628. // Parameters:
  629. // usFileIndex_: The file number to be uploaded. Some
  630. // file numbers are reserved for special
  631. // purposes, such as the device directory
  632. // (0). Consult the ANT_FS specification
  633. // and any docs for specific device types.
  634. // ulDataOffset_: The byte offset from where to begin
  635. // transferring the data.
  636. // ulDataLength_: The byte length of data to be uploaded
  637. // to the remote device.
  638. // Return value:
  639. // *pvData_: Pointer to the location where the data
  640. // to be uploaded is stored.
  641. // bForceOffset_: Set to TRUE (default) to enforce the
  642. // provided byte data offset. Set to FALSE
  643. // to continue a transfer, indicating that
  644. // the host will continue the upload at the
  645. // last data offset specified by the client
  646. // in the Upload Response.
  647. // ulMaxBlockSize_: Maximum block size that the host can send
  648. // in a single block of data. Set to zero
  649. // to disable
  650. // Returns ANTFS_RETURN_PASS if successful. Otherwise, it returns
  651. // ANTFS_RETURN_FAIL if the library is in the wrong state, or
  652. // ANTFS_RETURN_BUSY if the library is busy with another request.
  653. // Operation:
  654. // Once the request is posted, the application must wait for the
  655. // response from the ANTFSHost object. Possible responses are:
  656. // ANTFS_HOST_RESPONSE_UPLOAD_PASS
  657. // ANTFS_HOST_RESPONSE_UPLOAD_REJECT
  658. // ANTFS_HOST_RESPONSE_UPLOAD_FAIL
  659. // ANTFS_HOST_RESPONSE_CONNECTION_LOST
  660. // ANTFS_HOST_RESPONSE_SERIAL_FAIL
  661. /////////////////////////////////////////////////////////////////
  662. ANTFS_RETURN ManualTransfer(USHORT usFileIndex_, ULONG ulDataOffset_, ULONG ulDataLength_, void *pvData_);
  663. /////////////////////////////////////////////////////////////////
  664. // Send data directly to the device without requesting first.
  665. // This is especially useful for communicating small pieces of
  666. // data to the device. Another use is the implementation of a
  667. // higher-level communication protocol. Care must be taken to
  668. // ensure the device can handle the amount of data being sent
  669. // using this method.
  670. // usFileIndex_: The file number to be uploaded. Some
  671. // file numbers are reserved for special
  672. // purposes, such as the device directory
  673. // (0). Consult the ANT_FS specification
  674. // and any docs for specific device types.
  675. // ulDataOffset_: The byte offset from where to begin
  676. // transferring the data. Note that this
  677. // value will always get rounded up to the
  678. // next higher multiple of 8. Under normal
  679. // use, this parameter should always be set
  680. // to zero, and the only time it would be
  681. // non-zero is for retrying ManualTransfer()
  682. // from a known offset.
  683. // ulDataLength_: The byte length of data to be sent to
  684. // the remote device.
  685. // *pvData_: The Pointer to a buffer where the
  686. // data to be sent is stored.
  687. // Returns ANTFS_RETURN_PASS if successful. Otherwise, it returns
  688. // ANTFS_RETURN_FAIL if the library is in the wrong state, or
  689. // ANTFS_RETURN_BUSY if the library is busy with another request.
  690. // Operation:
  691. // Once the request is posted, the application must wait for the
  692. // response from the ANTFSHost object. Possible responses are:
  693. // ANTFS_HOST_RESPONSE_MANUAL_TRANSFER_PASS
  694. // ANTFS_HOST_RESPONSE_MANUAL_TRANSFER_TRANSMIT_FAIL
  695. // ANTFS_HOST_RESPONSE_MANUAL_TRANSFER_RESPONSE_FAIL
  696. // ANTFS_HOST_RESPONSE_CONNECTION_LOST
  697. // ANTFS_HOST_RESPONSE_SERIAL_FAIL
  698. // Upon receiving ANTFS_HOST_RESPONSE_MANUAL_TRANSFER_PASS the downloaed data
  699. // will be available in the transfer buffer. See GetTransferData().
  700. /////////////////////////////////////////////////////////////////
  701. ANTFS_RETURN EraseData(USHORT usFileIndex_);
  702. /////////////////////////////////////////////////////////////////
  703. // Request the erasure of a file on the authenticated remote
  704. // device.
  705. // Parameters:
  706. // usFileIndex_: The file number of the file to be erased.
  707. // Returns ANTFS_RETURN_PASS if successful. Otherwise, it returns
  708. // ANTFS_RETURN_FAIL if the library is in the wrong state, or
  709. // ANTFS_RETURN_BUSY if the library is busy with another request.
  710. // Operation:
  711. // Once the request is posted, the application must wait for the
  712. // response from the ANTFSHost object. Possible responses are:
  713. // ANTFS_HOST_RESPONSE_ERASE_PASS
  714. // ANTFS_HOST_RESPONSE_ERASE_FAIL
  715. // ANTFS_HOST_RESPONSE_CONNECTION_LOST
  716. // ANTFS_HOST_RESPONSE_SERIAL_FAIL
  717. /////////////////////////////////////////////////////////////////
  718. ANTFS_RETURN Disconnect(USHORT usBlackoutTime_, UCHAR ucDisconnectType_ = 0, UCHAR ucTimeDuration_ = 0, UCHAR ucAppSpecificDuration_ = 0);
  719. /////////////////////////////////////////////////////////////////
  720. // Disconnect from a remote device. Optionally put that device
  721. // on a blackout list for a period of time. The application can
  722. // also request the remote device to become undiscoverable for a
  723. // specified time/application specific duration.
  724. // Parameters:
  725. // usBlackoutTime_: The number of seconds the device ID
  726. // should remain on the blackout list. If
  727. // set to zero (0), then the device will
  728. // not be put on the blackout list. If set
  729. // to MAX_USHORT (0xFFFF), the device will
  730. // remain on the blackout list until
  731. // explicitly removed, or until the blackout
  732. // list is reset.
  733. // ucDisconnectType_: Specifies whether the client should
  734. // return to LINK state (default) or broadcast mode.
  735. // Values from 128 - 255 can be used to specify
  736. // application specific disconnect behavior.
  737. // ucTimeDuration_: Time, in 30 seconds increments, the client
  738. // device will remain undiscoverable after
  739. // disconnect has been requested. Set to 0 to
  740. // disable.
  741. // ucAppSpecificDuration_: Application specific duration the client
  742. // shall remain undiscoverable after disconnection.
  743. // This field is left to the developer, or defined
  744. // in an ANT+ Device Profile. Set to 0 to disable.
  745. // Returns ANTFS_RETURN_PASS if successful. Otherwise, it returns
  746. // ANTFS_RETURN_FAIL if the library is in the wrong state, or
  747. // ANTFS_RETURN_BUSY if the library is busy with another request.
  748. // Operation:
  749. // Once the request is posted, the application must wait for the
  750. // response from the ANTFSHost object. Possible responses are:
  751. // ANTFS_HOST_RESPONSE_DISCONNECT_PASS
  752. // ANTFS_HOST_RESPONSE_CONNECTION_LOST
  753. // ANTFS_HOST_RESPONSE_SERIAL_FAIL
  754. // The remote device will not show up in any search results for
  755. // the duration specified in usBlackoutTime_. This allows the
  756. // host to more easily find other devices in crowded
  757. // environments. The host can also request the remote device to
  758. // become undiscoverable, to more easily find other devices, however
  759. // not all client devices might implement this feature. Not all
  760. // client devices support a broadcast mode.
  761. // If no disconnect type is specified, the default behavior will be to
  762. // return to the LINK state, and the host will close the
  763. // channel after disconnecting. If the disconnect type is set to 1,
  764. // the host will return to broadcast mode, and will keep its channel
  765. // open.
  766. /////////////////////////////////////////////////////////////////
  767. // TODO: Need to define a response for this?
  768. ANTFS_RETURN SwitchFrequency(UCHAR ucRadioFrequency_, UCHAR ucChannelPeriod_ = BEACON_PERIOD_KEEP);
  769. /////////////////////////////////////////////////////////////////
  770. // Request the connected remote device to switch to the specified
  771. // radio frequency and channel period
  772. // Parameters:
  773. // ucRadioFrequency_: This specifies the frequency
  774. // on which the connection communication
  775. // will occur. This frequency is calculated
  776. // as (ucRadioFrequency_ * 1 MHz + 2400 MHz).
  777. // ucBeaconPeriod_: This specifies the beacon period on which
  778. // the communication will continue. Use
  779. // BEACON_PERIOD_KEEP to only change the radio
  780. // frequency.
  781. // Returns ANTFS_RETURN_PASS if successful. Otherwise, it returns
  782. // ANTFS_RETURN_FAIL if the library is in the wrong state, or
  783. // ANTFS_RETURN_BUSY if the library is busy with another request.
  784. // Operation:
  785. // This function can only be used in transport state, to change
  786. // the channel parameters.
  787. // Once this function is called successfully, the application
  788. // must wait for the response from the ANTFSHost object.
  789. // Possible responses are:
  790. // ANTFS_HOST_RESPONSE_CONNECTION_LOST
  791. // ANTFS_HOST_RESPONSE_SERIAL_FAIL
  792. /////////////////////////////////////////////////////////////////
  793. USHORT AddSearchDevice(ANTFS_DEVICE_PARAMETERS *pstDeviceSearchMask_, ANTFS_DEVICE_PARAMETERS *pstDeviceParameters_);
  794. /////////////////////////////////////////////////////////////////
  795. // Adds a set of parameters for which to search to the internal
  796. // search device list.
  797. // Parameters:
  798. // *pstDeviceSearchMask_: A pointer to an
  799. // ANTFS_DEVICE_PARAMETERS structure. Set a
  800. // member to zero (0) to wildcard search for
  801. // it. Otherwise, set the bits that you want
  802. // to be matched to 1 in each member. Members
  803. // that are integer values will be treated the
  804. // same as bit fields for the purposes for the mask.
  805. // *pstDeviceParameters_: A pointer to an
  806. // ANTFS_DEVICE_PARAMETERS structure. Set
  807. // the member to the desired search value.
  808. // A member in this structure is ignored if
  809. // the associated member in the
  810. // *pstDeviceSearchMask_ parameter is set
  811. // to zero (0) for wildcard.
  812. // Returns a handle the the search device entry. If the return
  813. // value is NULL, the function failed adding the device entry.
  814. // This means that the device list is already full.
  815. // Operation:
  816. // Note that the default search masks should normally be applied
  817. // to the ucStatusByte1 and ucStatusByte2 members of the
  818. // *pstDeviceSearchMask_ parameter. Eg;
  819. // pstMyDeviceSearchMask->ucStatusByte1 =
  820. // ANTFS_STATUS1_DEFAULT_SEARCH_MASK & ucMyStatus1Criteria;
  821. // Setting bits outside the masks, especially reserved bits, may
  822. // lead to undesired behaviour.
  823. /////////////////////////////////////////////////////////////////
  824. void RemoveSearchDevice(USHORT usHandle_);
  825. /////////////////////////////////////////////////////////////////
  826. // Removes a device entry from the internal search list.
  827. // Parameters:
  828. // usHandle_: Handle to the device entry to be removed
  829. // from the list.
  830. /////////////////////////////////////////////////////////////////
  831. void ClearSearchDeviceList(void);
  832. /////////////////////////////////////////////////////////////////
  833. // Clears the internal search device list.
  834. /////////////////////////////////////////////////////////////////
  835. BOOL Blackout(ULONG ulDeviceID_, USHORT usManufacturerID_, USHORT usDeviceType_, USHORT usBlackoutTime_);
  836. /////////////////////////////////////////////////////////////////
  837. // Put the device on a blackout list for a period of time.
  838. // Parameters:
  839. // ulDeviceID_: The device ID of a specific device.
  840. // usManufacturerID_: The specific manufacturer ID.
  841. // usDeviceType_: The specific device type.
  842. // usBlackoutTime_: The number of seconds the device ID
  843. // should remain on the blackout list. If
  844. // set to zero (0), then the device will
  845. // not be put on the blackout list. If set
  846. // to MAX_USHORT (0xFFFF), the device will
  847. // remain on the blackout list until
  848. // explicitly removed, or until the blackout
  849. // list is reset.
  850. // Returns TRUE if successful. Otherwise, it returns FALSE.
  851. // A wildcard parameter (0) is not allowed in any of the device
  852. // ID parameters and will result in returning FALSE.
  853. // Operation:
  854. // The remote device will not show up in any search results for
  855. // the duration specified in usBlackoutTime_. This allows the
  856. // host to more easily find other devices in crowded
  857. // environments.
  858. /////////////////////////////////////////////////////////////////
  859. BOOL RemoveBlackout(ULONG ulDeviceID_, USHORT usManufacturerID_, USHORT usDeviceType_);
  860. /////////////////////////////////////////////////////////////////
  861. // Remove the device from the blackout list.
  862. // Parameters:
  863. // ulDeviceID_: The device ID of a specific device.
  864. // usManufacturerID_: The specific manufacturer ID.
  865. // usDeviceType_: The specific device type.
  866. // Returns TRUE if successful. Returns FALSE if the device is
  867. // not found in the blackout list. A wildcard parameter (0) is
  868. // not allowed in any of the device ID parameters and will result
  869. // in returning FALSE.
  870. /////////////////////////////////////////////////////////////////
  871. void ClearBlackoutList(void);
  872. /////////////////////////////////////////////////////////////////
  873. // Clears the blackout list.
  874. /////////////////////////////////////////////////////////////////
  875. ANTFS_HOST_RESPONSE WaitForResponse(ULONG ulMilliseconds_);
  876. /////////////////////////////////////////////////////////////////
  877. // Wait for a response from the ANTFS host library
  878. // Parameters:
  879. // ulMilliseconds_: Set this value to the minimum time to
  880. // wait before returning. If the value is
  881. // 0, the function will return immediately.
  882. // If the value is DSI_THREAD_INFINITE, the
  883. // function will not time out.
  884. // If one or more responses are pending before the timeout
  885. // expires the function will return the first response that
  886. // occured. If no response is pending at the time the timeout
  887. // expires, ANTFS_HOST_RESPONSE_NONE is returned.
  888. /////////////////////////////////////////////////////////////////
  889. };
  890. #endif // ANTFS_HOST_CHANNEL