1
0

ant_dll.cpp 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. * VCS Information - autogenerated - do not modify
  10. *
  11. *
  12. **************************************************************************
  13. *
  14. *
  15. **************************************************************************
  16. */
  17. #include "types.h"
  18. //#include "antdefines.h"
  19. //#include "antmessage.h"
  20. #include "ant_dll.h"
  21. //////////////////////////////////////////////////////////////////////////////////
  22. // Public Variables
  23. //////////////////////////////////////////////////////////////////////////////////
  24. // Function Pointers
  25. P_ANT_INIT ANT_Init;
  26. P_ANT_CLOSE ANT_Close;
  27. P_ANT_ARF ANT_AssignResponseFunction;
  28. P_ANT_AEF ANT_AssignChannelEventFunction;
  29. P_ANT_UNASSIGN ANT_UnAssignChannel;
  30. P_ANT_ASSIGN ANT_AssignChannel;
  31. P_ANT_SETID ANT_SetChannelId;
  32. P_ANT_SETPER ANT_SetChannelPeriod;
  33. P_ANT_SETTIME ANT_SetChannelSearchTimeout;
  34. P_ANT_SETFREQ ANT_SetChannelRFFreq;
  35. P_ANT_SETKEY ANT_SetNetworkKey;
  36. P_ANT_SETPWR ANT_SetTransmitPower;
  37. P_ANT_RST ANT_ResetSystem;
  38. P_ANT_OPENCHNL ANT_OpenChannel;
  39. P_ANT_CLOSECHNL ANT_CloseChannel;
  40. P_ANT_REQMSG ANT_RequestMessage;
  41. P_ANT_ENABLEEXT ANT_RxExtMesgsEnable;
  42. P_ANT_TX ANT_SendBroadcastData;
  43. P_ANT_TXA ANT_SendAcknowledgedData;
  44. P_ANT_TXB ANT_SendBurstTransfer;
  45. P_ANT_ADDID ANT_AddChannelID;
  46. P_ANT_CONFIGLIST ANT_ConfigList;
  47. P_ANT_CHANTXPWR ANT_SetChannelTxPower;
  48. P_ANT_LOWPRITIME ANT_SetLowPriorityChannelSearchTimeout;
  49. P_ANT_SERIALID ANT_SetSerialNumChannelId;
  50. P_ANT_SETLED ANT_EnableLED;
  51. P_ANT_SETCRYSTAL ANT_CrystalEnable;
  52. P_ANT_SETAGILITY ANT_ConfigFrequencyAgility;
  53. P_ANT_SETPROX ANT_SetProximitySearch;
  54. P_ANT_SETSCAN ANT_OpenRxScanMode;
  55. P_ANT_SETSLEEP ANT_SleepMessage;
  56. P_ANT_CWINIT ANT_InitCWTestMode;
  57. P_ANT_CWMODE ANT_SetCWTestMode;
  58. P_ANT_TXEXT ANT_SendExtBroadcastData;
  59. P_ANT_TXAEXT ANT_SendExtAcknowledgedData;
  60. P_ANT_TXBEXT ANT_SendExtBurstTransferPacket;
  61. P_ANT_BURSTTFR ANT_SendExtBurstTransfer;
  62. //////////////////////////////////////////////////////////////////////////////////
  63. // Private Variables
  64. //////////////////////////////////////////////////////////////////////////////////
  65. static HMODULE hANTdll;
  66. static BOOL bLoaded = FALSE;
  67. //////////////////////////////////////////////////////////////////////////////////
  68. // Public Functions
  69. //////////////////////////////////////////////////////////////////////////////////
  70. ///////////////////////////////////////////////////////////////////////
  71. BOOL ANT_Load(void)
  72. {
  73. if (bLoaded)
  74. return TRUE;
  75. hANTdll = LoadLibraryA("ANT_DLL.dll");
  76. if (hANTdll == NULL)
  77. return FALSE;
  78. ANT_Init = (P_ANT_INIT) GetProcAddress(hANTdll, "ANT_Init");
  79. ANT_Close = (P_ANT_CLOSE) GetProcAddress(hANTdll, "ANT_Close");
  80. ANT_AssignResponseFunction = (P_ANT_ARF) GetProcAddress(hANTdll, "ANT_AssignResponseFunction");
  81. ANT_AssignChannelEventFunction = (P_ANT_AEF) GetProcAddress(hANTdll, "ANT_AssignChannelEventFunction");
  82. ANT_UnAssignChannel = (P_ANT_UNASSIGN) GetProcAddress(hANTdll, "ANT_UnAssignChannel");
  83. ANT_AssignChannel = (P_ANT_ASSIGN) GetProcAddress(hANTdll, "ANT_AssignChannel");
  84. ANT_SetChannelId =(P_ANT_SETID) GetProcAddress(hANTdll, "ANT_SetChannelId");
  85. ANT_SetChannelPeriod = (P_ANT_SETPER) GetProcAddress(hANTdll, "ANT_SetChannelPeriod");
  86. ANT_SetChannelSearchTimeout = (P_ANT_SETTIME) GetProcAddress(hANTdll, "ANT_SetChannelSearchTimeout");
  87. ANT_SetChannelRFFreq = (P_ANT_SETFREQ) GetProcAddress(hANTdll, "ANT_SetChannelRFFreq");
  88. ANT_SetNetworkKey = (P_ANT_SETKEY) GetProcAddress(hANTdll, "ANT_SetNetworkKey");
  89. ANT_SetTransmitPower = (P_ANT_SETPWR) GetProcAddress(hANTdll, "ANT_SetTransmitPower");
  90. ANT_ResetSystem = (P_ANT_RST) GetProcAddress(hANTdll, "ANT_ResetSystem");
  91. ANT_OpenChannel = (P_ANT_OPENCHNL) GetProcAddress(hANTdll, "ANT_OpenChannel");
  92. ANT_CloseChannel = (P_ANT_CLOSECHNL) GetProcAddress(hANTdll, "ANT_CloseChannel");
  93. ANT_RequestMessage = (P_ANT_REQMSG) GetProcAddress(hANTdll, "ANT_RequestMessage");
  94. ANT_RxExtMesgsEnable = (P_ANT_ENABLEEXT) GetProcAddress(hANTdll, "ANT_RxExtMesgsEnable");
  95. ANT_SendBroadcastData = (P_ANT_TX) GetProcAddress(hANTdll, "ANT_SendBroadcastData");
  96. ANT_SendAcknowledgedData = (P_ANT_TXA) GetProcAddress(hANTdll, "ANT_SendAcknowledgedData");
  97. ANT_SendBurstTransfer = (P_ANT_TXB) GetProcAddress(hANTdll, "ANT_SendBurstTransfer");
  98. ANT_AddChannelID = (P_ANT_ADDID) GetProcAddress(hANTdll, "ANT_AddChannelID");
  99. ANT_ConfigList = (P_ANT_CONFIGLIST) GetProcAddress(hANTdll, "ANT_ConfigList");
  100. ANT_SetChannelTxPower = (P_ANT_CHANTXPWR) GetProcAddress(hANTdll, "ANT_SetChannelTxPower");
  101. ANT_SetLowPriorityChannelSearchTimeout = (P_ANT_LOWPRITIME) GetProcAddress(hANTdll, "ANT_SetLowPriorityChannelSearchTimeout");
  102. ANT_SetSerialNumChannelId = (P_ANT_SERIALID) GetProcAddress(hANTdll, "ANT_SetSerialNumChannelId");
  103. ANT_EnableLED = (P_ANT_SETLED) GetProcAddress(hANTdll, "ANT_EnableLED");
  104. ANT_CrystalEnable = (P_ANT_SETCRYSTAL) GetProcAddress(hANTdll, "ANT_CrystalEnable");
  105. ANT_ConfigFrequencyAgility = (P_ANT_SETAGILITY) GetProcAddress(hANTdll, "ANT_ConfigFrequencyAgility");
  106. ANT_SetProximitySearch = (P_ANT_SETPROX) GetProcAddress(hANTdll, "ANT_SetProximitySearch");
  107. ANT_OpenRxScanMode = (P_ANT_SETSCAN) GetProcAddress(hANTdll, "ANT_OpenRxScanMode");
  108. ANT_SleepMessage = (P_ANT_SETSLEEP) GetProcAddress(hANTdll, "ANT_SleepMessage");
  109. ANT_InitCWTestMode = (P_ANT_CWINIT) GetProcAddress(hANTdll, "ANT_InitCWTestMode");
  110. ANT_SetCWTestMode = (P_ANT_CWMODE) GetProcAddress(hANTdll, "ANT_SetCWTestMode");
  111. ANT_SendExtBroadcastData = (P_ANT_TXEXT) GetProcAddress(hANTdll, "ANT_SendExtBroadcastData");
  112. ANT_SendExtAcknowledgedData = (P_ANT_TXAEXT) GetProcAddress(hANTdll, "ANT_SendExtAcknowledgedData");
  113. ANT_SendExtBurstTransferPacket = (P_ANT_TXBEXT) GetProcAddress(hANTdll, "ANT_SendExtBurstTransferPacket");
  114. ANT_SendExtBurstTransfer = (P_ANT_BURSTTFR) GetProcAddress(hANTdll, "ANT_SendExtBurstTransfer");
  115. if (ANT_Init == NULL)
  116. return FALSE;
  117. if (ANT_Close == NULL)
  118. return FALSE;
  119. if (ANT_AssignResponseFunction == NULL)
  120. return FALSE;
  121. if (ANT_AssignChannelEventFunction == NULL)
  122. return FALSE;
  123. if (ANT_UnAssignChannel == NULL)
  124. return FALSE;
  125. if (ANT_AssignChannel == NULL)
  126. return FALSE;
  127. if (ANT_SetChannelId == NULL)
  128. return FALSE;
  129. if (ANT_SetChannelPeriod == NULL)
  130. return FALSE;
  131. if (ANT_SetChannelSearchTimeout == NULL)
  132. return FALSE;
  133. if (ANT_SetChannelRFFreq == NULL)
  134. return FALSE;
  135. if (ANT_SetNetworkKey == NULL)
  136. return FALSE;
  137. if (ANT_SetTransmitPower == NULL)
  138. return FALSE;
  139. if (ANT_ResetSystem == NULL)
  140. return FALSE;
  141. if (ANT_OpenChannel == NULL)
  142. return FALSE;
  143. if (ANT_CloseChannel == NULL)
  144. return FALSE;
  145. if (ANT_RequestMessage == NULL)
  146. return FALSE;
  147. if (ANT_SendBroadcastData == NULL)
  148. return FALSE;
  149. if (ANT_SendAcknowledgedData == NULL)
  150. return FALSE;
  151. if (ANT_SendBurstTransfer == NULL)
  152. return FALSE;
  153. if(ANT_RxExtMesgsEnable == NULL)
  154. return FALSE;
  155. if(ANT_AddChannelID == NULL)
  156. return FALSE;
  157. if(ANT_ConfigList == NULL)
  158. return FALSE;
  159. if(ANT_SetChannelTxPower == NULL)
  160. return FALSE;
  161. if(ANT_SetLowPriorityChannelSearchTimeout == NULL)
  162. return FALSE;
  163. if(ANT_SetSerialNumChannelId == NULL)
  164. return FALSE;
  165. if(ANT_EnableLED == NULL)
  166. return FALSE;
  167. if(ANT_CrystalEnable == NULL)
  168. return FALSE;
  169. if(ANT_ConfigFrequencyAgility == NULL)
  170. return FALSE;
  171. if(ANT_SetProximitySearch == NULL)
  172. return FALSE;
  173. if(ANT_OpenRxScanMode == NULL)
  174. return FALSE;
  175. if(ANT_SleepMessage == NULL)
  176. return FALSE;
  177. if(ANT_InitCWTestMode == NULL)
  178. return FALSE;
  179. if(ANT_SetCWTestMode == NULL)
  180. return FALSE;
  181. if(ANT_SendExtBroadcastData == NULL)
  182. return FALSE;
  183. if(ANT_SendExtAcknowledgedData == NULL)
  184. return FALSE;
  185. if(ANT_SendExtBurstTransferPacket == NULL)
  186. return FALSE;
  187. if(ANT_SendExtBurstTransfer == NULL)
  188. return FALSE;
  189. bLoaded = TRUE;
  190. return TRUE;
  191. }
  192. ///////////////////////////////////////////////////////////////////////
  193. void ANT_UnLoad(void)
  194. {
  195. if (hANTdll != NULL)
  196. {
  197. FreeLibrary(hANTdll);
  198. }
  199. bLoaded = FALSE;
  200. }