1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- #include <sys/time.h>
- #include <sys/timeb.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <sys/types.h>
- #include <sys/ioctl.h>
- #include <sys/socket.h>
- #include <sys/ipc.h>
- #include <sys/shm.h>
- #include <sys/mman.h>
- #include <linux/wireless.h>
- #include <linux/can.h>
- #include <linux/can/raw.h>
- #include <arpa/inet.h>
- #include <netinet/in.h>
- #include <unistd.h>
- #include <stdarg.h>
- #include <stdio.h> /*標準輸入輸出定義*/
- #include <stdlib.h> /*標準函數庫定義*/
- #include <unistd.h> /*Unix 標準函數定義*/
- #include <fcntl.h> /*檔控制定義*/
- #include <termios.h> /*PPSIX 終端控制定義*/
- #include <errno.h> /*錯誤號定義*/
- #include <string.h>
- #include <time.h>
- #include <ctype.h>
- #include <ifaddrs.h>
- #include <math.h>
- #include "../../define.h"
- #include <stdbool.h>
- typedef unsigned char byte;
- typedef unsigned short word;
- typedef unsigned int unit;
- #define PSU_CUR_GAP 20 // 0.1A
- #define LOG_TIME 2000 // 1ms
- #define SMOOTH_TIME 100 // 1ms
- #define WAIT_LIMIT_TIME 10000 // 1ms
- unsigned char _gunCountRecord;
- struct ChargingInfoData *chargingInfo[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
- bool isStartOutputSwitch[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
- struct timespec _cmdSubPsuPriority_time;
- struct timespec _derating_time;
- struct timespec _max_time;
- struct timespec _log_time;
- struct timespec _smooth_time;
- struct timespec _releaseWait_time[DC_CONNECTOR_COUNT];
- bool _releaseWait_chk[DC_CONNECTOR_COUNT];
- byte _delayToGetCap;
- byte _maxChargingStatus;
- bool isReadyToCharging = false;
- int preChargingTarget;
- int preChargingCur;
- float toAverVolPoint;
- byte toAverVolCount;
- int _forceWaitToCompforMaxMode;
- byte _delay2GetPsuTemp;
- enum _CHARGING_GUN_STATUS
- {
- _CHARGING_GUN_STATUS_NONE = 0,
- _CHARGING_GUN_STATUS_COMM,
- _CHARGING_GUN_STATUS_CHARGING,
- _CHARGING_GUN_STATUS_STOP
- };
- enum _PSU_CMD_SEQ
- {
- _PSU_CMD_STATUS = 1,
- _PSU_CMD_VERSION = 2,
- _PSU_CMD_CAP = 10,
- _PSU_CMD_IAVAILABLE = 11,
- _PSU_CMD_TEMP = 12,
- _PSU_CMD_GETCOUNT = 13,
- _PSU_CMD_OUTPUT_V = 14,
- };
- enum _CHARGING_LOG_INDEX
- {
- _CHARGING_LOG_NEED_VOL = 0,
- _CHARGING_LOG_NEED_CUR = 1,
- _CHARGING_LOG_OUTPUT_VOL = 2,
- _CHARGING_LOG_OUTPUT_CUR = 3
- };
|