package com.szpg.plc.message.command; import com.szpg.plc.message.AppCommand; import com.szpg.plc.message.AppMessageConstants; import com.szpg.plc.message.command.read.*; public abstract class ReadMemoryCommand extends AppCommand { /** * */ private static final long serialVersionUID = 8230263832472237420L; private byte memoryArea; //读取的内存区域代码 private String startAddress; //起始地址 private int countWord; //读取的字数量/1WORD=2BYTE public byte getMemoryArea() { return memoryArea; } public void setMemoryArea(byte memoryArea) { this.memoryArea = memoryArea; } public String getStartAddress() { return startAddress; } public void setStartAddress(String startAddress) { this.startAddress = startAddress; } public int getCountWord() { return countWord; } public void setCountWord(int countWord) { this.countWord = countWord; } public static ReadMemoryCommand getInstance(String type) { switch (type) { case AppMessageConstants.CMD_TYPE_READCH4VALUE: return new ReadCH4ValueCommand(); case AppMessageConstants.CMD_TYPE_READCH4STATUS: return new ReadCH4StatusCommand(); case AppMessageConstants.CMD_TYPE_READWSVALUE: return new ReadWSValueCommand(); case AppMessageConstants.CMD_TYPE_READWSSTATUS: return new ReadWSStatusCommand(); case AppMessageConstants.CMD_TYPE_READCOVALUE: return new ReadCOValueCommand(); case AppMessageConstants.CMD_TYPE_READCOSTATUS: return new ReadCOStatusCommand(); case AppMessageConstants.CMD_TYPE_READO2VALUE: return new ReadO2ValueCommand(); case AppMessageConstants.CMD_TYPE_READO2STATUS: return new ReadO2StatusCommand(); case AppMessageConstants.CMD_TYPE_READHSVALUE: return new ReadHSValueCommand(); case AppMessageConstants.CMD_TYPE_READHSSTATUS: return new ReadHSStatusCommand(); case AppMessageConstants.CMD_TYPE_READYWSTATUS: return new ReadYWStatusCommand(); case AppMessageConstants.CMD_TYPE_READDSSTATUS: return new ReadDSStatusCommand(); case AppMessageConstants.CMD_TYPE_READJGSTATUS: return new ReadJgStatusCommand(); case AppMessageConstants.CMD_TYPE_READFJSTAT: return new ReadFjStatCommand(); case AppMessageConstants.CMD_TYPE_READFJRUNTIME: return new ReadFjRtCommand(); case AppMessageConstants.CMD_TYPE_READSBSTAT: return new ReadSbStatCommand(); case AppMessageConstants.CMD_TYPE_READSBRUNTIME: return new ReadSbRtCommand(); case AppMessageConstants.CMD_TYPE_READZMSTAT: return new ReadZmStatCommand(); case AppMessageConstants.CMD_TYPE_READZMRUNTIME: return new ReadZmRtCommand(); case AppMessageConstants.CMD_TYPE_READWSYQVALUE: return new ReadWSYQValueCommand(); case AppMessageConstants.CMD_TYPE_READHSCH4VALUE: return new ReadHSCH4ValueCommand(); case AppMessageConstants.CMD_TYPE_READPOWERVALUE: return new ReadPowerValueCommand(); default: return null; } } public abstract String getCommandType(); }