dsi_framer_ant.hpp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  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(DSI_FRAMER_ANT_HPP)
  9. #define DSI_FRAMER_ANT_HPP
  10. #include "types.h"
  11. #include "antmessage.h"
  12. #include "antdefines.h"
  13. #include "dsi_framer.hpp"
  14. #include "dsi_thread.h"
  15. //////////////////////////////////////////////////////////////////////////////////
  16. // Public Definitions
  17. //////////////////////////////////////////////////////////////////////////////////
  18. #define DSI_FRAMER_ANT_ENONE ((UCHAR) 0x00)
  19. #define DSI_FRAMER_ANT_EQUEUE_OVERFLOW ((UCHAR) 0x01)
  20. #define DSI_FRAMER_ANT_ESERIAL ((UCHAR) 0x02)
  21. #define DSI_FRAMER_ANT_EINVALID_SIZE ((UCHAR) 0x03)
  22. #define DSI_FRAMER_ANT_CRC_ERROR ((UCHAR) 0x04)
  23. #define DSI_FRAMER_ANT_DEFAULT_RESPONSE_TIME ((ULONG) 1000)
  24. #define RX_FIFO_SIZE 256
  25. typedef struct ANT_MESSAGE
  26. {
  27. UCHAR ucMessageID;
  28. UCHAR aucData[MESG_MAX_SIZE_VALUE];
  29. } ANT_MESSAGE;
  30. typedef struct
  31. {
  32. UCHAR ucSize;
  33. ANT_MESSAGE stANTMessage;
  34. } ANT_MESSAGE_ITEM;
  35. typedef enum
  36. {
  37. ANTFRAMER_FAIL = 0,
  38. ANTFRAMER_PASS = 1,
  39. ANTFRAMER_TIMEOUT = 2,
  40. ANTFRAMER_CANCELLED = 3,
  41. ANTFRAMER_INVALIDPARAM = 4
  42. } ANTFRAMER_RETURN;
  43. typedef struct
  44. {
  45. ULONG ulSize;
  46. UCHAR* pucData;
  47. } ANTFS_DATA;
  48. typedef struct
  49. {
  50. UCHAR ucCommandID;
  51. UCHAR ucMessageID;
  52. UCHAR aucData[MESG_MAX_SIZE_VALUE];
  53. } FS_MESSAGE;
  54. class ANTMessageResponse;
  55. //////////////////////////////////////////////////////////////////////////////////
  56. // Public Class Prototypes
  57. //////////////////////////////////////////////////////////////////////////////////
  58. class DSIFramerANT : public DSIFramer
  59. {
  60. private:
  61. BOOL bSplitAdvancedBursts; //If this flag is set Advanced burst messages will be decomposed into simple burst messages.
  62. UCHAR ucPrevSequenceNum; //Previous Sequence number, used for splitting advanced bursts.
  63. protected:
  64. UCHAR ucRxIndex;
  65. UCHAR aucRxFifo[RX_FIFO_SIZE];
  66. UCHAR ucCheckSum;
  67. UCHAR ucRxSize;
  68. USHORT usMessageHead;
  69. USHORT usMessageTail;
  70. ANT_MESSAGE_ITEM astMessageBuffer[65536];
  71. UCHAR ucError;
  72. UCHAR ucSerialError;
  73. BOOL bInitOkay;
  74. BOOL bClosing;
  75. UCHAR ucFSResponse;
  76. volatile BOOL *pbCancel;
  77. DSI_MUTEX stMutexCriticalSection;
  78. DSI_MUTEX stMutexResponseRequest;
  79. DSI_CONDITION_VAR stCondMessageReady;
  80. DSI_CONDITION_VAR stCondResponseReady;
  81. ANTMessageResponse *pclResponseListStart;
  82. USHORT GetMessageSize(void);
  83. void ProcessMessage(void);
  84. void CheckResponseList(void);
  85. BOOL SendCommand(ANT_MESSAGE *pstANTMessage_, USHORT usMessageSize_, ULONG ulResponseTime_ = 0);
  86. BOOL SendFSCommand(FS_MESSAGE *pstFSMessage_, USHORT usMessageSize_, UCHAR* pucFSResponse, ULONG ulResponseTime_ = 0);
  87. ANTFRAMER_RETURN SetupAckDataTransfer(UCHAR ucMessageID_, UCHAR ucANTChannel_, UCHAR *pucData_, UCHAR ucMaxDataSize_, ULONG ulResponseTime_ = 0);
  88. ANTFRAMER_RETURN SetupBurstDataTransfer(UCHAR ucMessageID_, UCHAR ucANTChannel_, UCHAR * pucData_, ULONG ulSize_,UCHAR ucMaxDataSize_, ULONG ulResponseTime_ = 0);
  89. virtual BOOL CreateAntMsg_wOptExtBuf(ANT_MESSAGE **ppstExtBufAntMsg_, ULONG ulReqMinDataSize_); ///Default implementation allocates a new standard ANT_MESSAGE struct which must be free() after use. Subclassed framers use this to allocate additional (overflow) buffer space.
  90. public:
  91. // Constuctor and Destructor
  92. DSIFramerANT();
  93. DSIFramerANT(DSISerial *pclSerial_);
  94. ~DSIFramerANT();
  95. void SetCancelParameter(volatile BOOL *pbCancel_);
  96. volatile BOOL* GetCancelParameter();
  97. BOOL Init(DSISerial *pclSerial_ = (DSISerial*)NULL);
  98. /////////////////////////////////////////////////////////////////
  99. // Initializes the DSIFramer object. Must be called before using
  100. // other methods of this class or their behaviour will be
  101. // undefined.
  102. /////////////////////////////////////////////////////////////////
  103. // Inherited methods.
  104. void ProcessByte(UCHAR ucByte_);
  105. void Error(UCHAR ucError_);
  106. BOOL WriteMessage(void *pstANTMessage_, USHORT usMessageSize_);
  107. /////////////////////////////////////////////////////////////////
  108. // As per the notes in dsi_framer.h.
  109. // Parameters:
  110. // *pstANTMessage_: A pointer to an ANT_MESSAGE structure.
  111. // usMessageSize_: The size of the data in the aucData
  112. // element of the ANT_MESSAGE structure
  113. // pointed to by *pstANTMessage_ parameter.
  114. /////////////////////////////////////////////////////////////////
  115. USHORT WaitForMessage(ULONG ulMilliseconds_);
  116. /////////////////////////////////////////////////////////////////
  117. // As per the notes in dsi_framer.h.
  118. /////////////////////////////////////////////////////////////////
  119. USHORT GetMessage(void *pstANTMessage_, USHORT usMessageSize_ = 0);
  120. /////////////////////////////////////////////////////////////////
  121. // As per the notes in dsi_framer.h.
  122. // Parameters:
  123. // *pstANTMessage_: A pointer to an ANT_MESSAGE structure.
  124. // usMessageSize_: The size of the data in the aucData
  125. // element of the ANT_MESSAGE structure
  126. // pointed to by *pstANTMessage_ parameter.
  127. // Note that this will never exceed
  128. // sizeof(ANT_MESSAGE.aucData).
  129. // Return:
  130. // messageSize on success
  131. // DSI_FRAMER_TIMEDOUT if no message is available
  132. // DSI_FRAMER_ERROR if an error occured and a msg is returned with msgID=
  133. // msgID=DSI_FRAMER_ANT_EQUEUE_OVERFLOW - the received msg queue is full and one or more messages have been discarded
  134. // msgID=DSI_FRAMER_ANT_EINVALID_SIZE - min(usMessageSize, actualMsgSize) > MESG_MAX_SIZE_VALUE and message was discarded
  135. // msgID=DSI_FRAMER_ANT_ESERIAL then data[0]=
  136. // data[0] = DSI_FRAMER_ANT_CRC_ERROR - a message failed crc check and was discarded
  137. // data[0] = DSI_SERIAL_EWRITE - the serial class reported an error writing a message, could be from a parameter error or device connection lost (if device connection lost a read error or device lost error will occur as well)
  138. // data[0] = DSI_SERIAL_EREAD - the serial class reported a read failure (the read thread is aborted, device connection is lost)
  139. // data[0] = DSI_SERIAL_DEVICE_GONE - the serial library reported the device connection is lost
  140. /////////////////////////////////////////////////////////////////
  141. // DSIFramerANT-specific methods.
  142. UCHAR GetChannelNumber(ANT_MESSAGE* pstANTMessage_);
  143. /////////////////////////////////////////////////////////////////
  144. // Parameters:
  145. // *pstANTMessage_: A pointer to an ANT_MESSAGE structure.
  146. // Returns the channel number associated to the ANT_MESSAGE
  147. // received by ANT. Returns MAX_UCHAR if this is a general
  148. // protocol event, not related to a particular channel
  149. /////////////////////////////////////////////////////////////////
  150. /////////////////////////////////////////////////////////////////
  151. // Configuration Messages
  152. /////////////////////////////////////////////////////////////////
  153. void SetSplitAdvBursts(BOOL bSplitAdvBursts_);
  154. BOOL SetNetworkKey(UCHAR ucNetworkNumber_, UCHAR *pucKey_, ULONG ulResponseTime_ = 0);
  155. BOOL UnAssignChannel(UCHAR ucANTChannel_, ULONG ulResponseTime_ = 0);
  156. BOOL AssignChannel(UCHAR ucANTChannel_, UCHAR ucChannelType_, UCHAR ucNetworkNumber_, ULONG ulResponseTime_ = 0);
  157. BOOL AssignChannelExt(UCHAR ucANTChannel_, UCHAR* pucChannelType_, UCHAR ucSize_, UCHAR ucNetworkNumber_, ULONG ulResponseTime_ = 0);
  158. BOOL SetChannelID(UCHAR ucANTChannel_, USHORT usDeviceNumber_, UCHAR ucDeviceType_, UCHAR ucTransmitType_, ULONG ulResponseTime_ = 0);
  159. BOOL SetSerialNumChannelId(UCHAR ucANTChannel_, UCHAR ucDeviceType_, UCHAR ucTransmissionType_, ULONG ulResponseTime_= 0);
  160. BOOL SetChannelPeriod(UCHAR ucANTChannel_, USHORT usMessagePeriod_, ULONG ulResponseTime_ = 0);
  161. BOOL SetFastSearch(UCHAR ucANTChannel_, ULONG ulResponseTime_ = 0);
  162. BOOL SetChannelSearchTimeout(UCHAR ucANTChannel_, UCHAR ucSearchTimeout_, ULONG ulResponseTime_);
  163. BOOL SetLowPriorityChannelSearchTimeout(UCHAR ucANTChannel_, UCHAR ucSearchTimeout_, ULONG ulResponseTime_ = 0);
  164. BOOL SetChannelRFFrequency(UCHAR ucANTChannel_,UCHAR ucRFFrequency_, ULONG ulResponseTime_ = 0);
  165. BOOL SetAllChannelsTransmitPower(UCHAR ucTransmitPower_, ULONG ulResponseTime_ = 0);
  166. BOOL SetChannelTransmitPower(UCHAR ucANTChannel_,UCHAR ucTransmitPower_, ULONG ulResponseTime_ = 0);
  167. BOOL InitCWTestMode(ULONG ulResponseTime_ = 0);
  168. BOOL SetCWTestMode(UCHAR ucTransmitPower_, UCHAR ucRFFreq_, ULONG ulResponseTime_ = 0);
  169. BOOL AddChannelID(UCHAR ucANTChannel_, USHORT usDeviceNumber_, UCHAR ucDeviceType_, UCHAR ucTransmissionType_, UCHAR ucListIndex_, ULONG ulResponseTime_ = 0);
  170. BOOL AddCryptoID(UCHAR ucANTChannel_, UCHAR* pucData_, UCHAR ucListIndex_, ULONG ulResponseTime_ = 0);
  171. BOOL ConfigList(UCHAR ucANTChannel_, UCHAR ucListSize_, UCHAR ucExclude_, ULONG ulResponseTime_ = 0);
  172. BOOL ConfigCryptoList(UCHAR ucANTChannel_, UCHAR ucListSize_, UCHAR ucBlacklist_, ULONG ulResponseTime_ = 0);
  173. BOOL OpenRxScanMode(ULONG ulResponseTime_ = 0);
  174. BOOL SetProximitySearch(UCHAR ucANTChannel_, UCHAR ucSearchThreshold_, ULONG ulResponseTime_ = 0);
  175. BOOL ConfigEventBuffer(UCHAR ucConfig_, USHORT usSize_, USHORT usTime_, ULONG ulResponseTime_ = 0);
  176. BOOL ConfigEventFilter(USHORT usEventFilter_, ULONG ulResponseTime_ = 0);
  177. BOOL ConfigHighDutySearch(UCHAR ucEnable_, UCHAR ucSuppressionCycles_, ULONG ulResponseTime_ = 0);
  178. BOOL ConfigSelectiveDataUpdate(UCHAR ucANTChannel_, UCHAR ucSduConfig_, ULONG ulResponseTime_ = 0);
  179. BOOL SetSelectiveDataUpdateMask(UCHAR ucMaskNumber_, UCHAR* pucSduMask_, ULONG ulResponseTime_ = 0);
  180. BOOL ConfigUserNVM(USHORT usAddress_, UCHAR* pucData_, UCHAR ucSize_, ULONG ulResponseTime_ = 0);
  181. BOOL ConfigFrequencyAgility(UCHAR ucANTChannel_, UCHAR ucFreq1_, UCHAR ucFreq2_, UCHAR ucFreq3_, ULONG ulResponseTime_ = 0);
  182. BOOL SleepMessage(ULONG ulResponseTime_ = 0);
  183. BOOL CrystalEnable(ULONG ulResponseTime_ = 0);
  184. BOOL SetLibConfig(UCHAR ucLibConfigFlags_, ULONG ulResponseTime_ = 0);
  185. BOOL ConfigAdvancedBurst_ext(BOOL bEnable_, UCHAR ucMaxPacketLength_,
  186. ULONG ulRequiredFields_, ULONG ulOptionalFields_,
  187. USHORT usStallCount_, UCHAR ucRetryCount_, ULONG ulResponseTime_);
  188. BOOL ConfigAdvancedBurst(BOOL bEnable_, UCHAR ucMaxPacketLength_,
  189. ULONG ulRequiredFields_, ULONG ulOptionalFields_,
  190. ULONG ulResponseTime_);
  191. BOOL SetCryptoKey(UCHAR ucVolatileKeyIndex, UCHAR *pucKey_, ULONG ulResponseTime_ = 0);
  192. BOOL SetCryptoID(UCHAR *pucData_, ULONG ulResponseTime_ = 0);
  193. BOOL SetCryptoUserInfo(UCHAR *pucData_, ULONG ulResponseTime_ = 0);
  194. BOOL SetCryptoRNGSeed(UCHAR *pucData_, ULONG ulResponseTime_ = 0);
  195. BOOL SetCryptoInfo(UCHAR ucParameter_, UCHAR *pucData_, ULONG ulResponseTime_ = 0);
  196. BOOL LoadCryptoKeyNVMOp(UCHAR ucNVMKeyIndex_, UCHAR ucVolatileKeyIndex_, ULONG ulResponseTime_ = 0);
  197. BOOL StoreCryptoKeyNVMOp(UCHAR ucNVMKeyIndex_, UCHAR *pucKey_, ULONG ulResponseTime_ = 0);
  198. BOOL CryptoKeyNVMOp(UCHAR ucOperation_, UCHAR ucNVMKeyIndex_, UCHAR *pucData_, ULONG ulResponseTime_ = 0);
  199. /////////////////////////////////////////////////////////////////
  200. // Script Messages for SensRcore use
  201. /////////////////////////////////////////////////////////////////
  202. BOOL ScriptWrite( UCHAR ucSize_, UCHAR *pucCmdData_, ULONG ulResponseTime_ = 0);
  203. BOOL ScriptClear( ULONG ulResponseTime_ = 0);
  204. BOOL ScriptSetDefaultSector( UCHAR ucSectNumber_, ULONG ulResponseTime_ = 0);
  205. BOOL ScriptEndSector( ULONG ulResponseTime_ = 0);
  206. BOOL ScriptDump( ULONG ulResponseTime_ = 0);
  207. BOOL ScriptLock( ULONG ulResponseTime_ = 0);
  208. ////////////////////////////////////////////////////////////////
  209. // FIT1e Messages
  210. /////////////////////////////////////////////////////////////////
  211. BOOL FITSetFEState(UCHAR ucFEState_, ULONG ulResponseTime_ = 0);
  212. BOOL FITAdjustPairingSettings(UCHAR ucSearchLv_, UCHAR ucPairLv_, UCHAR ucTrackLv_, ULONG ulResponseTime_ = 0);
  213. /////////////////////////////////////////////////////////////////
  214. // Request messages
  215. /////////////////////////////////////////////////////////////////
  216. BOOL RequestMessage(UCHAR ucChannel_, UCHAR ucMessageID_);
  217. BOOL GetCapabilities(UCHAR *pucCapabilities_ = (UCHAR *)NULL, ULONG ulResponseTime_ = 0);
  218. BOOL GetChannelID(UCHAR ucANTChannel_, USHORT *pusDeviceNumber_ = (USHORT *)NULL, UCHAR *pucDeviceType_ = (UCHAR *)NULL, UCHAR *pucTransmitType_ = (UCHAR *)NULL, ULONG ulResponseTime_ = 0);
  219. BOOL GetChannelStatus(UCHAR ucANTChannel_, UCHAR *pucStatus_ = (UCHAR *)NULL, ULONG ulResponseTime_ = 0);
  220. BOOL SendRequest(UCHAR ucRequestedMesgID_, UCHAR ucANTChannel_, ANT_MESSAGE_ITEM *pstANTResponse_ = (ANT_MESSAGE_ITEM *)NULL, ULONG ulResponseTime_ = 0);
  221. BOOL SendUserNvmRequest(UCHAR ucRequestedMesgID_, UCHAR ucANTChannel_, ANT_MESSAGE_ITEM *pstANTResponse_ = (ANT_MESSAGE_ITEM *)NULL, USHORT usAddress_ = 0, UCHAR ucSize_ = 0, ULONG ulResponseTime_ = 0);
  222. BOOL SendFSRequest(UCHAR MesgSize, ANT_MESSAGE_ITEM *pstANTResponse_, FS_MESSAGE stMessage, ULONG ulResponseTime_ = 0);
  223. /////////////////////////////////////////////////////////////////
  224. // Control messages
  225. /////////////////////////////////////////////////////////////////
  226. BOOL ResetSystem(ULONG ulResponseTime_ = 0);
  227. BOOL OpenChannel(UCHAR ucANTChannel_, ULONG ulResponseTime_ = 0);
  228. BOOL CloseChannel(UCHAR ucANTChannel_, ULONG ulResponseTime_ = 0);
  229. BOOL RxExtMesgsEnable(UCHAR ucEnable_, ULONG ulResponseTime_ = 0);
  230. BOOL EnableLED(UCHAR ucEnable_, ULONG ulResponseTime_ = 0);
  231. BOOL SetRSSISearchThreshold(UCHAR ucANTChannel_, UCHAR ucSearchThreshold_, ULONG ulResponseTime_ = 0);
  232. BOOL EncryptedChannelEnable(UCHAR ucANTChannel_, UCHAR ucMode_, UCHAR ucVolatileKeyIndex_, UCHAR ucDecimationRate_, ULONG ulResponseTime_ = 0);
  233. /////////////////////////////////////////////////////////////////
  234. // The following are the synchronous RF event functions used to
  235. // update the synchronous data sent over a channel
  236. /////////////////////////////////////////////////////////////////
  237. BOOL SendBroadcastData(UCHAR ucANTChannel_,UCHAR *pucData_);
  238. BOOL SendBurstDataPacket(UCHAR ucANTChannelSeq_, UCHAR *pucData_);
  239. BOOL SendAdvancedBurstDataPacket(UCHAR ucANTChannelSeq_, UCHAR *pucData_, UCHAR ucStdPcktsPerSerialMsg_);
  240. ANTFRAMER_RETURN SendAcknowledgedData(UCHAR ucANTChannel_, UCHAR *pucData_, ULONG ulResponseTime_ = 0);
  241. BOOL SendExtBroadcastData(UCHAR ucANTChannel_, UCHAR *pucData_);
  242. BOOL SendExtAcknowledgedData(UCHAR ucANTChannel, UCHAR *pucData, ULONG ulResponseTime_ = 0);
  243. BOOL SendExtBurstTransferPacket(UCHAR ucANTChannelSeq_, UCHAR *pucData_);
  244. ANTFRAMER_RETURN SendExtBurstTransfer(UCHAR ucANTChannel_, UCHAR *pucData_, ULONG ulSize_, ULONG ulResponseTime_ = 0);
  245. ANTFRAMER_RETURN SendTransfer(UCHAR ucANTChannel_, UCHAR * pucData_, ULONG ulSize_, ULONG ulResponseTime_ = 0);
  246. ANTFRAMER_RETURN SendAdvancedTransfer(UCHAR ucANTChannel_, UCHAR * pucData_, ULONG ulSize_, UCHAR ucStdPcktsPerSerialMsg_, ULONG ulResponseTime_ = 0);
  247. ANTFRAMER_RETURN SendANTFSTransfer(UCHAR ucANTChannel_, UCHAR* pucHeader_, UCHAR* pucFooter_, UCHAR * pucData_, ULONG ulSize_, ULONG ulResponseTime_, volatile ULONG *pulProgress_);
  248. ANTFRAMER_RETURN SendANTFSClientTransfer(UCHAR ucANTChannel_, ANTFS_DATA* pstHeader_, ANTFS_DATA* pstFooter_, ANTFS_DATA* pstData_, ULONG ulResponseTime_, volatile ULONG *pulProgress_);
  249. //////////////////////////////////////////////////////////////////
  250. // USB Functions (platform specific)
  251. //////////////////////////////////////////////////////////////////
  252. BOOL SetUSBDescriptorString(UCHAR ucStringNum_, UCHAR* pucDescString_, UCHAR ucStringSize_, ULONG ulResponseTime_ = 0);
  253. BOOL GetDeviceUSBInfo(UCHAR ucDeviceNum_, UCHAR* pucProductString_, UCHAR* pucSerialString_, USHORT usBufferSize_);
  254. BOOL GetDeviceUSBPID(USHORT& usPid_);
  255. BOOL GetDeviceUSBVID(USHORT& usVid_);
  256. /////////////////////////////////////////////////////////////////
  257. /////////////////////////////////////////////////////////////////
  258. /////////////////////////////////////////////////////////////////
  259. // ANT_IntegratedClient Implementation
  260. /////////////////////////////////////////////////////////////////
  261. /////////////////////////////////////////////////////////////////
  262. /////////////////////////////////////////////////////////////////
  263. //Memory Device Commands
  264. BOOL InitEEPROMDevice(USHORT usPageSize_, UCHAR ucAddressConfig_, ULONG ulResponseTime_);
  265. //File System Commands
  266. BOOL InitFSMemory(ULONG ulResponseTime_);
  267. BOOL FormatFSMemory(USHORT usNumberOfSectors_, USHORT usPagesPerSector_, ULONG ulResponseTime_);
  268. BOOL SaveDirectory(ULONG ulResponseTime_);
  269. BOOL DirectoryRebuild(ULONG ulResponseTime_);
  270. BOOL FileDelete(UCHAR ucFileHandle_, ULONG ulResponseTime_);
  271. BOOL FileClose(UCHAR ucFileHandle_,ULONG ulResponseTime_);
  272. BOOL SetFileSpecificFlags(UCHAR ucFileHandle_, UCHAR ucFlags_,ULONG ulResponseTime_);
  273. UCHAR DirectoryReadLock(BOOL bLock_, ULONG ulResponseTime_);
  274. BOOL SetSystemTime(ULONG ulTime_, ULONG ulResponseTime_);
  275. //File System Requests
  276. ULONG GetUsedSpace(ULONG ulResponseTime_);
  277. ULONG GetFreeFSSpace(ULONG ulResponseTime_);
  278. USHORT FindFileIndex(UCHAR ucFileDataType_, UCHAR ucFileSubType_, USHORT usFileNumber_, ULONG ulResponseTime_);
  279. UCHAR ReadDirectoryAbsolute(ULONG ulOffset_, UCHAR ucSize_, UCHAR* pucBuffer_, ULONG ulResponseTime_);
  280. UCHAR DirectoryReadEntry (USHORT usFileIndex_, UCHAR* ucFileDirectoryBuffer_, ULONG ulResponseTime_);
  281. ULONG DirectoryGetSize(ULONG ulResponseTime_);
  282. USHORT FileCreate(USHORT usFileIndex_, UCHAR ucFileDataType_, ULONG ulFileIdentifier_, UCHAR ucFileDataTypeSpecificFlags_, UCHAR ucGeneralFlags, ULONG ulResponseTime_);
  283. UCHAR FileOpen(USHORT usFileIndex_, UCHAR ucOpenFlags_, ULONG ulResponseTime_);
  284. UCHAR FileReadAbsolute(UCHAR ucFileHandle_, ULONG ulOffset_, UCHAR ucReadSize_, UCHAR* pucReadBuffer_, ULONG ulResponseTime_);
  285. UCHAR FileReadRelative(UCHAR ucFileHandle_, UCHAR ucReadSize_, UCHAR *pucReadBuffer_, ULONG ulResponseTime_);
  286. UCHAR FileWriteAbsolute(UCHAR ucFileHandle_, ULONG ulFileOffset_, UCHAR ucWriteSize_, const UCHAR* pucWriteBuffer_, UCHAR* ucBytesWritten_, ULONG ulResponseTime_);
  287. UCHAR FileWriteRelative(UCHAR ucFileHandle_, UCHAR ucWriteSize_, const UCHAR* pucWriteBuffer_, UCHAR* ucBytesWritten_, ULONG ulResponseTime_);
  288. ULONG FileGetSize(UCHAR ucFileHandle_, ULONG ulResponseTime_);
  289. ULONG FileGetSizeInMem(UCHAR ucFileHandle_, ULONG ulResponseTime_);
  290. UCHAR FileGetSpecificFlags(UCHAR ucFileHandle_, ULONG ulResponseTime_);
  291. ULONG FileGetSystemTime(ULONG ulResponseTime_);
  292. //FS-Crypto Commands
  293. UCHAR CryptoAddUserKeyIndex(UCHAR ucIndex_, UCHAR* pucKey_, ULONG ulResponseTime_);
  294. UCHAR CryptoSetUserKeyIndex(UCHAR ucIndex_, ULONG ulResponseTime_);
  295. UCHAR CryptoSetUserKeyVal(UCHAR* pucKey_, ULONG ulResponseTime_);
  296. //FIT Commands
  297. UCHAR FitFileIntegrityCheck(UCHAR ucFileHandle_, ULONG ulResponseTime_);
  298. //ANT-FS Commands
  299. UCHAR OpenBeacon(ULONG ulResponseTime_);
  300. UCHAR CloseBeacon(ULONG ulResponseTime_);
  301. UCHAR ConfigBeacon(USHORT usDeviceType_, USHORT usManufacturer_, UCHAR ucAuthType_, UCHAR ucBeaconStatus_, ULONG ulResponseTime_);
  302. UCHAR SetFriendlyName(UCHAR ucLength_, const UCHAR* pucString_, ULONG ulResponseTime_);
  303. UCHAR SetPasskey(UCHAR ucLength_, const UCHAR* pucString_, ULONG ulResponseTime_);
  304. UCHAR SetBeaconState(UCHAR ucBeaconStatus_, ULONG ulResponseTime_);
  305. UCHAR PairResponse(BOOL bAccept_, ULONG ulResponseTime_);
  306. UCHAR SetLinkFrequency(UCHAR ucChannelNumber_, UCHAR ucFrequency_, ULONG ulResponseTime_);
  307. UCHAR SetBeaconTimeout(UCHAR ucTimeout_, ULONG ulResponseTime_);
  308. UCHAR SetPairingTimeout(UCHAR ucTimeout_, ULONG ulResponseTime_);
  309. UCHAR EnableRemoteFileCreate(BOOL bEnable_, ULONG ulResponseTime_);
  310. //ANT-FS Responses
  311. UCHAR GetCmdPipe(UCHAR ucOffset_, UCHAR ucReadSize_, UCHAR* pucReadBuffer_, ULONG ulResponseTime_);
  312. UCHAR SetCmdPipe(UCHAR ucOffset_, UCHAR ucWriteSize_, const UCHAR* pucWriteBuffer_, ULONG ulResponseTime_);
  313. //GetFSResponse
  314. UCHAR GetLastError();
  315. /////////////////////////////////////////////////////////////////
  316. /////////////////////////////////////////////////////////////////
  317. /////////////////////////////////////////////////////////////////
  318. friend class ANTMessageResponse;
  319. };
  320. class ANTMessageResponse
  321. {
  322. public:
  323. // Constuctor and Destructor
  324. ANTMessageResponse();
  325. ~ANTMessageResponse();
  326. BOOL Attach(UCHAR ucMessageID_, UCHAR *pucData_, UCHAR ucBytesToMatch_, DSIFramerANT * pclFramer_, DSI_CONDITION_VAR *pstCondResponseReady_ = (DSI_CONDITION_VAR*)NULL);
  327. void Remove();
  328. BOOL WaitForResponse(ULONG ulMilliseconds_);
  329. ///////////////////////////////////////////////////////////////
  330. // Variables
  331. ///////////////////////////////////////////////////////////////
  332. DSIFramerANT * pclFramer;
  333. ANTMessageResponse * pclNext;
  334. UCHAR ucBytesToMatch;
  335. ANT_MESSAGE_ITEM stMessageItem;
  336. DSI_CONDITION_VAR stCondResponseReady;
  337. DSI_CONDITION_VAR *pstCondResponseReady;
  338. BOOL bResponseReady;
  339. };
  340. #endif // !defined(DSI_FRAMER_ANT_HPP)