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.ReadCH4ParamCommand; import com.szpg.plc.message.command.read.ReadCH4StatusCommand; public abstract class ReadMemoryCommand extends AppCommand { /** * */ private static final long serialVersionUID = 8230263832472237420L; private byte memoryArea; //读取的内存区域代码 private String startAddress; //起始地址 private int countWord; //读取的字数量/1WORD=2BYTE private int countBit; //读取的位数量 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 int getCountBit() { return countBit; } public void setCountBit(int countBit) { this.countBit = countBit; } public static ReadMemoryCommand getInstance(String type) { switch (type) { case AppMessageConstants.CMD_TYPE_READCH4PARAM: return new ReadCH4ParamCommand(); case AppMessageConstants.CMD_TYPE_READCH4STATUS: return new ReadCH4StatusCommand(); default: return null; } } public abstract String getCommandType(); }