123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- /*
- * Module_EvComm.h
- *
- * Created on: 2020�~9��14��
- * Author: Wendell
- */
- #ifndef MODULE_EVCOMM_H_
- #define MODULE_EVCOMM_H_
- // server protocol setting
- #define SOCKET_SERVER_IP "192.168.0.10"
- #define PACKET_HEADER_LENGTH 4
- #define MAXIMUM_PAYLOAD_LENGTH 249 // 249 bytes
- #define TCP_LISTEN_PORT 36000
- #define SOCKET_RECEIVE_INTERVAL 10 // 10ms
- #define DISPENSER_SOCKET_TIMEOUT 10000 // 10s
- // client protocol setting
- #define DISPENSER_MODEL_NAME_RESEND 3000 // 3s
- #define DISPENSER_CONNECTOR_RESEND 3000 // 3s
- #define CABINET_STATUS_REQUEST_RESEND 1000 // 1s
- #define CHARGING_CAPABILITY_RESEND 1000 // 1s
- // socket setting
- #define CONNECTION_LIMIT 5
- #define MAXIMUM_CONNECT_QUANTITY 2
- struct Message
- {
- int size;
- unsigned char buffer[2048];
- };
- enum HEADER_OP
- {
- _Header_Read = 0x01,
- _Header_Write = 0x02,
- _Header_Response = 0x03,
- };
- enum PAYLOAD_REGISTER
- {
- _Reg_Dispenser_Model_Name = 0x01,
- _Reg_Connector_ID = 0x02,
- _Reg_Power_Cabinet_Status = 0x03,
- _Reg_Dispenser_Status = 0x04,
- _Reg_Charging_Capability = 0x05,
- _Reg_Charging_Target = 0x06,
- _Reg_Software_Update = 0x07,
- _Reg_Plug_In_Status = 0x08,
- _Reg_Connector_State = 0x09,
- _Reg_User_ID = 0x0A,
- _Reg_Charging_Permission = 0x0B,
- };
- enum Response_Result
- {
- _R_OK = 0x01,
- _R_NG = 0x02,
- };
- enum PlugIn_Status
- {
- _PIS_UnPlugged = 0x00,
- _PIS_PluggedIn = 0x01,
- };
- enum Connector_Remote_Status
- {
- _CRS_Idle = 0x00,
- _CRS_Preparing = 0x01,
- _CRS_Charging = 0x02,
- _CRS_Terminating = 0x03,
- };
- typedef enum
- {
- _DAS_NotAllowed = 0x00,
- _DAS_Allowed = 0x01,
- _DAS_Wait = 0x02,
- }DispenserAck_Status;
- enum Permission_Status
- {
- _PS_NotPermitted = 0x00,
- _PS_Permitted = 0x01,
- };
- enum Accept_Status
- {
- _AS_Reject = 0x00,
- _AS_Accept = 0x01,
- };
- struct HEADER_STRUCTURE
- {
- unsigned char se;
- unsigned char id;
- unsigned char op;
- unsigned char len;
- };
- struct PAYLOAD_STRUCTURE
- {
- unsigned char reg;
- unsigned char data[MAXIMUM_PAYLOAD_LENGTH];
- };
- struct PACKET_STRUCTURE
- {
- struct HEADER_STRUCTURE Header;
- struct PAYLOAD_STRUCTURE Payload;
- }Packet_Structure;
- enum DispenserStatus
- {
- _DS_None = 0x00,
- _DS_Identification = 0x01,
- _DS_Idle = 0x02,
- _DS_Alarm = 0x03,
- _DS_Charging = 0x04,
- _DS_Timeout = 0x05,
- };
- enum ConnectionStatus
- {
- _CNS_FREE = 0x00,
- _CNS_WaitModelName = 0x01,
- _CNS_DispenserMatched = 0x02,
- };
- #endif /* MODULE_EVCOMM_H_ */
|