 1Content-type: application/x-Unknown; charset=UTF8package nmc.common;

import java.io.DataOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.IOException;

public class TestPollCmd extends TestCommand {
    public int channelNumber;
	
    public TestPollCmd(DataInputStream dis) throws IOException {
	this.decerealize(dis);
    }

    public TestPollCmd(int channelNumber) {
	this.seqNo = getNextCmdSeqNo();
	this.len = 8; // for the channelNumber,timeout
	this.channelNumber = channelNumber;
    }
    public TestPollCmd(int channelNumber,int t) {
	this.seqNo = getNextCmdSeqNo();
	this.len = 8; // for the channelNumber,timeout
	this.channelNumber = channelNumber;
	this.setTimeout(t);
    }
	
    public int getMessageType(){
	return POLL_CMD;
    }

    public void cerealize(DataOutputStream s) throws IOException {
    	super.cerealize(s);
	s.writeInt(channelNumber);
    }

    public void decerealize(DataInputStream s) throws IOException {
    	super.decerealize(s);
    	channelNumber = s.readInt();
    }


    public String toString(){
	return "%<%msgType=PollCmd%seqNo="
	       + this.seqNo
	       + "%len="
	       + this.len
	       + "%channelNumber="
	       + this.channelNumber
	       +"%timeout="
	       +this.timeout
	       + "%>%";
    }
}

