0
|
1
|
|
2 /**
|
|
3 * PSXReply
|
|
4 *
|
|
5 * @author Shinji Kono
|
|
6 *
|
|
7
|
|
8 psx.in(),psxrd.() return this.
|
|
9
|
|
10 method for check answer is ready or not.
|
|
11
|
|
12 (call back interface can be used instead of this)
|
|
13
|
|
14 unique sequence number */
|
|
15
|
|
16 package fdl;
|
|
17 import java.nio.ByteBuffer;
|
|
18
|
17
|
19 public class PSXReply {
|
24
|
20 public ByteBuffer command;
|
|
21 public ByteBuffer data;
|
|
22 public int seq;
|
|
23 public PSXReply next;
|
|
24 public int mode;
|
|
25 public PSXCallback callback;
|
0
|
26
|
24
|
27 public PSXReply(int _mode,PSXCallback _callback) {
|
|
28 mode = _mode;
|
|
29 callback = _callback;
|
|
30 }
|
0
|
31
|
24
|
32 public PSXReply() {
|
|
33 }
|
0
|
34
|
24
|
35 public void setAnswer(int _mode, ByteBuffer _command,ByteBuffer _data) {
|
|
36 mode = _mode;
|
|
37 data = _data;
|
|
38 command = _command;
|
|
39 }
|
0
|
40
|
24
|
41 public int getMode() {
|
|
42 return command.get(PSX.LINDA_MODE_OFFSET);
|
|
43 }
|
0
|
44
|
24
|
45 public int getId() {
|
|
46 return command.getShort(PSX.LINDA_ID_OFFSET);
|
|
47 }
|
0
|
48
|
24
|
49 public int getSeq() {
|
|
50 return command.getInt(PSX.LINDA_SEQ_OFFSET);
|
|
51 }
|
0
|
52
|
24
|
53 public int getLength() {
|
|
54 return command.getInt(PSX.LINDA_DATA_LENGTH_OFFSET);
|
|
55 }
|
0
|
56
|
24
|
57 public ByteBuffer getData() {
|
|
58 data.rewind();
|
|
59 return data;
|
|
60 }
|
0
|
61
|
24
|
62 public boolean ready() {
|
|
63 return mode==PSX.PSX_ANSWER;
|
|
64 }
|
0
|
65 }
|
|
66
|
|
67
|
|
68 /* end */
|