2
0

DLL_exports.cpp 79 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847
  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
  4. in compliance with this license.
  5. Copyright (c) Dynastream Innovations Inc. 2016
  6. All rights reserved.
  7. */
  8. /*
  9. **************************************************************************
  10. *
  11. * DESCRIPTION:
  12. *
  13. * This module is a wrapper for the ANT communications library, to expose
  14. * its functionality to the managed .Net environment. This module is designed
  15. * to be used together with the ANT_NET managed library, and it is not
  16. * intended to be used as a standalone interface. If you need access to
  17. * the full features of the ANT Libraries, statically link to the ANT_LIB
  18. * project.
  19. *
  20. **************************************************************************
  21. */
  22. #include "types.h"
  23. #include "macros.h"
  24. #include "version.h"
  25. #include "usb_device_handle.hpp"
  26. #include "dsi_serial_generic.hpp"
  27. #include "dsi_serial_vcp.hpp"
  28. #include "dsi_framer_ant.hpp"
  29. #include "dsi_debug.hpp"
  30. #include "antfs_host.hpp"
  31. #include "antfs_client_channel.hpp"
  32. #include "antfs_directory.h"
  33. #if defined(DSI_TYPES_WINDOWS)
  34. #define EXPORT extern "C" __declspec(dllexport)
  35. #elif defined(DSI_TYPES_MACINTOSH) || defined(DSI_TYPES_LINUX)
  36. #define EXPORT extern "C" __attribute__((visibility("default")))
  37. #endif
  38. #define MARSHALL_MESG_MAX_SIZE_VALUE ((UCHAR) 41) //This is so that the marshalling interface is always consistent, this wrapper will check to ensure that the data moving across is not truncated
  39. //MARSHALL_MESG_MAX_SIZE_VALUE must be >= MESG_MAX_SIZE_VALUE
  40. //Error return codes for reference
  41. #define ANT_INIT_ERROR_NO_ERROR 0
  42. #define ANT_INIT_ERROR_LIBRARY_ERROR -1
  43. #define ANT_INIT_ERROR_INVALID_TYPE -2
  44. #define ANT_INIT_ERROR_SERIAL_FAIL -3
  45. //Port Types: these defines are used to decide what type of connection to connect over
  46. #define PORT_TYPE_USB 0
  47. #define PORT_TYPE_COM 1
  48. //Framer Types: These are used to define which framing type to use
  49. #define FRAMER_TYPE_BASIC 0
  50. //Structs defined here so the marshalling is always a consistent size
  51. typedef struct
  52. {
  53. UCHAR ucMessageID;
  54. UCHAR aucData[MARSHALL_MESG_MAX_SIZE_VALUE];
  55. } MARSHALL_ANT_MESSAGE;
  56. typedef struct
  57. {
  58. UCHAR ucSize;
  59. MARSHALL_ANT_MESSAGE stANTMessage;
  60. } MARSHALL_ANT_MESSAGE_ITEM;
  61. ///////////////////////////////////////////////////////////////////////
  62. // Version info for this wrapper
  63. ///////////////////////////////////////////////////////////////////////
  64. EXPORT char* getUnmanagedVersion()
  65. {
  66. return SW_VER_WRAP;
  67. }
  68. ///////////////////////////////////////////////////////////////////////
  69. // Initializes and opens USB connection to the module specifying the device number and baudrate,
  70. // returning the intialized framer and serial objects
  71. ///////////////////////////////////////////////////////////////////////
  72. EXPORT INT ANT_Init(UCHAR ucUSBDeviceNum, ULONG ulBaudrate, DSISerial** returnSerialPtr, DSIFramerANT** returnFramerPtr, UCHAR ucPortType_, UCHAR ucSerialFrameType_)
  73. {
  74. //We need to ensure the MARSHALL_MESG_MAX_SIZE_VALUE is always greater than MESG_MAX_SIZE_VALUE or we will get into some serious memory trouble when we write and read message
  75. //We have to check this at runtime since the #defines are cast and the preprocessor can't evaluate the casts in a statement like #if(((UCHAR)3) > ((UCHAR)4))
  76. //We throw a message box because this is a compile-time problem that we want to make sure the developer notices
  77. if((MARSHALL_MESG_MAX_SIZE_VALUE) < (MESG_MAX_SIZE_VALUE))
  78. {
  79. MessageBox(NULL, "MARSHALL_MESG_MAX_SIZE_VALUE must be greater than or equal to MESG_MAX_SIZE_VALUE! The Unmanaged Wrapper must be fixed and recompiled. Also ensure the managed library MAX_SIZE parameter matches that of the wrapper.", "Unmanaged Wrapper Library Error", MB_ICONEXCLAMATION | MB_OK);
  80. return ANT_INIT_ERROR_LIBRARY_ERROR;
  81. }
  82. //Create Serial object.
  83. DSISerial* pclSerialObject = NULL;
  84. switch(ucPortType_)
  85. {
  86. case PORT_TYPE_USB:
  87. pclSerialObject = new DSISerialGeneric();
  88. break;
  89. case PORT_TYPE_COM:
  90. pclSerialObject = new DSISerialVCP();
  91. break;
  92. default: //Invalid port type selection
  93. return ANT_INIT_ERROR_INVALID_TYPE;
  94. }
  95. if(!pclSerialObject)
  96. return ANT_INIT_ERROR_LIBRARY_ERROR;
  97. //Initialize Serial object.
  98. if(!pclSerialObject->Init(ulBaudrate, ucUSBDeviceNum))
  99. return ANT_INIT_ERROR_LIBRARY_ERROR;
  100. //Create Framer object.
  101. DSIFramerANT* pclMessageObject = NULL;
  102. switch(ucSerialFrameType_)
  103. {
  104. case FRAMER_TYPE_BASIC:
  105. pclMessageObject = new DSIFramerANT(pclSerialObject);
  106. break;
  107. default:
  108. return ANT_INIT_ERROR_INVALID_TYPE;
  109. }
  110. if(!pclMessageObject)
  111. return ANT_INIT_ERROR_LIBRARY_ERROR;
  112. //Initialize Framer object.
  113. if(!pclMessageObject->Init())
  114. return ANT_INIT_ERROR_LIBRARY_ERROR;
  115. //Let Serial know about Framer.
  116. pclSerialObject->SetCallback(pclMessageObject);
  117. //Open Serial.
  118. if(!pclSerialObject->Open())
  119. return ANT_INIT_ERROR_SERIAL_FAIL;
  120. *returnSerialPtr = pclSerialObject;
  121. *returnFramerPtr = pclMessageObject;
  122. return ANT_INIT_ERROR_NO_ERROR;
  123. }
  124. /////////////////////////////////////////////////////////////////////////
  125. //// Initializes and opens USB connection to the module (automatic initialization)
  126. //// returning the intialized framer and serial objects
  127. /////////////////////////////////////////////////////////////////////////
  128. //EXPORT INT ANT_AutoInit(DSISerial** returnSerialPtr, DSIFramerANT** returnFramerPtr)
  129. //{
  130. // //We need to ensure the MARSHALL_MESG_MAX_SIZE_VALUE is always greater than MESG_MAX_SIZE_VALUE or we will get into some serious memory trouble when we write and read message
  131. // //We have to check this at runtime since the #defines are cast and the preprocessor can't evaluate the casts in a statement like #if(((UCHAR)3) > ((UCHAR)4))
  132. // //We throw a message box because this is a compile-time problem that we want to make sure the developer notices
  133. // if((MARSHALL_MESG_MAX_SIZE_VALUE) < (MESG_MAX_SIZE_VALUE))
  134. // {
  135. // MessageBox(NULL, "MARSHALL_MESG_MAX_SIZE_VALUE must be greater than or equal to MESG_MAX_SIZE_VALUE! The Unmanaged Wrapper must be fixed and recompiled. Also ensure the managed library MAX_SIZE parameter matches that of the wrapper.", "Unmanaged Wrapper Library Error", MB_ICONEXCLAMATION | MB_OK);
  136. // return ANT_INIT_ERROR_LIBRARY_ERROR;
  137. // }
  138. //
  139. // //Create Serial object.
  140. // DSISerial* pclSerialObject = new DSISerialGeneric();
  141. // if(!pclSerialObject)
  142. // return ANT_INIT_ERROR_LIBRARY_ERROR;
  143. //
  144. // // Initialize Serial object
  145. // if(!pclSerialObject->AutoInit())
  146. // return ANT_INIT_SERIAL_INIT_FAIL;
  147. //
  148. // //Create Framer object.
  149. // DSIFramerANT* pclMessageObject = new DSIFramerANT(pclSerialObject);
  150. // if(!pclMessageObject)
  151. // return ANT_INIT_ERROR_LIBRARY_ERROR;
  152. //
  153. // // Initialize Framer object
  154. // if(!pclMessageObject->Init())
  155. // return ANT_INIT_ERROR_LIBRARY_ERROR;
  156. //
  157. // //Let Serial know about Framer.
  158. // pclSerialObject->SetCallback(pclMessageObject);
  159. //
  160. // //Open Serial.
  161. // if(!pclSerialObject->Open())
  162. // return ANT_INIT_ERROR_SERIAL_OPEN_FAIL;
  163. //
  164. // *returnSerialPtr = pclSerialObject;
  165. // *returnFramerPtr = pclMessageObject;
  166. //
  167. // return ANT_INIT_ERROR_NO_ERROR;
  168. //}
  169. ///////////////////////////////////////////////////////////////////////
  170. // Called by the application to close the usb connection
  171. // Also deletes instantiated objects associated with pointer
  172. // Should be called in destructors only
  173. ///////////////////////////////////////////////////////////////////////
  174. EXPORT void ANT_Close(DSISerial* SerialPtr, DSIFramerANT* FramerPtr)
  175. {
  176. //Close all serial communication before we delete
  177. if(SerialPtr)
  178. {
  179. SerialPtr->Close();
  180. delete SerialPtr;
  181. }
  182. if(FramerPtr)
  183. {
  184. delete FramerPtr;
  185. }
  186. }
  187. ///////////////////////////////////////////////////////////////////////
  188. // Called by the application to reset the USB device
  189. ///////////////////////////////////////////////////////////////////////
  190. EXPORT BOOL ANT_USBReset(DSISerial* SerialPtr)
  191. {
  192. DSISerialGeneric *pclCastedSerial = (DSISerialGeneric*)SerialPtr;
  193. pclCastedSerial->USBReset();
  194. return(TRUE);
  195. }
  196. ///////////////////////////////////////////////////////////////////////
  197. // Called by the application to restart ANT on the module
  198. ///////////////////////////////////////////////////////////////////////
  199. EXPORT BOOL ANT_ResetSystem(DSIFramerANT* FramerPtr, ULONG ulResponseTime_)
  200. {
  201. return(FramerPtr->ResetSystem(ulResponseTime_));
  202. }
  203. ///////////////////////////////////////////////////////////////////////
  204. // Called by the application to set the network address for a given
  205. // module channel
  206. //!! This is (should be) a private network function
  207. ///////////////////////////////////////////////////////////////////////
  208. EXPORT BOOL ANT_SetNetworkKey_RTO(DSIFramerANT* FramerPtr, UCHAR ucNetNumber, UCHAR *pucKey, ULONG ulResponseTime_)
  209. {
  210. return(FramerPtr->SetNetworkKey(ucNetNumber, pucKey, ulResponseTime_));
  211. }
  212. ///////////////////////////////////////////////////////////////////////
  213. // Called by the application to assign a channel
  214. ///////////////////////////////////////////////////////////////////////
  215. EXPORT BOOL ANT_AssignChannel_RTO(DSIFramerANT* FramerPtr, UCHAR ucANTChannel, UCHAR ucChannelType_, UCHAR ucNetNumber, ULONG ulResponseTime_)
  216. {
  217. return(FramerPtr->AssignChannel(ucANTChannel, ucChannelType_, ucNetNumber, ulResponseTime_));
  218. }
  219. ///////////////////////////////////////////////////////////////////////
  220. // Called by the application to assign a channel using extended assignment
  221. ///////////////////////////////////////////////////////////////////////
  222. EXPORT BOOL ANT_AssignChannelExt_RTO(DSIFramerANT* FramerPtr, UCHAR ucANTChannel, UCHAR ucChannelType_, UCHAR ucNetNumber, UCHAR ucExtFlags_, ULONG ulResponseTime_)
  223. {
  224. UCHAR aucChannelType[] = {ucChannelType_, ucExtFlags_}; // Channel Type + Extended Assignment Byte
  225. return(FramerPtr->AssignChannelExt(ucANTChannel, aucChannelType, 2, ucNetNumber, ulResponseTime_));
  226. }
  227. ///////////////////////////////////////////////////////////////////////
  228. // Called by the application to unassign a channel
  229. ///////////////////////////////////////////////////////////////////////
  230. EXPORT BOOL ANT_UnAssignChannel_RTO(DSIFramerANT* FramerPtr,UCHAR ucANTChannel, ULONG ulResponseTime_)
  231. {
  232. return(FramerPtr->UnAssignChannel(ucANTChannel, ulResponseTime_));
  233. }
  234. ///////////////////////////////////////////////////////////////////////
  235. // Called by the application to set the channel ID
  236. ///////////////////////////////////////////////////////////////////////
  237. EXPORT BOOL ANT_SetChannelId_RTO(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, USHORT usDeviceNumber_, UCHAR ucDeviceType_, UCHAR ucTransmissionType_, ULONG ulResponseTime_)
  238. {
  239. return(FramerPtr->SetChannelID(ucANTChannel_, usDeviceNumber_, ucDeviceType_, ucTransmissionType_, ulResponseTime_));
  240. }
  241. ///////////////////////////////////////////////////////////////////////
  242. // Called by the application to set the messaging period
  243. ///////////////////////////////////////////////////////////////////////
  244. EXPORT BOOL ANT_SetChannelPeriod_RTO(DSIFramerANT* FramerPtr,UCHAR ucANTChannel_, USHORT usMesgPeriod_, ULONG ulResponseTime_)
  245. {
  246. return(FramerPtr->SetChannelPeriod(ucANTChannel_, usMesgPeriod_, ulResponseTime_));
  247. }
  248. ///////////////////////////////////////////////////////////////////////
  249. // Called by the application to set the RSSI threshold
  250. ///////////////////////////////////////////////////////////////////////
  251. EXPORT BOOL ANT_RSSI_SetSearchThreshold_RTO(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, UCHAR ucThreshold_, ULONG ulResponseTime_)
  252. {
  253. return(FramerPtr->SetRSSISearchThreshold(ucANTChannel_, ucThreshold_, ulResponseTime_));
  254. }
  255. ///////////////////////////////////////////////////////////////////////
  256. // Used to set Low Priority Search Timeout. Not available on AP1
  257. ///////////////////////////////////////////////////////////////////////
  258. EXPORT BOOL ANT_SetLowPriorityChannelSearchTimeout_RTO(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, UCHAR ucSearchTimeout_, ULONG ulResponseTime_)
  259. {
  260. return(FramerPtr->SetLowPriorityChannelSearchTimeout(ucANTChannel_, ucSearchTimeout_, ulResponseTime_));
  261. }
  262. ///////////////////////////////////////////////////////////////////////
  263. // Called by the application to set the search timeout for a particular
  264. // channel on the module
  265. ///////////////////////////////////////////////////////////////////////
  266. EXPORT BOOL ANT_SetChannelSearchTimeout_RTO(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, UCHAR ucSearchTimeout_, ULONG ulResponseTime_)
  267. {
  268. return(FramerPtr->SetChannelSearchTimeout(ucANTChannel_, ucSearchTimeout_, ulResponseTime_));
  269. }
  270. ///////////////////////////////////////////////////////////////////////
  271. // Called by the application to set the RF frequency for a given channel
  272. //!! This is (should be) a private network function
  273. ///////////////////////////////////////////////////////////////////////
  274. EXPORT BOOL ANT_SetChannelRFFreq_RTO(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, UCHAR ucRFFreq_, ULONG ulResponseTime_)
  275. {
  276. return(FramerPtr->SetChannelRFFrequency(ucANTChannel_, ucRFFreq_, ulResponseTime_));
  277. }
  278. ///////////////////////////////////////////////////////////////////////
  279. // Called by the application to set the transmit power for the module
  280. ///////////////////////////////////////////////////////////////////////
  281. EXPORT BOOL ANT_SetTransmitPower_RTO(DSIFramerANT* FramerPtr, UCHAR ucTransmitPower_, ULONG ulResponseTime_)
  282. {
  283. return(FramerPtr->SetAllChannelsTransmitPower(ucTransmitPower_, ulResponseTime_));
  284. }
  285. ///////////////////////////////////////////////////////////////////////
  286. // Called by the application to set the transmit power for a channel
  287. ///////////////////////////////////////////////////////////////////////
  288. EXPORT BOOL ANT_SetChannelTxPower_RTO(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, UCHAR ucTransmitPower_, ULONG ulResponseTime_)
  289. {
  290. return(FramerPtr->SetChannelTransmitPower(ucANTChannel_, ucTransmitPower_, ulResponseTime_));
  291. }
  292. ///////////////////////////////////////////////////////////////////////
  293. // Called by the application to configure the splitting of
  294. // advanced burst messages.
  295. ///////////////////////////////////////////////////////////////////////
  296. EXPORT BOOL ANT_ConfigureSplitAdvancedBursts(DSIFramerANT *FramerPtr, BOOL bEnableSplitBursts)
  297. {
  298. FramerPtr->SetSplitAdvBursts(bEnableSplitBursts);
  299. return(TRUE);
  300. }
  301. ///////////////////////////////////////////////////////////////////////
  302. // Called by the application to configure the advanced bursting format
  303. ///////////////////////////////////////////////////////////////////////
  304. EXPORT BOOL ANT_ConfigureAdvancedBurst_RTO(DSIFramerANT* FramerPtr, BOOL bEnable_, UCHAR ucMaxPacketLength_, ULONG ulRequiredFields_, ULONG ulOptionalFields_, ULONG ulResponseTime_)
  305. {
  306. return(FramerPtr->ConfigAdvancedBurst(bEnable_, ucMaxPacketLength_, ulRequiredFields_, ulOptionalFields_, ulResponseTime_));
  307. }
  308. ///////////////////////////////////////////////////////////////////////
  309. // Called by the application to configure the advanced bursting
  310. // format with extended details
  311. ///////////////////////////////////////////////////////////////////////
  312. EXPORT BOOL ANT_ConfigureAdvancedBurst_ext_RTO(DSIFramerANT* FramerPtr, BOOL bEnable_, UCHAR ucMaxPacketLength_, ULONG ulRequiredFields_, ULONG ulOptionalFields_, USHORT usStallCount_, UCHAR ucRetryCount_, ULONG ulResponseTime_)
  313. {
  314. return(FramerPtr->ConfigAdvancedBurst_ext(bEnable_, ucMaxPacketLength_, ulRequiredFields_, ulOptionalFields_, usStallCount_, ucRetryCount_, ulResponseTime_));
  315. }
  316. ///////////////////////////////////////////////////////////////////////
  317. // Called by the application to request a generic message
  318. ///////////////////////////////////////////////////////////////////////
  319. EXPORT BOOL ANT_RequestMessage(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, UCHAR ucMessageID_, MARSHALL_ANT_MESSAGE_ITEM* stResponse, ULONG ulResponseTime_)
  320. {
  321. ANT_MESSAGE_ITEM stTempResponse;
  322. USHORT usReturn = FramerPtr->SendRequest(ucMessageID_, ucANTChannel_, &stTempResponse, ulResponseTime_);
  323. stResponse->ucSize = stTempResponse.ucSize;
  324. memcpy(&(stResponse->stANTMessage), &(stTempResponse.stANTMessage), sizeof(ANT_MESSAGE)); //MARSHALL_ANT_MESSAGE will always be big enough (enforced by defines)
  325. return usReturn;
  326. }
  327. ///////////////////////////////////////////////////////////////////////
  328. // Called by the application to request a generic message (User Nvm)
  329. ///////////////////////////////////////////////////////////////////////
  330. EXPORT BOOL ANT_RequestUserNvmMessage(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, UCHAR ucMessageID_, MARSHALL_ANT_MESSAGE_ITEM* stResponse, USHORT usAddress_, UCHAR ucSize_, ULONG ulResponseTime_)
  331. {
  332. ANT_MESSAGE_ITEM stTempResponse;
  333. USHORT usReturn = FramerPtr->SendUserNvmRequest(ucMessageID_, ucANTChannel_, &stTempResponse, usAddress_, ucSize_, ulResponseTime_);
  334. stResponse->ucSize = stTempResponse.ucSize;
  335. memcpy(&(stResponse->stANTMessage), &(stTempResponse.stANTMessage), sizeof(ANT_MESSAGE)); //MARSHALL_ANT_MESSAGE will always be big enough (enforced by defines)
  336. return usReturn;
  337. }
  338. ///////////////////////////////////////////////////////////////////////
  339. // Called by the application to open an assigned channel
  340. ///////////////////////////////////////////////////////////////////////
  341. EXPORT BOOL ANT_OpenChannel_RTO(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, ULONG ulResponseTime_)
  342. {
  343. return(FramerPtr->OpenChannel(ucANTChannel_, ulResponseTime_));
  344. }
  345. ///////////////////////////////////////////////////////////////////////
  346. // Called by the application to close an opened channel
  347. ///////////////////////////////////////////////////////////////////////
  348. EXPORT BOOL ANT_CloseChannel_RTO(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, ULONG ulResponseTime_)
  349. {
  350. return(FramerPtr->CloseChannel(ucANTChannel_, ulResponseTime_));
  351. }
  352. ///////////////////////////////////////////////////////////////////////
  353. // Called by the application to construct and send a broadcast data message.
  354. // This message will be broadcast on the next synchronous channel period.
  355. ///////////////////////////////////////////////////////////////////////
  356. EXPORT BOOL ANT_SendBroadcastData(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, UCHAR *pucData_)
  357. {
  358. return(FramerPtr->SendBroadcastData(ucANTChannel_, pucData_));
  359. }
  360. ///////////////////////////////////////////////////////////////////////
  361. // Called by the application to construct and send an acknowledged data
  362. // mesg. This message will be transmitted on the next synchronous channel
  363. // period.
  364. // <returns>0=fail, 1=pass, 2=timeout, 3=cancelled
  365. ///////////////////////////////////////////////////////////////////////
  366. EXPORT UCHAR ANT_SendAcknowledgedData_RTO(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, UCHAR *pucData_, ULONG ulResponseTime_)
  367. {
  368. return (UCHAR)FramerPtr->SendAcknowledgedData( ucANTChannel_, pucData_, ulResponseTime_);
  369. }
  370. ///////////////////////////////////////////////////////////////////////
  371. // Used to send burst data using a block of data. This function manages
  372. // the entire burst including composing the individual burst packets
  373. // and their sequence numbers.
  374. // <returns>0=fail, 1=pass, 2=timeout, 3=cancelled
  375. ///////////////////////////////////////////////////////////////////////
  376. EXPORT UCHAR ANT_SendBurstTransfer_RTO(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, UCHAR *pucData_, ULONG ulNumBytes, ULONG ulResponseTime_)
  377. {
  378. return (UCHAR)FramerPtr->SendTransfer( ucANTChannel_, pucData_, ulNumBytes, ulResponseTime_);
  379. }
  380. ///////////////////////////////////////////////////////////////////////
  381. // Used to send advanced burst data using a block of data. This function manages
  382. // the entire burst including composing the individual burst packets
  383. // and their sequence numbers.
  384. // ucStdPcktsPerSerialMsg_ determines how many bytes of data are sent in each packet
  385. // over the serial port in multiples of packet size (the size of the packet payload at the
  386. // wireless level is determined by the pckt size set in the ConfigureAdvancedBurst command).
  387. // <returns>0=fail, 1=pass, 2=timeout, 3=cancelled, 4=invalid param
  388. ///////////////////////////////////////////////////////////////////////
  389. EXPORT UCHAR ANT_SendAdvancedBurstTransfer_RTO(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, UCHAR *pucData_, ULONG ulNumBytes, UCHAR ucStdPcktsPerSerialMsg_, ULONG ulResponseTime_)
  390. {
  391. return (UCHAR)FramerPtr->SendAdvancedTransfer(ucANTChannel_, pucData_, ulNumBytes, ucStdPcktsPerSerialMsg_, ulResponseTime_);
  392. }
  393. ///////////////////////////////////////////////////////////////////////
  394. // Called by the application to construct and send an extended broadcast data message.
  395. // This message will be broadcast on the next synchronous channel period.
  396. ///////////////////////////////////////////////////////////////////////
  397. EXPORT BOOL ANT_SendExtBroadcastData(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, USHORT usDeviceNumber_, UCHAR ucDeviceType_, UCHAR ucTransmitType_, UCHAR *pucData_)
  398. {
  399. UCHAR IDandData[MESG_EXT_DATA_SIZE-1];
  400. IDandData[0] = (UCHAR)(usDeviceNumber_ & 0xFF);
  401. IDandData[1] = (UCHAR)((usDeviceNumber_ >>8) & 0xFF);
  402. IDandData[2] = ucDeviceType_;
  403. IDandData[3] = ucTransmitType_;
  404. memcpy(IDandData+4, pucData_, ANT_STANDARD_DATA_PAYLOAD_SIZE);
  405. return(FramerPtr->SendExtBroadcastData(ucANTChannel_, IDandData));
  406. }
  407. ///////////////////////////////////////////////////////////////////////
  408. // Called by the application to construct and send an extended acknowledged data
  409. // mesg. This message will be transmitted on the next synchronous channel
  410. // period.
  411. // <returns>0=fail, 1=pass, 2=timeout, 3=cancelled
  412. ///////////////////////////////////////////////////////////////////////
  413. EXPORT UCHAR ANT_SendExtAcknowledgedData_RTO(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, USHORT usDeviceNumber_, UCHAR ucDeviceType_, UCHAR ucTransmitType_, UCHAR *pucData_, ULONG ulResponseTime_)
  414. {
  415. UCHAR IDandData[MESG_EXT_DATA_SIZE-1];
  416. IDandData[0] = (UCHAR)(usDeviceNumber_ & 0xFF);
  417. IDandData[1] = (UCHAR)((usDeviceNumber_ >>8) & 0xFF);
  418. IDandData[2] = ucDeviceType_;
  419. IDandData[3] = ucTransmitType_;
  420. memcpy(IDandData+4, pucData_, ANT_STANDARD_DATA_PAYLOAD_SIZE);
  421. return (UCHAR)FramerPtr->SendExtAcknowledgedData( ucANTChannel_, IDandData, ulResponseTime_);
  422. }
  423. ///////////////////////////////////////////////////////////////////////
  424. // Used to send extended burst data using a block of data. Proper sequence number
  425. // of packet is maintained by the function.
  426. // <returns>0=fail, 1=pass, 2=timeout, 3=cancelled
  427. ///////////////////////////////////////////////////////////////////////
  428. EXPORT UCHAR ANT_SendExtBurstTransfer_RTO(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, USHORT usDeviceNumber_, UCHAR ucDeviceType_, UCHAR ucTransmitType_, UCHAR *pucData_, ULONG ulNumBytes, ULONG ulResponseTime_)
  429. {
  430. UCHAR* IDandData;
  431. unsigned int extSize = (unsigned int)( (ulNumBytes/8) *12 ); //We add 4 bytes of ID info to every 8 bytes = 12
  432. //Handle data that is not sized in 8 byte segments
  433. int padNum = ulNumBytes%8;
  434. if(padNum != 0)
  435. extSize += 12; //Add another payload to fit the last bytes
  436. IDandData = new UCHAR[extSize];
  437. //Every 12 bytes must start with the 4 byte ID info
  438. for(ULONG i = 0; i < (extSize/12); ++i)
  439. {
  440. UCHAR* curBlock = IDandData + (i*12);
  441. curBlock[0] = (UCHAR)(usDeviceNumber_ & 0xFF);
  442. curBlock[1] = (UCHAR)((usDeviceNumber_ >>8) & 0xFF);
  443. curBlock[2] = ucDeviceType_;
  444. curBlock[3] = ucTransmitType_;
  445. memcpy(curBlock+4, pucData_+(i*8), min(8,ulNumBytes-(i*8)) ); //We copy 8 bytes, or the remaining bytes if we are at the end
  446. }
  447. UCHAR returnCode = (UCHAR)FramerPtr->SendExtBurstTransfer( ucANTChannel_, IDandData, extSize, ulResponseTime_);
  448. delete[] IDandData;
  449. return returnCode;
  450. }
  451. //////////////////////////////////////////////////////////////////////
  452. // Called by the application to configure and start CW test mode.
  453. // There is no way to turn off CW mode other than to do a reset on the module.
  454. /////////////////////////////////////////////////////////////////////
  455. EXPORT BOOL ANT_InitCWTestMode_RTO(DSIFramerANT* FramerPtr, ULONG ulResponseTime_)
  456. {
  457. return(FramerPtr->InitCWTestMode(ulResponseTime_));
  458. }
  459. //////////////////////////////////////////////////////////////////////
  460. // Called by the application to configure and start CW test mode.
  461. // There is no way to turn off CW mode other than to do a reset on the module.
  462. /////////////////////////////////////////////////////////////////////
  463. EXPORT BOOL ANT_SetCWTestMode_RTO(DSIFramerANT* FramerPtr, UCHAR ucTransmitPower_, UCHAR ucRFChannel_, ULONG ulResponseTime_)
  464. {
  465. return(FramerPtr->SetCWTestMode(ucTransmitPower_, ucRFChannel_, ulResponseTime_));
  466. }
  467. ///////////////////////////////////////////////////////////////////////
  468. // Add a channel ID to a channel's include/exclude ID list
  469. ///////////////////////////////////////////////////////////////////////
  470. EXPORT BOOL ANT_AddChannelID_RTO(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, USHORT usDeviceNumber_, UCHAR ucDeviceType_, UCHAR ucTransmissionType_, UCHAR ucListIndex_, ULONG ulResponseTime_)
  471. {
  472. return(FramerPtr->AddChannelID(ucANTChannel_, usDeviceNumber_, ucDeviceType_, ucTransmissionType_, ucListIndex_, ulResponseTime_));
  473. }
  474. ///////////////////////////////////////////////////////////////////////
  475. // Configure the size and type of a channel's include/exclude ID list
  476. ///////////////////////////////////////////////////////////////////////
  477. EXPORT BOOL ANT_ConfigList_RTO(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, UCHAR ucListSize_, UCHAR ucExclude_, ULONG ulResponseTime_)
  478. {
  479. return(FramerPtr->ConfigList(ucANTChannel_, ucListSize_, ucExclude_, ulResponseTime_));
  480. }
  481. ///////////////////////////////////////////////////////////////////////
  482. // Open Scan Mode
  483. ///////////////////////////////////////////////////////////////////////
  484. EXPORT BOOL ANT_OpenRxScanMode_RTO(DSIFramerANT* FramerPtr, ULONG ulResponseTime_)
  485. {
  486. return(FramerPtr->OpenRxScanMode(ulResponseTime_));
  487. }
  488. ///////////////////////////////////////////////////////////////////////
  489. // Called by the application to write NVM data (SensRcore script)
  490. ///////////////////////////////////////////////////////////////////////
  491. EXPORT BOOL ANT_Script_Write_RTO(DSIFramerANT* FramerPtr, UCHAR ucSize_, UCHAR *pucData_, ULONG ulResponseTime_)
  492. {
  493. return(FramerPtr->ScriptWrite(ucSize_, pucData_, ulResponseTime_ ));
  494. }
  495. ///////////////////////////////////////////////////////////////////////
  496. // Called by the application to clear NVM data (SensRcore script)
  497. ///////////////////////////////////////////////////////////////////////
  498. EXPORT BOOL ANT_Script_Clear_RTO(DSIFramerANT* FramerPtr, ULONG ulResponseTime_)
  499. {
  500. return(FramerPtr->ScriptClear(ulResponseTime_));
  501. }
  502. ///////////////////////////////////////////////////////////////////////
  503. // Called by the application to set default NVM sector (SensRcore script)
  504. ///////////////////////////////////////////////////////////////////////
  505. EXPORT BOOL ANT_Script_SetDefaultSector_RTO(DSIFramerANT* FramerPtr, UCHAR ucSectNumber_, ULONG ulResponseTime_)
  506. {
  507. return(FramerPtr->ScriptSetDefaultSector(ucSectNumber_, ulResponseTime_));
  508. }
  509. ///////////////////////////////////////////////////////////////////////
  510. // Called by the application to end NVM sector (SensRcore script)
  511. ///////////////////////////////////////////////////////////////////////
  512. EXPORT BOOL ANT_Script_EndSector_RTO(DSIFramerANT* FramerPtr, ULONG ulResponseTime_)
  513. {
  514. return(FramerPtr->ScriptEndSector(ulResponseTime_));
  515. }
  516. ///////////////////////////////////////////////////////////////////////
  517. // Called by the application to dump the contents of the
  518. // NVM (SensRcore script)
  519. ///////////////////////////////////////////////////////////////////////
  520. EXPORT BOOL ANT_Script_Dump_RTO(DSIFramerANT* FramerPtr, ULONG ulResponseTime_)
  521. {
  522. return(FramerPtr->ScriptDump(ulResponseTime_));
  523. }
  524. ///////////////////////////////////////////////////////////////////////
  525. // Called by the application to lock the contents of the NVM
  526. // (SensRcore script)
  527. ///////////////////////////////////////////////////////////////////////
  528. EXPORT BOOL ANT_Script_Lock_RTO(DSIFramerANT* FramerPtr, ULONG ulResponseTimeout_)
  529. {
  530. return(FramerPtr->ScriptLock(ulResponseTimeout_));
  531. }
  532. ///////////////////////////////////////////////////////////////////////
  533. // Called by the application to set the state of the FE
  534. // (FIT1e only)
  535. ///////////////////////////////////////////////////////////////////////
  536. EXPORT BOOL FIT_SetFEState_RTO(DSIFramerANT* FramerPtr, UCHAR ucFEState_, ULONG ulResponseTime_)
  537. {
  538. return(FramerPtr->FITSetFEState(ucFEState_, ulResponseTime_));
  539. }
  540. ///////////////////////////////////////////////////////////////////////
  541. // Called by the application to adjust the pairing distance
  542. // (FIT1e only)
  543. ///////////////////////////////////////////////////////////////////////
  544. EXPORT BOOL FIT_AdjustPairingSettings_RTO(DSIFramerANT* FramerPtr, UCHAR ucSearchLv_, UCHAR ucPairLv_, UCHAR ucTrackLv_, ULONG ulResponseTime_)
  545. {
  546. return(FramerPtr->FITAdjustPairingSettings(ucSearchLv_, ucPairLv_, ucTrackLv_, ulResponseTime_));
  547. }
  548. ///////////////////////////////////////////////////////////////////////
  549. // Used to force the module to use extended rx messages all the time
  550. ///////////////////////////////////////////////////////////////////////
  551. EXPORT BOOL ANT_RxExtMesgsEnable_RTO(DSIFramerANT* FramerPtr, UCHAR ucEnable_, ULONG ulResponseTimeout_)
  552. {
  553. return(FramerPtr->RxExtMesgsEnable(ucEnable_, ulResponseTimeout_));
  554. }
  555. ///////////////////////////////////////////////////////////////////////
  556. // Used to set a channel device ID to the module serial number
  557. ///////////////////////////////////////////////////////////////////////
  558. EXPORT BOOL ANT_SetSerialNumChannelId_RTO(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, UCHAR ucDeviceType_, UCHAR ucTransmissionType_, ULONG ulResponseTime_)
  559. {
  560. return(FramerPtr->SetSerialNumChannelId(ucANTChannel_, ucDeviceType_, ucTransmissionType_, ulResponseTime_));
  561. }
  562. ///////////////////////////////////////////////////////////////////////
  563. // Enables the module LED to flash on RF activity
  564. ///////////////////////////////////////////////////////////////////////
  565. EXPORT BOOL ANT_EnableLED_RTO(DSIFramerANT* FramerPtr, UCHAR ucEnable_, ULONG ulResponseTime_)
  566. {
  567. return(FramerPtr->EnableLED(ucEnable_, ulResponseTime_));
  568. }
  569. ///////////////////////////////////////////////////////////////////////
  570. // Called by the application to get the USB PID
  571. ///////////////////////////////////////////////////////////////////////
  572. EXPORT BOOL ANT_GetDeviceUSBPID(DSIFramerANT* FramerPtr, USHORT* pusPID_)
  573. {
  574. return(FramerPtr->GetDeviceUSBPID(*pusPID_));
  575. }
  576. ///////////////////////////////////////////////////////////////////////
  577. // Called by the application to get the USB VID
  578. ///////////////////////////////////////////////////////////////////////
  579. EXPORT BOOL ANT_GetDeviceUSBVID(DSIFramerANT* FramerPtr, USHORT* pusVID_)
  580. {
  581. return(FramerPtr->GetDeviceUSBVID(*pusVID_));
  582. }
  583. /////////////////////////////////////////////////////////////////////////
  584. //// Called by the application to get the product string and serial number string at a particular device number
  585. //// The buffers should have size = USB_MAX_STRLEN
  586. /////////////////////////////////////////////////////////////////////////
  587. EXPORT BOOL ANT_GetDeviceUSBInfo(DSIFramerANT* FramerPtr, UCHAR ucDeviceNum, UCHAR* pucProductString, UCHAR* pucSerialString)
  588. {
  589. return(FramerPtr->GetDeviceUSBInfo(ucDeviceNum, pucProductString, pucSerialString, USB_MAX_STRLEN));
  590. }
  591. /////////////////////////////////////////////////////////////////////////
  592. //// Called by the application to get the product serial string of the given device
  593. //// The buffer should have size = USB_MAX_STRLEN
  594. /////////////////////////////////////////////////////////////////////////
  595. EXPORT BOOL ANT_GetDeviceSerialString(DSISerialGeneric* SerialPtr, UCHAR* pucSerialString)
  596. {
  597. return SerialPtr->GetDeviceSerialString(pucSerialString, USB_MAX_STRLEN);
  598. }
  599. ///////////////////////////////////////////////////////////////////////
  600. // Called by the application to get the serial number
  601. ///////////////////////////////////////////////////////////////////////
  602. EXPORT ULONG ANT_GetDeviceSerialNumber(DSISerialGeneric* SerialPtr)
  603. {
  604. return SerialPtr->GetDeviceSerialNumber();
  605. }
  606. ///////////////////////////////////////////////////////////////////////
  607. // Returns the number of ANT devices detected
  608. ///////////////////////////////////////////////////////////////////////
  609. EXPORT ULONG ANT_GetNumDevices()
  610. {
  611. return USBDeviceHandle::GetAllDevices().GetSize();
  612. }
  613. ///////////////////////////////////////////////////////////////////////
  614. // Enable use of external 32KHz Crystal (AP2)
  615. ///////////////////////////////////////////////////////////////////////
  616. EXPORT BOOL ANT_CrystalEnable(DSIFramerANT* FramerPtr, ULONG ulResponseTime_)
  617. {
  618. return FramerPtr->CrystalEnable(ulResponseTime_);
  619. }
  620. ///////////////////////////////////////////////////////////////////////
  621. EXPORT BOOL ANT_SetLibConfig(DSIFramerANT* FramerPtr, UCHAR ucLibConfigFlags_, ULONG ulResponseTime_)
  622. {
  623. return FramerPtr->SetLibConfig(ucLibConfigFlags_, ulResponseTime_);
  624. }
  625. ///////////////////////////////////////////////////////////////////////
  626. // Configure proximity search (not on AP1 or AT3)
  627. ///////////////////////////////////////////////////////////////////////
  628. EXPORT BOOL ANT_SetProximitySearch(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, UCHAR ucSearchThreshold_, ULONG ulResponseTime_)
  629. {
  630. return FramerPtr->SetProximitySearch(ucANTChannel_, ucSearchThreshold_, ulResponseTime_);
  631. }
  632. ///////////////////////////////////////////////////////////////////////
  633. // Configure ANT Frequency Agility Functionality (not on AP1 or AT3)
  634. ///////////////////////////////////////////////////////////////////////
  635. EXPORT BOOL ANT_ConfigFrequencyAgility(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, UCHAR ucFreq1_, UCHAR ucFreq2_, UCHAR ucFreq3_, ULONG ulResponseTime_)
  636. {
  637. return FramerPtr->ConfigFrequencyAgility(ucANTChannel_, ucFreq1_, ucFreq2_, ucFreq3_, ulResponseTime_);
  638. }
  639. ///////////////////////////////////////////////////////////////////////
  640. // Configure ANT Event Buffer Functionality (only on USBm)
  641. ///////////////////////////////////////////////////////////////////////
  642. EXPORT BOOL ANT_ConfigEventBuffer(DSIFramerANT* FramerPtr, UCHAR ucConfig_, USHORT usSize_, USHORT usTime_, ULONG ulResponseTime_)
  643. {
  644. return FramerPtr->ConfigEventBuffer(ucConfig_, usSize_, usTime_, ulResponseTime_);
  645. }
  646. ///////////////////////////////////////////////////////////////////////
  647. // Configure ANT Event Filter Functionality (USBm and nRF5)
  648. ///////////////////////////////////////////////////////////////////////
  649. EXPORT BOOL ANT_ConfigEventFilter(DSIFramerANT* FramerPtr, USHORT usEventFilter_, ULONG ulResponseTime_)
  650. {
  651. return FramerPtr->ConfigEventFilter(usEventFilter_, ulResponseTime_);
  652. }
  653. ///////////////////////////////////////////////////////////////////////
  654. // Configure ANT High Duty Search (only USBm)
  655. ///////////////////////////////////////////////////////////////////////
  656. EXPORT BOOL ANT_ConfigHighDutySearch(DSIFramerANT* FramerPtr, UCHAR ucEnable_, UCHAR ucSuppressionCycles_, ULONG ulResponseTime_)
  657. {
  658. return FramerPtr->ConfigHighDutySearch(ucEnable_, ucSuppressionCycles_, ulResponseTime_);
  659. }
  660. ///////////////////////////////////////////////////////////////////////
  661. // Configure ANT Selective Data Update Functionality (only USBm)
  662. ///////////////////////////////////////////////////////////////////////
  663. EXPORT BOOL ANT_ConfigSelectiveDataUpdate(DSIFramerANT* FramerPtr, UCHAR ucChannel_, UCHAR ucSduConfig_, ULONG ulResponseTime_)
  664. {
  665. return FramerPtr->ConfigSelectiveDataUpdate(ucChannel_, ucSduConfig_, ulResponseTime_);
  666. }
  667. ///////////////////////////////////////////////////////////////////////
  668. // Set ANT Selective Data Update Mask (only USBm)
  669. ///////////////////////////////////////////////////////////////////////
  670. EXPORT BOOL ANT_SetSelectiveDataUpdateMask(DSIFramerANT* FramerPtr, UCHAR ucMaskNumber_, UCHAR* pucSduMask_, ULONG ulResponseTime_)
  671. {
  672. return FramerPtr->SetSelectiveDataUpdateMask(ucMaskNumber_, pucSduMask_, ulResponseTime_);
  673. }
  674. ///////////////////////////////////////////////////////////////////////
  675. // Configure ANT User NVM (only USBm)
  676. ///////////////////////////////////////////////////////////////////////
  677. EXPORT BOOL ANT_ConfigUserNVM(DSIFramerANT* FramerPtr, USHORT usAddress_, UCHAR* pucData_, UCHAR ucSize_, ULONG ulResponseTime_)
  678. {
  679. return FramerPtr->ConfigUserNVM(usAddress_, pucData_, ucSize_, ulResponseTime_);
  680. }
  681. ///////////////////////////////////////////////////////////////////////
  682. // Configure ANT Search Priority
  683. ///////////////////////////////////////////////////////////////////////
  684. EXPORT BOOL ANT_SetChannelSearchPriority(DSIFramerANT* FramerPtr, UCHAR ucChannel_, UCHAR ucPriorityLevel_, ULONG ulResponseTime_)
  685. {
  686. return FramerPtr->SetChannelSearchPriority(ucChannel_, ucPriorityLevel_, ulResponseTime_);
  687. }
  688. ///////////////////////////////////////////////////////////////////////
  689. // Configure ANT Search Sharing (only USBm)
  690. ///////////////////////////////////////////////////////////////////////
  691. EXPORT BOOL ANT_SetSearchSharingCycles(DSIFramerANT* FramerPtr, UCHAR ucChannel_, UCHAR ucSearchSharingCycles_, ULONG ulResponseTime_)
  692. {
  693. return FramerPtr->SetSearchSharingCycles(ucChannel_, ucSearchSharingCycles_, ulResponseTime_);
  694. }
  695. ///////////////////////////////////////////////////////////////////////
  696. // Enable channel encryption (only on USBm)
  697. ///////////////////////////////////////////////////////////////////////
  698. EXPORT BOOL ANT_EncryptedChannelEnable_RTO(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, UCHAR ucMode_, UCHAR ucVolatileKeyIndex_, UCHAR ucDecimationRate_, ULONG ulResponseTime_)
  699. {
  700. return FramerPtr->EncryptedChannelEnable(ucANTChannel_, ucMode_, ucVolatileKeyIndex_, ucDecimationRate_, ulResponseTime_);
  701. }
  702. ///////////////////////////////////////////////////////////////////////
  703. // Add encryption ID to ANT Lists (only on USBm)
  704. ///////////////////////////////////////////////////////////////////////
  705. EXPORT BOOL ANT_AddCryptoID_RTO(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, UCHAR* pucData_, UCHAR ucListIndex_, ULONG ulResponseTime_)
  706. {
  707. return FramerPtr->AddCryptoID(ucANTChannel_, pucData_, ucListIndex_, ulResponseTime_);
  708. }
  709. ///////////////////////////////////////////////////////////////////////
  710. // Configure ANT Encryption Master Blacklist/Whitelist (only on USBm)
  711. ///////////////////////////////////////////////////////////////////////
  712. EXPORT BOOL ANT_ConfigCryptoList_RTO(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, UCHAR ucListSize_, UCHAR ucBlacklist_, ULONG ulResponseTime_)
  713. {
  714. return FramerPtr->ConfigCryptoList(ucANTChannel_, ucListSize_, ucBlacklist_, ulResponseTime_);
  715. }
  716. ///////////////////////////////////////////////////////////////////////
  717. // Set the encryption key in volatile memory (only on USBm)
  718. ///////////////////////////////////////////////////////////////////////
  719. EXPORT BOOL ANT_SetCryptoKey_RTO(DSIFramerANT* FramerPtr, UCHAR ucVolatileKeyIndex, UCHAR *pucKey_, ULONG ulResponseTime_)
  720. {
  721. return FramerPtr->SetCryptoKey(ucVolatileKeyIndex, pucKey_, ulResponseTime_);
  722. }
  723. ///////////////////////////////////////////////////////////////////////
  724. // Set the encryption ID (only on USBm)
  725. ///////////////////////////////////////////////////////////////////////
  726. EXPORT BOOL ANT_SetCryptoID_RTO(DSIFramerANT* FramerPtr, UCHAR *pucData_, ULONG ulResponseTime_)
  727. {
  728. return FramerPtr->SetCryptoID(pucData_, ulResponseTime_);
  729. }
  730. ///////////////////////////////////////////////////////////////////////
  731. // Set the ANT Encrypted Slave User Information String (only on USBm)
  732. ///////////////////////////////////////////////////////////////////////
  733. EXPORT BOOL ANT_SetCryptoUserInfo_RTO(DSIFramerANT* FramerPtr, UCHAR *pucData_, ULONG ulResponseTime_)
  734. {
  735. return FramerPtr->SetCryptoUserInfo(pucData_, ulResponseTime_);
  736. }
  737. ///////////////////////////////////////////////////////////////////////
  738. // Set the Encryption RNG Seed (only on USBm)
  739. ///////////////////////////////////////////////////////////////////////
  740. EXPORT BOOL ANT_SetCryptoRNGSeed_RTO(DSIFramerANT* FramerPtr, UCHAR *pucData_, ULONG ulResponseTime_)
  741. {
  742. return FramerPtr->SetCryptoRNGSeed(pucData_, ulResponseTime_);
  743. }
  744. ///////////////////////////////////////////////////////////////////////
  745. // Set an encryption information parameter (only on USBm)
  746. ///////////////////////////////////////////////////////////////////////
  747. EXPORT BOOL ANT_SetCryptoInfo_RTO(DSIFramerANT* FramerPtr, UCHAR ucParameter_, UCHAR *pucData_, ULONG ulResponseTime_)
  748. {
  749. return FramerPtr->SetCryptoInfo(ucParameter_, pucData_, ulResponseTime_);
  750. }
  751. ///////////////////////////////////////////////////////////////////////
  752. // Load an encryption key into volatile memory from NVM (only on USBm)
  753. ///////////////////////////////////////////////////////////////////////
  754. EXPORT BOOL ANT_LoadCryptoKeyNVMOp_RTO(DSIFramerANT* FramerPtr, UCHAR ucNVMKeyIndex_, UCHAR ucVolatileKeyIndex_, ULONG ulResponseTime_)
  755. {
  756. return FramerPtr->LoadCryptoKeyNVMOp(ucNVMKeyIndex_, ucVolatileKeyIndex_, ulResponseTime_);
  757. }
  758. ///////////////////////////////////////////////////////////////////////
  759. // Store an encryption key into NVM (only on USBm)
  760. ///////////////////////////////////////////////////////////////////////
  761. EXPORT BOOL ANT_StoreCryptoKeyNVMOp_RTO(DSIFramerANT* FramerPtr, UCHAR ucNVMKeyIndex_, UCHAR *pucKey_, ULONG ulResponseTime_)
  762. {
  763. return FramerPtr->StoreCryptoKeyNVMOp(ucNVMKeyIndex_, pucKey_, ulResponseTime_);
  764. }
  765. ///////////////////////////////////////////////////////////////////////
  766. // Perform an ANT Encryption NVM Operation (only on USBm)
  767. ///////////////////////////////////////////////////////////////////////
  768. EXPORT BOOL ANT_CryptoKeyNVMOp_RTO(DSIFramerANT* FramerPtr, UCHAR ucOperation_, UCHAR ucNVMKeyIndex_, UCHAR *pucData_, ULONG ulResponseTime_)
  769. {
  770. return FramerPtr->CryptoKeyNVMOp(ucOperation_, ucNVMKeyIndex_, pucData_, ulResponseTime_);
  771. }
  772. ///////////////////////////////////////////////////////////////////////
  773. // Sends a generic message to ANT
  774. ///////////////////////////////////////////////////////////////////////
  775. EXPORT BOOL ANT_WriteMessage(DSIFramerANT* FramerPtr, MARSHALL_ANT_MESSAGE pstANTMessage, USHORT usMessageSize)
  776. {
  777. ANT_MESSAGE pstTempANTMessage;
  778. memcpy(&pstTempANTMessage, &pstANTMessage, sizeof(ANT_MESSAGE)); //Don't need to worry about missing data because if usMessageSize is too big WriteMessage returns false
  779. return FramerPtr->WriteMessage(&pstTempANTMessage, usMessageSize);
  780. }
  781. ///////////////////////////////////////////////////////////////////////
  782. // Set cancel parameter
  783. ///////////////////////////////////////////////////////////////////////
  784. EXPORT void ANT_SetCancelParameter(DSIFramerANT* FramerPtr, BOOL *pbCancel)
  785. {
  786. FramerPtr->SetCancelParameter(pbCancel);
  787. }
  788. ///////////////////////////////////////////////////////////////////////
  789. // Get channel number associated to a received ANT message
  790. ///////////////////////////////////////////////////////////////////////
  791. EXPORT UCHAR ANT_GetChannelNumber(DSIFramerANT* FramerPtr, MARSHALL_ANT_MESSAGE* pstANTMessage_)
  792. {
  793. ANT_MESSAGE stTempANTMessage;
  794. memcpy(&stTempANTMessage, pstANTMessage_, sizeof(ANT_MESSAGE)); // Responses from ANT would typically be shorter
  795. return FramerPtr->GetChannelNumber(&stTempANTMessage);
  796. }
  797. ///////////////////////////////////////////////////////////////////////
  798. // Request capabilities
  799. ///////////////////////////////////////////////////////////////////////
  800. EXPORT BOOL ANT_GetCapabilities(DSIFramerANT* FramerPtr, UCHAR* pucCapabilities_, UCHAR ucBufferSize_, ULONG ulResponseTime_)
  801. {
  802. if(ucBufferSize_ < MESG_CAPABILITIES_SIZE)
  803. {
  804. MessageBox(NULL, "ucBufferSize_ must be at least CAPABILITIES_BUFFER_SIZE! The Managed Library must be fixed and recompiled", "Unmanaged Wrapper Library Error", MB_ICONEXCLAMATION | MB_OK);
  805. return FALSE;
  806. }
  807. return FramerPtr->GetCapabilities(pucCapabilities_, ulResponseTime_);
  808. }
  809. ///////////////////////////////////////////////////////////////////////
  810. // Request Channel ID
  811. ///////////////////////////////////////////////////////////////////////
  812. EXPORT BOOL ANT_GetChannelID(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, USHORT *pusDeviceNumber_, UCHAR *pucDeviceType_, UCHAR *pucTransmitType_, ULONG ulResponseTime_)
  813. {
  814. return FramerPtr->GetChannelID(ucANTChannel_, pusDeviceNumber_, pucDeviceType_, pucTransmitType_, ulResponseTime_);
  815. }
  816. ///////////////////////////////////////////////////////////////////////
  817. // Request Channel Status
  818. ///////////////////////////////////////////////////////////////////////
  819. EXPORT BOOL ANT_GetChannelStatus(DSIFramerANT* FramerPtr, UCHAR ucANTChannel_, UCHAR *pucStatus_, ULONG ulResponseTime_)
  820. {
  821. return FramerPtr->GetChannelStatus(ucANTChannel_, pucStatus_, ulResponseTime_);
  822. }
  823. ///////////////////////////////////////////////////////////////////////
  824. //
  825. // ANT Callback Functions
  826. //
  827. ///////////////////////////////////////////////////////////////////////
  828. ///////////////////////////////////////////////////////////////////////
  829. EXPORT USHORT ANT_WaitForMessage(DSIFramerANT* FramerPtr, ULONG ulMilliseconds_)
  830. {
  831. return FramerPtr->WaitForMessage(ulMilliseconds_);
  832. }
  833. ///////////////////////////////////////////////////////////////////////
  834. EXPORT USHORT ANT_GetMessage(DSIFramerANT* FramerPtr, MARSHALL_ANT_MESSAGE* stResponse)
  835. {
  836. ANT_MESSAGE stTempResponse;
  837. USHORT usReturn = FramerPtr->GetMessage(&stTempResponse);
  838. memcpy(stResponse, &stTempResponse, sizeof(ANT_MESSAGE)); //MARSHALL_ANT_MESSAGE will always be big enough (enforced by defines)
  839. return usReturn;
  840. }
  841. ///////////////////////////////////////////////////////////////////////
  842. //
  843. // ANT Debug Logging Control
  844. //
  845. ///////////////////////////////////////////////////////////////////////
  846. ///////////////////////////////////////////////////////////////////////
  847. // Initializes and enables the debug logs
  848. ///////////////////////////////////////////////////////////////////////
  849. EXPORT BOOL ANT_EnableDebugLogging()
  850. {
  851. if(!DSIDebug::Init())
  852. return FALSE;
  853. DSIDebug::SetDebug(TRUE);
  854. return TRUE;
  855. }
  856. ///////////////////////////////////////////////////////////////////////
  857. // Disables and closes the debug logs
  858. ///////////////////////////////////////////////////////////////////////
  859. EXPORT void ANT_DisableDebugLogging()
  860. {
  861. DSIDebug::SetDebug(FALSE);
  862. DSIDebug::Close();
  863. }
  864. ///////////////////////////////////////////////////////////////////////
  865. // Set the directory the log files are saved to
  866. ///////////////////////////////////////////////////////////////////////
  867. EXPORT BOOL ANT_SetDebugLogDirectory(char* pcDirectory)
  868. {
  869. return DSIDebug::SetDirectory(pcDirectory);
  870. }
  871. ///////////////////////////////////////////////////////////////////////
  872. // Enable application specific logs for the currently executing thread
  873. ///////////////////////////////////////////////////////////////////////
  874. EXPORT BOOL ANT_DebugThreadInit(char* pucName_)
  875. {
  876. return DSIDebug::ThreadInit(pucName_);
  877. }
  878. ///////////////////////////////////////////////////////////////////////
  879. // Write a message in the log for the current thread
  880. ///////////////////////////////////////////////////////////////////////
  881. EXPORT BOOL ANT_DebugThreadWrite(char* pcMessage_)
  882. {
  883. return DSIDebug::ThreadWrite(pcMessage_);
  884. }
  885. ///////////////////////////////////////////////////////////////////////
  886. // Reset the time in the debug logs
  887. ///////////////////////////////////////////////////////////////////////
  888. EXPORT BOOL ANT_DebugResetTime()
  889. {
  890. return DSIDebug::ResetTime();
  891. }
  892. ///////////////////////////////////////////////////////////////////////
  893. //
  894. // ANT-FS Host
  895. //
  896. ///////////////////////////////////////////////////////////////////////
  897. ///////////////////////////////////////////////////////////////////////
  898. // Version info for the ANT-FS host library
  899. ///////////////////////////////////////////////////////////////////////
  900. EXPORT BOOL ANTFSHost_GetVersion(ANTFSHostChannel* pclHost, UCHAR* pucVersion_, UCHAR ucBufferSize_)
  901. {
  902. UCHAR aucLibVersion[255]; // Version of ANT-FS Library
  903. UCHAR ucSize;
  904. memset(aucLibVersion, 0, sizeof(aucLibVersion));
  905. // Get the ANT-FS Library Version
  906. ucSize = pclHost->GetVersion(aucLibVersion, sizeof(aucLibVersion));
  907. if(ucSize < ucBufferSize_)
  908. return STRNCPY((char*) pucVersion_, (char*) aucLibVersion, ucSize);
  909. else
  910. return STRNCPY((char*) pucVersion_, (char*) aucLibVersion, ucBufferSize_);
  911. }
  912. ///////////////////////////////////////////////////////////////////////
  913. // Creates the ANTFS Host object
  914. ///////////////////////////////////////////////////////////////////////
  915. EXPORT BOOL ANTFSHost_New(ANTFSHostChannel** returnHostPtr)
  916. {
  917. // Create ANT-FS Host object
  918. ANTFSHostChannel* pclHost = new ANTFSHostChannel();
  919. if(!pclHost)
  920. return(FALSE);
  921. *returnHostPtr = pclHost;
  922. return(TRUE);
  923. }
  924. ///////////////////////////////////////////////////////////////////////
  925. // Deletes the ANTFSHost object
  926. ////////////////////////////////////////////////////////////////////////
  927. EXPORT BOOL ANTFSHost_Delete(ANTFSHostChannel* pclHost)
  928. {
  929. delete pclHost;
  930. return(TRUE);
  931. }
  932. ///////////////////////////////////////////////////////////////////////
  933. // Initializes an ANT-FS host
  934. ///////////////////////////////////////////////////////////////////////
  935. EXPORT BOOL ANTFSHost_Init(ANTFSHostChannel* pclHost, DSIFramerANT* pclANT_, UCHAR ucChannel_)
  936. {
  937. // Initialize ANT-FS Host object
  938. return pclHost->Init(pclANT_, ucChannel_);
  939. }
  940. ///////////////////////////////////////////////////////////////////////
  941. // Obtains configurable ANT-FS host parameter values
  942. ///////////////////////////////////////////////////////////////////////
  943. EXPORT void ANTFSHost_GetCurrentConfig(ANTFSHostChannel* pclHost, ANTFS_CONFIG_PARAMETERS* pCfg_)
  944. {
  945. pclHost->GetCurrentConfig( pCfg_ );
  946. }
  947. ///////////////////////////////////////////////////////////////////////
  948. // Configures ANT-FS host parameter values
  949. ///////////////////////////////////////////////////////////////////////
  950. EXPORT BOOL ANTFSHost_SetCurrentConfig(ANTFSHostChannel* pclHost, const ANTFS_CONFIG_PARAMETERS* pCfg_)
  951. {
  952. return pclHost->SetCurrentConfig( pCfg_ );
  953. }
  954. ///////////////////////////////////////////////////////////////////////
  955. // Stops any pending actions, closes all devices down and cleans
  956. // up any dynamic memory being used by the library.
  957. ////////////////////////////////////////////////////////////////////////
  958. EXPORT BOOL ANTFSHost_Close(ANTFSHostChannel* pclHost)
  959. {
  960. pclHost->Close();
  961. return(TRUE);
  962. }
  963. /////////////////////////////////////////////////////////////////
  964. // Cancels any pending actions and returns the library to the
  965. // appropriate ANTFS layer
  966. /////////////////////////////////////////////////////////////////
  967. EXPORT BOOL ANTFSHost_Cancel(ANTFSHostChannel* pclHost)
  968. {
  969. pclHost->Cancel();
  970. return(TRUE);
  971. }
  972. /////////////////////////////////////////////////////////////////
  973. // Process device level notifications
  974. /////////////////////////////////////////////////////////////////
  975. EXPORT BOOL ANTFSHost_ProcessDeviceNotification(ANTFSHostChannel* pclHost, ANT_DEVICE_NOTIFICATION eCode_, void* pvParameter_)
  976. {
  977. pclHost->ProcessDeviceNotification(eCode_, pvParameter_);
  978. return(TRUE);
  979. }
  980. ///////////////////////////////////////////////////////////////////////
  981. // Called by the application to set the channel ID
  982. ///////////////////////////////////////////////////////////////////////
  983. EXPORT BOOL ANTFSHost_SetChannelID(ANTFSHostChannel* pclHost, UCHAR ucDeviceType_, UCHAR ucTransmissionType_)
  984. {
  985. pclHost->SetChannelID(ucDeviceType_, ucTransmissionType_);
  986. return(TRUE);
  987. }
  988. ///////////////////////////////////////////////////////////////////////
  989. // Called by the application to set the channel period
  990. ///////////////////////////////////////////////////////////////////////
  991. EXPORT BOOL ANTFSHost_SetChannelPeriod(ANTFSHostChannel* pclHost, USHORT usChannelPeriod_)
  992. {
  993. pclHost->SetChannelPeriod(usChannelPeriod_);
  994. return(TRUE);
  995. }
  996. ///////////////////////////////////////////////////////////////////////
  997. // Called by the application to set the network key for ANT-FS
  998. ///////////////////////////////////////////////////////////////////////
  999. EXPORT BOOL ANTFSHost_SetNetworkKey(ANTFSHostChannel* pclHost, UCHAR ucNetwork_, UCHAR *pucKey)
  1000. {
  1001. pclHost->SetNetworkKey(ucNetwork_, pucKey);
  1002. return(TRUE);
  1003. }
  1004. /////////////////////////////////////////////////////////////////
  1005. // Sets the value for the proximity bin setting for searching
  1006. /////////////////////////////////////////////////////////////////
  1007. EXPORT BOOL ANTFSHost_SetProximitySearch(ANTFSHostChannel* pclHost, UCHAR ucSearchThreshold_)
  1008. {
  1009. pclHost->SetProximitySearch(ucSearchThreshold_);
  1010. return(TRUE);
  1011. }
  1012. /////////////////////////////////////////////////////////////////
  1013. // Sets the serial number of the host
  1014. /////////////////////////////////////////////////////////////////
  1015. EXPORT BOOL ANTFSHost_SetSerialNumber(ANTFSHostChannel* pclHost, ULONG ulSerialNumber_)
  1016. {
  1017. pclHost->SetSerialNumber(ulSerialNumber_);
  1018. return(TRUE);
  1019. }
  1020. /////////////////////////////////////////////////////////////////
  1021. // Enables ping message to be sent to the remote device periodically
  1022. /////////////////////////////////////////////////////////////////
  1023. EXPORT BOOL ANTFSHost_EnablePing(ANTFSHostChannel* pclHost, BOOL bEnable_)
  1024. {
  1025. return pclHost->EnablePing(bEnable_);
  1026. }
  1027. ////////////////////////////////////////////////////////////////////////
  1028. // Process ANT messages
  1029. ////////////////////////////////////////////////////////////////////////
  1030. EXPORT BOOL ANTFSHost_ProcessMessage(ANTFSHostChannel* pclHost, MARSHALL_ANT_MESSAGE* pstMessage_, USHORT usMesgSize_)
  1031. {
  1032. ANT_MESSAGE stTempANTMessage;
  1033. memcpy(&stTempANTMessage, pstMessage_, sizeof(ANT_MESSAGE));
  1034. pclHost->ProcessMessage(&stTempANTMessage, usMesgSize_);
  1035. return TRUE;
  1036. }
  1037. /////////////////////////////////////////////////////////////////
  1038. // Returns ANT channel number assigned
  1039. /////////////////////////////////////////////////////////////////
  1040. EXPORT UCHAR ANTFSHost_GetChannelNumber(ANTFSHostChannel* pclHost)
  1041. {
  1042. return pclHost->GetChannelNumber();
  1043. }
  1044. /////////////////////////////////////////////////////////////////
  1045. // Returns TRUE if the ANT-FS engine is on
  1046. /////////////////////////////////////////////////////////////////
  1047. EXPORT BOOL ANTFSHost_GetEnabled(ANTFSHostChannel* pclHost)
  1048. {
  1049. return pclHost->GetEnabled();
  1050. }
  1051. /////////////////////////////////////////////////////////////////
  1052. // Returns the current host status
  1053. /////////////////////////////////////////////////////////////////
  1054. EXPORT ANTFS_HOST_STATE ANTFSHost_GetStatus(ANTFSHostChannel* pclHost)
  1055. {
  1056. return pclHost->GetStatus();
  1057. }
  1058. /////////////////////////////////////////////////////////////////
  1059. // Returns the connected device beacon antfs state
  1060. /////////////////////////////////////////////////////////////////
  1061. EXPORT UCHAR ANTFSHost_GetConnectedDeviceBeaconAntfsState(ANTFSHostChannel* pclHost)
  1062. {
  1063. return pclHost->GetConnectedDeviceBeaconAntfsState();
  1064. }
  1065. /////////////////////////////////////////////////////////////////
  1066. // Obtains the parameters of the most recently found device
  1067. /////////////////////////////////////////////////////////////////
  1068. EXPORT BOOL ANTFSHost_GetFoundDeviceParameters(ANTFSHostChannel* pclHost, ANTFS_DEVICE_PARAMETERS* pstDeviceParameters_, UCHAR* aucFriendlyName_, UCHAR* pucBufferSize_)
  1069. {
  1070. return pclHost->GetFoundDeviceParameters(pstDeviceParameters_, aucFriendlyName_, pucBufferSize_);
  1071. }
  1072. /////////////////////////////////////////////////////////////////
  1073. // Obtains the ANT channel ID of the most recently found device
  1074. /////////////////////////////////////////////////////////////////
  1075. EXPORT BOOL ANTFSHost_GetFoundDeviceChannelID(ANTFSHostChannel* pclHost, USHORT *pusDeviceNumber_, UCHAR *pucDeviceType_, UCHAR *pucTransmitType_)
  1076. {
  1077. return pclHost->GetFoundDeviceChannelID(pusDeviceNumber_, pucDeviceType_, pucTransmitType_);
  1078. }
  1079. /////////////////////////////////////////////////////////////////
  1080. // Gets the transfer progress of a pending or a complete upload
  1081. /////////////////////////////////////////////////////////////////
  1082. EXPORT BOOL ANTFSHost_GetUploadStatus(ANTFSHostChannel* pclHost, ULONG *pulByteProgress_, ULONG *pulTotalLength_)
  1083. {
  1084. return pclHost->GetUploadStatus(pulByteProgress_, pulTotalLength_);
  1085. }
  1086. /////////////////////////////////////////////////////////////////
  1087. // Gets the transfer progress of a pending or a complete download
  1088. /////////////////////////////////////////////////////////////////
  1089. EXPORT BOOL ANTFSHost_GetDownloadStatus(ANTFSHostChannel* pclHost, ULONG *pulByteProgress_, ULONG *pulTotalLength_)
  1090. {
  1091. return pclHost->GetDownloadStatus(pulByteProgress_, pulTotalLength_);
  1092. }
  1093. /////////////////////////////////////////////////////////////////
  1094. // Gets the received data from a transfer
  1095. // If *pvData is NULL, we will just retrieve the size
  1096. /////////////////////////////////////////////////////////////////
  1097. EXPORT BOOL ANTFSHost_GetTransferData(ANTFSHostChannel* pclHost, ULONG *pulDataSize_, void *pvData_)
  1098. {
  1099. return pclHost->GetTransferData(pulDataSize_, pvData_);
  1100. }
  1101. /////////////////////////////////////////////////////////////////
  1102. // Gets the size of the data available from the most recent download
  1103. /////////////////////////////////////////////////////////////////
  1104. EXPORT ULONG ANTFSHost_GetTransferSize(ANTFSHostChannel* pclHost)
  1105. {
  1106. ULONG ulFileSize = 0;
  1107. if(!pclHost->GetTransferData(&ulFileSize, NULL))
  1108. ulFileSize = 0;
  1109. return ulFileSize;
  1110. }
  1111. /////////////////////////////////////////////////////////////////
  1112. // Requests an ANT-FS session from a broadcast device we are
  1113. // currently connected to
  1114. /////////////////////////////////////////////////////////////////
  1115. EXPORT ANTFS_RETURN ANTFSHost_RequestSession(ANTFSHostChannel* pclHost, UCHAR ucBroadcastRadioFrequency_, UCHAR ucConnectRadioFrequency_)
  1116. {
  1117. return pclHost->RequestSession(ucBroadcastRadioFrequency_, ucConnectRadioFrequency_);
  1118. }
  1119. /////////////////////////////////////////////////////////////////
  1120. // Begins a search for ANTFS remote devices.
  1121. /////////////////////////////////////////////////////////////////
  1122. EXPORT ANTFS_RETURN ANTFSHost_SearchForDevice(ANTFSHostChannel* pclHost, UCHAR ucSearchRadioFrequency_, UCHAR ucConnectRadioFrequency_, USHORT usRadioChannelID_, BOOL bUseRequestPage_)
  1123. {
  1124. return pclHost->SearchForDevice(ucSearchRadioFrequency_, ucConnectRadioFrequency_, usRadioChannelID_, bUseRequestPage_);
  1125. }
  1126. /////////////////////////////////////////////////////////////////
  1127. // Request to pair with the connected remote device
  1128. /////////////////////////////////////////////////////////////////
  1129. EXPORT ANTFS_RETURN ANTFSHost_Authenticate(ANTFSHostChannel* pclHost, UCHAR ucAuthenticationType_, UCHAR* pucAuthString_, UCHAR ucLength_, UCHAR* pucResponseBuffer_, UCHAR* pucResponseBufferSize_, ULONG ulResponseTimeout_)
  1130. {
  1131. return pclHost->Authenticate(ucAuthenticationType_, pucAuthString_, ucLength_, pucResponseBuffer_, pucResponseBufferSize_, ulResponseTimeout_);
  1132. }
  1133. /////////////////////////////////////////////////////////////////
  1134. // Request a download of a file from the authenticated device
  1135. /////////////////////////////////////////////////////////////////
  1136. EXPORT ANTFS_RETURN ANTFSHost_Download(ANTFSHostChannel* pclHost, USHORT usFileIndex_, ULONG ulDataOffset_, ULONG ulMaxDataLength_, ULONG ulMaxBlockSize_)
  1137. {
  1138. return pclHost->Download(usFileIndex_, ulDataOffset_, ulMaxDataLength_, ulMaxBlockSize_);
  1139. }
  1140. /////////////////////////////////////////////////////////////////
  1141. // Request an upload of a file to the authenticated device
  1142. /////////////////////////////////////////////////////////////////
  1143. EXPORT ANTFS_RETURN ANTFSHost_Upload(ANTFSHostChannel* pclHost, USHORT usFileIndex_, ULONG ulDataOffset_, ULONG ulDataLength_, void *pvData_, BOOL bForceOffset_)
  1144. {
  1145. return pclHost->Upload(usFileIndex_, ulDataOffset_, ulDataLength_, pvData_, bForceOffset_);
  1146. }
  1147. /////////////////////////////////////////////////////////////////
  1148. // Request the erasure of a file on the authenticated remote device
  1149. /////////////////////////////////////////////////////////////////
  1150. EXPORT ANTFS_RETURN ANTFSHost_EraseData(ANTFSHostChannel* pclHost, USHORT usFileIndex_)
  1151. {
  1152. return pclHost->EraseData(usFileIndex_);
  1153. }
  1154. /////////////////////////////////////////////////////////////////
  1155. // Disconnect from a remote device. Optionally put that device
  1156. // on a blackout list for a period of time. Go back to specified state.
  1157. /////////////////////////////////////////////////////////////////
  1158. EXPORT ANTFS_RETURN ANTFSHost_Disconnect(ANTFSHostChannel* pclHost, USHORT usBlackoutTime_, UCHAR ucDisconnectType_, UCHAR ucUndiscoverableDuration_, UCHAR ucAppSpecificDuration_)
  1159. {
  1160. return pclHost->Disconnect(usBlackoutTime_, ucDisconnectType_, ucUndiscoverableDuration_, ucAppSpecificDuration_);
  1161. }
  1162. /////////////////////////////////////////////////////////////////
  1163. // Change radio frequency and channel period while in
  1164. // transport state
  1165. /////////////////////////////////////////////////////////////////
  1166. EXPORT ANTFS_RETURN ANTFSHost_SwitchFrequency(ANTFSHostChannel* pclHost, UCHAR ucRadioFrequency_, UCHAR ucChannelPeriod_)
  1167. {
  1168. return pclHost->SwitchFrequency(ucRadioFrequency_, ucChannelPeriod_);
  1169. }
  1170. /////////////////////////////////////////////////////////////////
  1171. // Adds a set of parameters for which to search to the internal
  1172. // search device list.
  1173. // Returns a handle the the search device entry. If the return
  1174. // value is NULL, the function failed adding the device entry.
  1175. /////////////////////////////////////////////////////////////////
  1176. EXPORT USHORT ANTFSHost_AddSearchDevice(ANTFSHostChannel* pclHost, ANTFS_DEVICE_PARAMETERS* pstDeviceSearchMask_, ANTFS_DEVICE_PARAMETERS* pstDeviceParameters_)
  1177. {
  1178. return pclHost->AddSearchDevice(pstDeviceSearchMask_, pstDeviceParameters_);
  1179. }
  1180. /////////////////////////////////////////////////////////////////
  1181. // Removes a device entry from the internal search list.
  1182. /////////////////////////////////////////////////////////////////
  1183. EXPORT BOOL ANTFSHost_RemoveSearchDevice(ANTFSHostChannel* pclHost, USHORT usHandle_)
  1184. {
  1185. pclHost->RemoveSearchDevice(usHandle_);
  1186. return(TRUE);
  1187. }
  1188. /////////////////////////////////////////////////////////////////
  1189. // Clears the internal search device list.
  1190. /////////////////////////////////////////////////////////////////
  1191. EXPORT BOOL ANTFSHost_ClearSearchDeviceList(ANTFSHostChannel* pclHost)
  1192. {
  1193. pclHost->ClearSearchDeviceList();
  1194. return(TRUE);
  1195. }
  1196. /////////////////////////////////////////////////////////////////
  1197. // Puts the device on a blackout list for a period of time
  1198. /////////////////////////////////////////////////////////////////
  1199. EXPORT BOOL ANTFSHost_Blackout(ANTFSHostChannel* pclHost, ULONG ulDeviceID_, USHORT usManufacturerID_, USHORT usDeviceType_, USHORT usBlackoutTime_)
  1200. {
  1201. return pclHost->Blackout(ulDeviceID_, usManufacturerID_, usDeviceType_, usBlackoutTime_);
  1202. }
  1203. /////////////////////////////////////////////////////////////////
  1204. // Remove the device from the blackout list
  1205. /////////////////////////////////////////////////////////////////
  1206. EXPORT BOOL ANTFSHost_RemoveBlackout(ANTFSHostChannel* pclHost, ULONG ulDeviceID_, USHORT usManufacturerID_, USHORT usDeviceType_)
  1207. {
  1208. return pclHost->RemoveBlackout(ulDeviceID_, usManufacturerID_, usDeviceType_);
  1209. }
  1210. /////////////////////////////////////////////////////////////////
  1211. // Clears the blackout list
  1212. /////////////////////////////////////////////////////////////////
  1213. EXPORT BOOL ANTFSHost_ClearBlackoutList(ANTFSHostChannel* pclHost)
  1214. {
  1215. pclHost->ClearBlackoutList();
  1216. return TRUE;
  1217. }
  1218. /////////////////////////////////////////////////////////////////
  1219. // Wait for a response from the ANTFSHost object
  1220. /////////////////////////////////////////////////////////////////
  1221. EXPORT ANTFS_HOST_RESPONSE ANTFSHost_WaitForResponse(ANTFSHostChannel* pclHost, ULONG ulMilliseconds_)
  1222. {
  1223. return pclHost->WaitForResponse(ulMilliseconds_);
  1224. }
  1225. ///////////////////////////////////////////////////////////////////////
  1226. //
  1227. // ANT-FS Client
  1228. //
  1229. ///////////////////////////////////////////////////////////////////////
  1230. ///////////////////////////////////////////////////////////////////////
  1231. // Version info for the ANT-FS client library
  1232. ///////////////////////////////////////////////////////////////////////
  1233. EXPORT BOOL ANTFSClient_GetVersion(UCHAR* pucVersion_, UCHAR ucBufferSize_)
  1234. {
  1235. char* aucLibVersion = getUnmanagedVersion(); // Version is the same as the unmanaged wrapper version
  1236. return STRNCPY((char*) pucVersion_, aucLibVersion, ucBufferSize_);
  1237. }
  1238. ///////////////////////////////////////////////////////////////////////
  1239. // Creates the ANTFS Client object
  1240. ///////////////////////////////////////////////////////////////////////
  1241. EXPORT BOOL ANTFSClient_New(ANTFSClientChannel** returnClientPtr)
  1242. {
  1243. // Create ANT-FS Client object
  1244. ANTFSClientChannel* pclClient = new ANTFSClientChannel();
  1245. if(!pclClient)
  1246. return(FALSE);
  1247. *returnClientPtr = pclClient;
  1248. return(TRUE);
  1249. }
  1250. ///////////////////////////////////////////////////////////////////////
  1251. // Deletes the ANTFSClient object
  1252. ////////////////////////////////////////////////////////////////////////
  1253. EXPORT BOOL ANTFSClient_Delete(ANTFSClientChannel* pclClient)
  1254. {
  1255. if(pclClient)
  1256. {
  1257. delete pclClient;
  1258. return(TRUE);
  1259. }
  1260. return(FALSE);
  1261. }
  1262. ///////////////////////////////////////////////////////////////////////
  1263. // Initializes an ANT-FS client device
  1264. ///////////////////////////////////////////////////////////////////////
  1265. EXPORT BOOL ANTFSClient_Init(ANTFSClientChannel* pclClient, DSIFramerANT* pclANT_, UCHAR ucANTChannel_)
  1266. {
  1267. // Initialize ANT-FS Client object
  1268. return pclClient->Init(pclANT_, ucANTChannel_);
  1269. }
  1270. ///////////////////////////////////////////////////////////////////////
  1271. // Stops any pending actions, closes all devices down and cleans
  1272. // up any dynamic memory being used by the library.
  1273. ////////////////////////////////////////////////////////////////////////
  1274. EXPORT BOOL ANTFSClient_Close(ANTFSClientChannel* pclClient)
  1275. {
  1276. //Close all communication and stop any pending actions
  1277. pclClient->Close();
  1278. return(TRUE);
  1279. }
  1280. /////////////////////////////////////////////////////////////////
  1281. // Cancels any pending actions and returns the library to the
  1282. // appropriate ANTFS layer
  1283. /////////////////////////////////////////////////////////////////
  1284. EXPORT BOOL ANTFSClient_Cancel(ANTFSClientChannel* pclClient)
  1285. {
  1286. pclClient->Cancel();
  1287. return(TRUE);
  1288. }
  1289. /////////////////////////////////////////////////////////////////
  1290. // Process device level notifications
  1291. /////////////////////////////////////////////////////////////////
  1292. EXPORT BOOL ANTFSClient_ProcessDeviceNotification(ANTFSClientChannel* pclClient, ANT_DEVICE_NOTIFICATION eCode_, void* pvParameter_)
  1293. {
  1294. pclClient->ProcessDeviceNotification(eCode_, pvParameter_);
  1295. return(TRUE);
  1296. }
  1297. ////////////////////////////////////////////////////////////////////////
  1298. // Set up ANTFSClient configuration parameters
  1299. ////////////////////////////////////////////////////////////////////////
  1300. EXPORT ANTFS_RETURN ANTFSClient_ConfigureClientParameters(ANTFSClientChannel* pclClient, ANTFS_CLIENT_PARAMS* pstInitParams_)
  1301. {
  1302. return pclClient->ConfigureClientParameters(pstInitParams_);
  1303. }
  1304. ////////////////////////////////////////////////////////////////////////
  1305. // Enable handling of pairing authentication requests
  1306. ////////////////////////////////////////////////////////////////////////
  1307. EXPORT ANTFS_RETURN ANTFSClient_SetPairingEnabled(ANTFSClientChannel* pclClient, BOOL bEnable_)
  1308. {
  1309. return pclClient->SetPairingEnabled(bEnable_);
  1310. }
  1311. ////////////////////////////////////////////////////////////////////////
  1312. // Enable uploads
  1313. ////////////////////////////////////////////////////////////////////////
  1314. EXPORT ANTFS_RETURN ANTFSClient_SetUploadEnabled(ANTFSClientChannel* pclClient, BOOL bEnable_)
  1315. {
  1316. return pclClient->SetUploadEnabled(bEnable_);
  1317. }
  1318. ////////////////////////////////////////////////////////////////////////
  1319. // Indicate whether data is available for download
  1320. ////////////////////////////////////////////////////////////////////////
  1321. EXPORT ANTFS_RETURN ANTFSClient_SetDataAvailable(ANTFSClientChannel* pclClient, BOOL bDataAvailable_)
  1322. {
  1323. return pclClient->SetDataAvailable(bDataAvailable_);
  1324. }
  1325. ////////////////////////////////////////////////////////////////////////
  1326. // Set up the time the client will wait without receiving any
  1327. // commands from the host before dropping back to the link state
  1328. ////////////////////////////////////////////////////////////////////////
  1329. EXPORT BOOL ANTFSClient_SetBeaconTimeout(ANTFSClientChannel* pclClient, UCHAR ucTimeout_)
  1330. {
  1331. pclClient->SetBeaconTimeout(ucTimeout_);
  1332. return(TRUE);
  1333. }
  1334. ////////////////////////////////////////////////////////////////////////
  1335. // Set up the time the client will wait without receiving any
  1336. // response from the application to a pairing request before rejecting it
  1337. ////////////////////////////////////////////////////////////////////////
  1338. EXPORT BOOL ANTFSClient_SetPairingTimeout(ANTFSClientChannel* pclClient, UCHAR ucTimeout_)
  1339. {
  1340. pclClient->SetPairingTimeout(ucTimeout_);
  1341. return(TRUE);
  1342. }
  1343. ////////////////////////////////////////////////////////////////////////
  1344. // Set up a friendly name for the ANT-FS client
  1345. ////////////////////////////////////////////////////////////////////////
  1346. EXPORT BOOL ANTFSClient_SetFriendlyName(ANTFSClientChannel* pclClient, UCHAR* pucFriendlyName_, UCHAR ucFriendlyNameSize_)
  1347. {
  1348. pclClient->SetFriendlyName(pucFriendlyName_, ucFriendlyNameSize_);
  1349. return(TRUE);
  1350. }
  1351. ////////////////////////////////////////////////////////////////////////
  1352. // Set up the pass key for the client to establish authenticated
  1353. // sessions with a host device
  1354. ////////////////////////////////////////////////////////////////////////
  1355. EXPORT BOOL ANTFSClient_SetPassKey(ANTFSClientChannel* pclClient, UCHAR* pucPassKey_, UCHAR ucPassKeySize_)
  1356. {
  1357. pclClient->SetPassKey(pucPassKey_, ucPassKeySize_);
  1358. return(TRUE);
  1359. }
  1360. ////////////////////////////////////////////////////////////////////////
  1361. // Set up the ANT Channel ID for the ANT-FS Client
  1362. ////////////////////////////////////////////////////////////////////////
  1363. EXPORT BOOL ANTFSClient_SetChannelID(ANTFSClientChannel* pclClient, UCHAR ucDeviceType_, UCHAR ucTransmissionType_)
  1364. {
  1365. pclClient->SetChannelID(ucDeviceType_, ucTransmissionType_);
  1366. return(TRUE);
  1367. }
  1368. ////////////////////////////////////////////////////////////////////////
  1369. // Set up a custom ANT Channel Period for the ANT-FS Client
  1370. ////////////////////////////////////////////////////////////////////////
  1371. EXPORT BOOL ANTFSClient_SetChannelPeriod(ANTFSClientChannel* pclClient, USHORT usChannelPeriod_)
  1372. {
  1373. pclClient->SetChannelPeriod(usChannelPeriod_);
  1374. return(TRUE);
  1375. }
  1376. ////////////////////////////////////////////////////////////////////////
  1377. // Set up the network key to use with the ANT-FS Client
  1378. ////////////////////////////////////////////////////////////////////////
  1379. EXPORT BOOL ANTFSClient_SetNetworkKey(ANTFSClientChannel* pclClient, UCHAR ucNetwork_, UCHAR* pucNetworkKey)
  1380. {
  1381. pclClient->SetNetworkKey(ucNetwork_, pucNetworkKey);
  1382. return(TRUE);
  1383. }
  1384. ////////////////////////////////////////////////////////////////////////
  1385. // Set up the transmit power for the ANT-FS Client Channel.
  1386. ////////////////////////////////////////////////////////////////////////
  1387. EXPORT BOOL ANTFSClient_SetTxPower(ANTFSClientChannel* pclClient, UCHAR ucPairingLv_, UCHAR ucConnectedLv_)
  1388. {
  1389. pclClient->SetTxPower(ucPairingLv_, ucConnectedLv_);
  1390. return(TRUE);
  1391. }
  1392. ////////////////////////////////////////////////////////////////////////
  1393. // Begins the channel configuration to transmit the ANT-FS beacon
  1394. ////////////////////////////////////////////////////////////////////////
  1395. EXPORT ANTFS_RETURN ANTFSClient_OpenBeacon(ANTFSClientChannel* pclClient)
  1396. {
  1397. return pclClient->OpenBeacon();
  1398. }
  1399. ////////////////////////////////////////////////////////////////////////
  1400. // Begins closing the ANT-FS beacon channel. Returns to specified state.
  1401. ////////////////////////////////////////////////////////////////////////
  1402. EXPORT ANTFS_RETURN ANTFSClient_CloseBeacon(ANTFSClientChannel* pclClient, BOOL bReturnToBroadcast_)
  1403. {
  1404. return pclClient->CloseBeacon(bReturnToBroadcast_);
  1405. }
  1406. ////////////////////////////////////////////////////////////////////////
  1407. // Process ANT messages
  1408. ////////////////////////////////////////////////////////////////////////
  1409. EXPORT BOOL ANTFSClient_ProcessMessage(ANTFSClientChannel* pclClient, MARSHALL_ANT_MESSAGE* pstMessage_, USHORT usMesgSize_)
  1410. {
  1411. ANT_MESSAGE stTempANTMessage;
  1412. memcpy(&stTempANTMessage, pstMessage_, sizeof(ANT_MESSAGE));
  1413. pclClient->ProcessMessage(&stTempANTMessage, usMesgSize_);
  1414. return TRUE;
  1415. }
  1416. /////////////////////////////////////////////////////////////////
  1417. // Returns TRUE if the ANT-FS engine is on
  1418. /////////////////////////////////////////////////////////////////
  1419. EXPORT BOOL ANTFSClient_GetEnabled(ANTFSClientChannel* pclClient)
  1420. {
  1421. return pclClient->GetEnabled();
  1422. }
  1423. /////////////////////////////////////////////////////////////////
  1424. // Returns ANT channel number assigned
  1425. /////////////////////////////////////////////////////////////////
  1426. EXPORT UCHAR ANTFSClient_GetChannelNumber(ANTFSClientChannel* pclClient)
  1427. {
  1428. return pclClient->GetChannelNumber();
  1429. }
  1430. ////////////////////////////////////////////////////////////////////////
  1431. // Returns the current client status.
  1432. ////////////////////////////////////////////////////////////////////////
  1433. EXPORT ANTFS_CLIENT_STATE ANTFSClient_GetStatus(ANTFSClientChannel* pclClient)
  1434. {
  1435. return pclClient->GetStatus();
  1436. }
  1437. ////////////////////////////////////////////////////////////////////////
  1438. // Copies at most ucBufferSize_ characters from the host's
  1439. // friendly name string (for the most recent session) into the
  1440. // supplied pucHostFriendlyName_ buffer.
  1441. ////////////////////////////////////////////////////////////////////////
  1442. EXPORT BOOL ANTFSClient_GetHostName(ANTFSClientChannel* pclClient, UCHAR *aucHostFriendlyName_, UCHAR *pucBufferSize_)
  1443. {
  1444. return pclClient->GetHostName(aucHostFriendlyName_, pucBufferSize_);
  1445. }
  1446. ////////////////////////////////////////////////////////////////////////
  1447. // Gets the full parameters for a download, upload or erase request
  1448. // received from the host
  1449. ////////////////////////////////////////////////////////////////////////
  1450. EXPORT BOOL ANTFSClient_GetRequestParameters(ANTFSClientChannel* pclClient, ANTFS_REQUEST_PARAMS* pstRequestParams_)
  1451. {
  1452. return pclClient->GetRequestParameters(pstRequestParams_);
  1453. }
  1454. ////////////////////////////////////////////////////////////////////////
  1455. // Gets the requested file index for a download, upload or erase request
  1456. ////////////////////////////////////////////////////////////////////////
  1457. EXPORT BOOL ANTFSClient_GetRequestedFileIndex(ANTFSClientChannel* pclClient, USHORT* pusIndex_)
  1458. {
  1459. return pclClient->GetRequestedFileIndex(pusIndex_);
  1460. }
  1461. ////////////////////////////////////////////////////////////////////////
  1462. // Gets the current status of an ongoing download
  1463. ////////////////////////////////////////////////////////////////////////
  1464. EXPORT BOOL ANTFSClient_GetDownloadStatus(ANTFSClientChannel* pclClient, ULONG *pulByteProgress_, ULONG *pulTotalLength_)
  1465. {
  1466. return pclClient->GetDownloadStatus(pulByteProgress_, pulTotalLength_);
  1467. }
  1468. /////////////////////////////////////////////////////////////////
  1469. // Gets the size of the data available from the most recent upload
  1470. /////////////////////////////////////////////////////////////////
  1471. EXPORT ULONG ANTFSClient_GetTransferSize(ANTFSClientChannel* pclClient)
  1472. {
  1473. ULONG ulFileSize = 0;
  1474. if(!pclClient->GetTransferData(&ulFileSize, NULL))
  1475. ulFileSize = 0;
  1476. return ulFileSize;
  1477. }
  1478. ////////////////////////////////////////////////////////////////////////
  1479. // Gets the received data from a transfer (upload).
  1480. ////////////////////////////////////////////////////////////////////////
  1481. EXPORT BOOL ANTFSClient_GetTransferData(ANTFSClientChannel* pclClient, ULONG *pulOffset_, ULONG *pulDataSize_ , void *pvData_)
  1482. {
  1483. return pclClient->GetTransferData(pulOffset_, pulDataSize_, pvData_);
  1484. }
  1485. ////////////////////////////////////////////////////////////////////////
  1486. // Gets the full parameters for a disconnect request
  1487. ////////////////////////////////////////////////////////////////////////
  1488. EXPORT BOOL ANTFSClient_GetDisconnectParameters(ANTFSClientChannel* pclClient, ANTFS_DISCONNECT_PARAMS* pstDisconnectParams_)
  1489. {
  1490. return pclClient->GetDisconnectParameters(pstDisconnectParams_);
  1491. }
  1492. ////////////////////////////////////////////////////////////////////////
  1493. // Sends a response to a pairing request.
  1494. ////////////////////////////////////////////////////////////////////////
  1495. EXPORT ANTFS_RETURN ANTFSClient_SendPairingResponse(ANTFSClientChannel* pclClient, BOOL bAccept_)
  1496. {
  1497. return pclClient->SendPairingResponse(bAccept_);
  1498. }
  1499. ////////////////////////////////////////////////////////////////////////
  1500. // Sends the response to a download request from an authenticated device
  1501. ////////////////////////////////////////////////////////////////////////
  1502. EXPORT ANTFS_RETURN ANTFSClient_SendDownloadResponse(ANTFSClientChannel* pclClient, UCHAR ucResponse_, ANTFS_DOWNLOAD_PARAMS* pstDownloadInfo_, ULONG ulDataLength_, void *pvData_)
  1503. {
  1504. return pclClient->SendDownloadResponse(ucResponse_, pstDownloadInfo_, ulDataLength_, pvData_);
  1505. }
  1506. ////////////////////////////////////////////////////////////////////////
  1507. // Sends the response to an upload request from an authenticated device
  1508. // TODO: Not implemented yet!!!
  1509. ////////////////////////////////////////////////////////////////////////
  1510. EXPORT ANTFS_RETURN ANTFSClient_SendUploadResponse(ANTFSClientChannel* pclClient, UCHAR ucResponse_, ANTFS_UPLOAD_PARAMS* pstUploadInfo_, ULONG ulDataLength_, void *pvData_)
  1511. {
  1512. return pclClient->SendUploadResponse(ucResponse_, pstUploadInfo_, ulDataLength_, pvData_);
  1513. }
  1514. ////////////////////////////////////////////////////////////////////////
  1515. // Sends a response to a request to erase a file from an
  1516. // authenticated remote device
  1517. ////////////////////////////////////////////////////////////////////////
  1518. EXPORT ANTFS_RETURN ANTFSClient_SendEraseResponse(ANTFSClientChannel* pclClient, UCHAR ucResponse_)
  1519. {
  1520. return pclClient->SendEraseResponse(ucResponse_);
  1521. }
  1522. ////////////////////////////////////////////////////////////////////////
  1523. // Wait for a response from the ANTFSClient object.
  1524. ////////////////////////////////////////////////////////////////////////
  1525. EXPORT ANTFS_CLIENT_RESPONSE ANTFSClient_WaitForResponse(ANTFSClientChannel* pclClient, ULONG ulMilliseconds_)
  1526. {
  1527. return pclClient->WaitForResponse(ulMilliseconds_);
  1528. }
  1529. ///////////////////////////////////////////////////////////////////////
  1530. //
  1531. // ANT-FS Directory
  1532. //
  1533. ///////////////////////////////////////////////////////////////////////
  1534. /////////////////////////////////////////////////////////////////
  1535. // Returns the number of file entries contained in the directory
  1536. /////////////////////////////////////////////////////////////////
  1537. EXPORT ULONG ANTFSDirectory_GetNumberOfFileEntries(void *pvDirectory_, ULONG ulDirectoryFileLength_)
  1538. {
  1539. return ANTFSDir_GetNumberOfFileEntries(pvDirectory_, ulDirectoryFileLength_);
  1540. }
  1541. /////////////////////////////////////////////////////////////////
  1542. // Fills in the directory structure with information from the
  1543. // directory file
  1544. /////////////////////////////////////////////////////////////////
  1545. EXPORT BOOL ANTFSDirectory_LookupFileEntry(void *pvDirectory_, ULONG ulDirectoryFileLength_, ULONG ulFileEntry_, ANTFSP_DIRECTORY *pusDirectoryStruct_)
  1546. {
  1547. return ANTFSDir_LookupFileEntry(pvDirectory_, ulDirectoryFileLength_, ulFileEntry_, pusDirectoryStruct_);
  1548. }
  1549. /////////////////////////////////////////////////////////////////
  1550. // Decodes the directory and generates a list of files that needs
  1551. // that needs to be downloaded.
  1552. /////////////////////////////////////////////////////////////////
  1553. EXPORT BOOL ANTFSDirectory_GetNewFileList(void *pvDirectory_, ULONG ulDirectoryFileLength_, USHORT *pusFileIndexList, USHORT * pusListLength)
  1554. {
  1555. return ANTFSDir_GetNewFileList(pvDirectory_, ulDirectoryFileLength_, pusFileIndexList, pusListLength);
  1556. }
  1557. /////////////////////////////////////////////////////////////////
  1558. // Fills in the directory structure with information from the
  1559. // directory file
  1560. /////////////////////////////////////////////////////////////////
  1561. EXPORT BOOL ANTFSDirectory_LookupFileIndex(void *pvDirectory_, ULONG ulDirectoryFileLength_, USHORT usFileIndex_, ANTFSP_DIRECTORY *pusDirectoryStruct_)
  1562. {
  1563. return ANTFSDir_LookupFileIndex(pvDirectory_, ulDirectoryFileLength_, usFileIndex_, pusDirectoryStruct_);
  1564. }