plcm3Api.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /**************************************************************************
  2. *
  3. * Filename: plcm3Api.h
  4. * Author: MAS
  5. * Description:
  6. *
  7. * This header defines the interface to driver routines for the
  8. * PicoLog CM3 Data Logger.
  9. *
  10. * Copyright © 2011-2018 Pico Technology Ltd. All rights reserved.
  11. *
  12. *************************************************************************/
  13. #ifndef __PLCM3API_H__
  14. #define __PLCM3API_H__
  15. #include <stdint.h>
  16. #include "PicoStatus.h"
  17. #ifdef PREF0
  18. #undef PREF0
  19. #endif
  20. #ifdef PREF1
  21. #undef PREF1
  22. #endif
  23. #ifdef PREF2
  24. #undef PREF2
  25. #endif
  26. #ifdef PREF3
  27. #undef PREF3
  28. #endif
  29. #ifdef __cplusplus
  30. #define PREF0 extern "C"
  31. #else
  32. #define PREF0
  33. #endif
  34. #ifdef WIN32
  35. // If you are dynamically linking plcm3.dll into your project #define DYNLINK
  36. // somewhere in your project before here.
  37. #ifdef DYNLINK
  38. #define PREF1 typedef
  39. #define PREF2
  40. #define PREF3(x) (__stdcall *x)
  41. #else
  42. #define PREF1
  43. #ifdef _USRDLL
  44. #define PREF2 __declspec(dllexport) __stdcall
  45. #else
  46. #define PREF2 __declspec(dllimport) __stdcall
  47. #endif
  48. #define PREF3(x) x
  49. #endif
  50. #else
  51. /* Define a 64-bit integer type */
  52. #ifdef DYNLINK
  53. #define PREF1 typedef
  54. #define PREF2
  55. #define PREF3(x) (*x)
  56. #else
  57. #ifdef _USRDLL
  58. #define PREF1 __attribute__((visibility("default")))
  59. #else
  60. #define PREF1
  61. #endif
  62. #define PREF2
  63. #define PREF3(x) x
  64. #endif
  65. #endif
  66. #define PLCM3_MIN_WIRES 2
  67. #define PLCM3_MAX_WIRES 4
  68. typedef enum enPLCM3Channels
  69. {
  70. PLCM3_CHANNEL_1 = 1,
  71. PLCM3_CHANNEL_2,
  72. PLCM3_CHANNEL_3,
  73. PLCM3_MAX_CHANNELS = PLCM3_CHANNEL_3
  74. } PLCM3_CHANNELS;
  75. typedef enum enPLCM3DataType
  76. {
  77. PLCM3_OFF,
  78. PLCM3_1_MILLIVOLT,
  79. PLCM3_10_MILLIVOLTS,
  80. PLCM3_100_MILLIVOLTS,
  81. PLCM3_VOLTAGE,
  82. PLCM3_MAX_DATA_TYPES
  83. } PLCM3_DATA_TYPES;
  84. typedef enum enPLCM3IpDetailsType
  85. {
  86. PLCM3_IDT_GET,
  87. PLCM3_IDT_SET,
  88. } PLCM3_IP_DETAILS_TYPE;
  89. typedef enum enPLCM3CommunicationType
  90. {
  91. PLCM3_CT_USB = 0x00000001,
  92. PLCM3_CT_ETHERNET = 0x00000002,
  93. PLCM3_CT_ALL = 0xFFFFFFFF
  94. }PLCM3_COMMUNICATION_TYPE;
  95. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (PLCM3Enumerate)
  96. (
  97. int8_t *details,
  98. uint32_t *length,
  99. PLCM3_COMMUNICATION_TYPE type
  100. );
  101. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (PLCM3OpenUnit)
  102. (
  103. int16_t * handle,
  104. int8_t * serial
  105. );
  106. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (PLCM3OpenUnitViaIp)
  107. (
  108. int16_t * handle,
  109. int8_t * serial,
  110. int8_t * ipAddress
  111. );
  112. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (PLCM3CloseUnit)
  113. (
  114. int16_t handle
  115. );
  116. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (PLCM3IpDetails)
  117. (
  118. int16_t handle,
  119. int16_t *enabled,
  120. int8_t *ipaddress,
  121. uint16_t *length,
  122. uint16_t *listeningPort,
  123. PLCM3_IP_DETAILS_TYPE type
  124. );
  125. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (PLCM3GetUnitInfo)
  126. (
  127. int16_t handle,
  128. int8_t * string,
  129. int16_t stringLength,
  130. int16_t * requiredSize,
  131. PICO_INFO info
  132. );
  133. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (PLCM3SetChannel)
  134. (
  135. int16_t handle,
  136. PLCM3_CHANNELS channel,
  137. PLCM3_DATA_TYPES type
  138. );
  139. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (PLCM3SetMains)
  140. (
  141. int16_t handle,
  142. uint16_t sixtyHertz
  143. );
  144. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (PLCM3GetValue)
  145. (
  146. int16_t handle,
  147. PLCM3_CHANNELS channel,
  148. int32_t * value
  149. );
  150. #endif