view src/fdl/PSXReply.java @ 105:be9b84a77b15

default branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 27 May 2010 19:30:20 +0900
parents 046feb56a196
children
line wrap: on
line source


/**
 * PSXReply 
 *
 * @author Shinji Kono
 *

    psx.in(),psxrd.() return this.

    method for check answer is ready or not.

    (call back interface can be used instead of this)

    unique sequence number  */

package fdl;
import java.nio.ByteBuffer;

public class PSXReply {
	public ByteBuffer command;
	public ByteBuffer data;
	public int seq;
	public PSXReply next;
	public int mode;
	public PSXCallback callback;

	public PSXReply(int _mode,PSXCallback _callback) {
		mode = _mode;
		callback = _callback;
	}

	public PSXReply() {
	}

	public void setAnswer(int _mode, ByteBuffer _command,ByteBuffer _data) {
		mode = _mode;
		data = _data;
		command = _command;
	}

	public int getMode() {
		return command.get(PSX.LINDA_MODE_OFFSET);
	}

	public int getId() {
		return command.getShort(PSX.LINDA_ID_OFFSET);
	}

	public int getSeq() {
		return command.getInt(PSX.LINDA_SEQ_OFFSET);
	}

	public int getLength() {
		return command.getInt(PSX.LINDA_DATA_LENGTH_OFFSET);
	}

	public ByteBuffer getData() {
		data.rewind();
		return data;
	}

	public boolean ready() {
		return mode==PSX.PSX_ANSWER;
	}
}


/* end */