#ifndef MODULE_EVCOMM_H_ #define MODULE_EVCOMM_H_ #include int CanFd; typedef unsigned char byte; typedef enum { EV_Slave_Address_Broadcast = 0xFF, EV_Slave_Address_Bd1 = 0x01, EV_Slave_Address_Bd2 = 0x02 }EvSlaveAddr; typedef enum { EV_Command_AddressReq = 0x01, EV_Command_AddressAssignment = 0x02, EV_Command_EvStatusNotification = 0x03, EV_Command_GetFwVersion = 0x04, EV_Command_GetHwVersion = 0x05, EV_Command_ChargingPermission = 0x06, EV_Command_PresentOutputPow = 0x07, EV_Command_PresentOutputCap = 0x08, EV_Command_GetOutputReq = 0x09, EV_Command_GetBetteryInfo = 0x0A, EV_Command_EvStopNotification = 0x0B, EV_Command_EvseStopCharging = 0x0C, EV_Command_GetMiscellaneous = 0x0D, EV_Command_IsolationStatus = 0x12, EV_Command_CCSconnectorInfo = 0x13, EV_Command_SyncRtcInfo = 0x14, EV_Command_EvsePrechargeInfo = 0x15, EV_Command_EvccidReq = 0x16, }EvCmd; typedef union { unsigned int EvMessage; struct { unsigned int SlaveAddress:8; unsigned int MessageID:8; unsigned int Rsv:11; unsigned int Dir:1; unsigned int res:4; }EvBdBits; }EvFrame; extern struct Ev_Cmd_Dir { unsigned short master_to_slave; unsigned short slave_to_master; }Ev_Dir; struct timeval _id_assign_time; // Send msg to can-bus void SetTargetAddr(byte *target_number, byte index); void GetFirmwareVersion(byte gun_index, byte toId); void SyncRtcInfo(byte gun_index, byte toId, int epoch); void SetConnectInfo(byte type, byte toId); void GetHardwareVersion(byte gun_index, byte toId); void SetChargingPermission(byte gun_index, byte permissionStatus, float aOutputPw, float aOutputVol, short aOutputCur, byte toId); void SetPresentOutputPower(short outputVol_b1, short outputCur_b1, short outputVol_b2, short outputCur_b2); void SetPresentOutputCapacity(short aOutputPw_b1, short aOutputCur_b1, short aOutputPw_b2, short aOutputCur_b2); void GetOutputReq(byte gun_index, byte toId); void GetEvccIdReq(byte gun_index, byte toId); void GetEvBatteryInfo(byte gun_index, byte toId); void GetMiscellaneousInfo(byte gun_index, byte relayStatus, float power, float voltage, byte toId); void SetIsolationStatus(byte gun_index, byte result, byte toId); void SetEvsePrechargeInfo(byte gun_index, byte result, byte toId); // 發送電樁主動停止充電結果及原因 void EvseStopChargingEvent(byte stopResult, byte *stopReason, byte toId); // Receive msg From can-bus. enum EV_LOG_INDEX { EV_LOG_OUTPUT_CAP_POW = 0, EV_LOG_OUTPUT_CAP_CUR = 1, EV_LOG_NOW_OUTPUT_VOL = 2, EV_LOG_NOW_OUTPUT_CUR = 3, EV_LOG_EVSE_MAX_VOL = 4, EV_LOG_EVSE_MAX_CUR = 5, EV_LOG_MAX_BATT_VOL = 6, EV_LOG_REAL_CAP_POW = 7, EV_LOG_SOC = 8 }; #endif /* MODULE_EVCOMM_H_ */