Module_PsuComm.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #include <sys/time.h>
  2. #include <sys/timeb.h>
  3. #include <sys/types.h>
  4. #include <sys/stat.h>
  5. #include <sys/types.h>
  6. #include <sys/ioctl.h>
  7. #include <sys/socket.h>
  8. #include <sys/ipc.h>
  9. #include <sys/shm.h>
  10. #include <sys/mman.h>
  11. #include <linux/wireless.h>
  12. #include <linux/can.h>
  13. #include <linux/can/raw.h>
  14. #include <arpa/inet.h>
  15. #include <netinet/in.h>
  16. #include <unistd.h>
  17. #include <stdarg.h>
  18. #include <stdio.h> /*標準輸入輸出定義*/
  19. #include <stdlib.h> /*標準函數庫定義*/
  20. #include <unistd.h> /*Unix 標準函數定義*/
  21. #include <fcntl.h> /*檔控制定義*/
  22. #include <termios.h> /*PPSIX 終端控制定義*/
  23. #include <errno.h> /*錯誤號定義*/
  24. #include <string.h>
  25. #include <time.h>
  26. #include <ctype.h>
  27. #include <ifaddrs.h>
  28. #include <math.h>
  29. #include "../../define.h"
  30. #include <stdbool.h>
  31. typedef unsigned char byte;
  32. typedef unsigned short word;
  33. typedef unsigned int unit;
  34. unsigned char _gunCount;
  35. struct ChargingInfoData *chargingInfo[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
  36. bool isStartOutputSwitch[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
  37. struct timespec _cmdSubPsuPriority_time;
  38. struct timespec _derating_time;
  39. struct timespec _max_time;
  40. struct timespec _log_time;
  41. byte _maxChargingStatus;
  42. bool isReadyToCharging = false;
  43. int preChargingTarget;
  44. int preChargingCur;
  45. float toAverVolPoint;
  46. byte toAverVolCount;
  47. byte _delayCount;
  48. //int connector_1[12];
  49. //int connector_2[12];
  50. //int connector[2][12];
  51. //byte conn_1_count = 0;
  52. //byte conn_2_count = 0;
  53. enum _CHARGING_GUN_STATUS
  54. {
  55. _CHARGING_GUN_STATUS_NONE = 0,
  56. _CHARGING_GUN_STATUS_COMM,
  57. _CHARGING_GUN_STATUS_CHARGING,
  58. _CHARGING_GUN_STATUS_STOP
  59. };
  60. enum _PSU_CMD_SEQ
  61. {
  62. _PSU_CMD_STATUS = 1,
  63. _PSU_CMD_VERSION = 2,
  64. _PSU_CMD_CAP = 10,
  65. _PSU_CMD_OUTPUT = 11,
  66. _PSU_CMD_IVAILIABLE = 12,
  67. _PSU_CMD_TEMP = 13,
  68. _PSU_CMD_GETCOUNT = 14,
  69. };
  70. enum _CHARGING_LOG_INDEX
  71. {
  72. _CHARGING_LOG_NEED_VOL = 0,
  73. _CHARGING_LOG_NEED_CUR = 1,
  74. _CHARGING_LOG_OUTPUT_VOL = 2,
  75. _CHARGING_LOG_OUTPUT_CUR = 3
  76. };