Module_Payment_Enegate.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * Module_Payment_Enegate.h
  3. *
  4. * Created on: 2022/5/4
  5. * Author: folus
  6. */
  7. #ifndef MODULE_PAYMENT_ENEGATE_H_
  8. #define MODULE_PAYMENT_ENEGATE_H_
  9. #include <sys/time.h>
  10. #include <sys/timeb.h>
  11. #include <sys/types.h>
  12. #include <sys/stat.h>
  13. #include <sys/types.h>
  14. #include <sys/ioctl.h>
  15. #include <sys/socket.h>
  16. #include <sys/ipc.h>
  17. #include <sys/shm.h>
  18. #include <sys/shm.h>
  19. #include <sys/mman.h>
  20. #include <linux/wireless.h>
  21. #include <arpa/inet.h>
  22. #include <netinet/in.h>
  23. #include <unistd.h>
  24. #include <stdarg.h>
  25. #include <stdio.h>
  26. #include <stdlib.h>
  27. #include <unistd.h>
  28. #include <fcntl.h>
  29. #include <termios.h>
  30. #include <errno.h>
  31. #include <errno.h>
  32. #include <string.h>
  33. #include <time.h>
  34. #include <ctype.h>
  35. #include <ifaddrs.h>
  36. #include <math.h>
  37. #include <limits.h>
  38. #include <stdint.h>
  39. //#define DEBUG
  40. #include "define.h"
  41. #define TTY_PORT "/dev/ttyS2"
  42. #define ID_OFFSET 2
  43. #define FIRMWARE_VERSION "D0.01.P0"
  44. #define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
  45. #define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
  46. #define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
  47. #define is_error(ptr) ((unsigned long)ptr > (unsigned long)-4000L)
  48. #define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
  49. #define PASS 1
  50. #define FAIL -1
  51. #define ON 1
  52. #define OFF 0
  53. #define YES 1
  54. #define NO 0
  55. struct SysConfigAndInfo *ShmSysConfigAndInfo;
  56. struct StatusCodeData *ShmStatusCodeData;
  57. struct OCPP16Data *ShmOCPP16Data;
  58. enum TIMER
  59. {
  60. TIMER_COMM_TIMEOUT,
  61. TIMER_UPDATE_RTC,
  62. TIMER_CNT
  63. };
  64. enum GUN_TYPE
  65. {
  66. GUN_TYPE_UNKNOWN=0,
  67. GUN_TYPE_CHAdeMO,
  68. GUN_TYPE_CCS,
  69. GUN_TYPE_GBT,
  70. GUN_TYPE_DO,
  71. GUN_TYPE_AC
  72. };
  73. typedef struct MESSAGE
  74. {
  75. int size;
  76. uint8_t buffer[64];
  77. }Message;
  78. enum MESSAGE_HEADER
  79. {
  80. SOH=0x01,
  81. LF=0x0a,
  82. CR=0x0d,
  83. STX=0x1b,
  84. ACK=0x06,
  85. NAK=0x15
  86. };
  87. enum HOST_COMMAND
  88. {
  89. HOST_CMD_GET_STATUS=1000,
  90. HOST_CMD_AUTH_PASS=3000,
  91. HOST_CMD_AUTH_FAIL=3001,
  92. HOST_CMD_SESSION_STOP=4000,
  93. HOST_CMD_PAUSE_ENABLE=100,
  94. HOST_CMD_PAUSE_DISABLE=111,
  95. HOST_CMD_AUTO_START_ENABLE=200,
  96. HOST_CMD_AUTOSTART_DIABLE=222,
  97. HOST_CMD_AUTH_CHECKING=9000,
  98. HOST_CMD_AUTH_CANCEL=9001,
  99. HOST_CMD_GET_SELECTED_ID=9301,
  100. HOST_CMD_SET_SERVICE_TIME=9200
  101. };
  102. #endif /* MODULE_PAYMENT_ENEGATE_H_ */