Newer
Older
pgdsc / src / com / szpg / plc / message / command / ReadMemoryCommand.java
admin on 12 Jan 2018 1 KB 2018-01-12
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;

public abstract class ReadMemoryCommand extends AppCommand {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 8230263832472237420L;
	
	private byte memoryArea; //读取的内存区域代码
	private String startAddress; //起始地址
	private int count; //读取的数量,以word(2字节)计算

	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 getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public ReadMemoryCommand getInstance(String type) {
		switch (type) {
			case AppMessageConstants.CMD_TYPE_READCH4PARAM:
				return new ReadCH4ParamCommand();
			
			default: 
				return null;
		}
	}
}