|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--josx.rcxcomm.Tower
Low-level interface to the Lego IR Tower
Used by RCXPort to send and receive messages to and from the RCX.
Can be used to send any packet or any sequence of bytes to the RCX.
The tower is opened with a call to open() or open(port) and
closed by a call to close().
send
can be used to send a packet, and receive to receive one.
write
can read a sequence of bytes, and read can read them.
Constructor Summary | |
Tower()
Create the tower class |
Method Summary | |
int |
close()
Close the tower |
int |
getError()
Get the last OS error |
int |
getUsbFlag()
Getter for USB Flag |
void |
hexdump(String prefix,
byte[] b,
int n)
dump hex to standard out |
int |
isAlive()
Check if RCX is alive |
int |
open()
Open the tower |
int |
open(String p)
Open the tower |
int |
read(byte[] b)
Low-level read |
int |
receive(byte[] b)
Receive a packet |
int |
send(byte[] b,
int n)
send a packet to the RCX, e.g 0x10 for ping |
void |
setError(int e)
Setter for OS Error |
String |
strerror(int errno)
Converts an error number to a string |
int |
write(byte[] b,
int n)
Write low-level bytes to the tower, e.g 0xff550010ef10ef for ping |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait |
Constructor Detail |
public Tower()
Method Detail |
public int open(String p)
port
- port to use, e.g. usb or COM1public int close()
public int write(byte[] b, int n)
b
- bytes to sendn
- number of bytespublic int send(byte[] b, int n)
b
- packet to sendn
- number of bytespublic int read(byte[] b)
b
- buffer to receive bytespublic int receive(byte[] b)
b
- buffer to receive packetpublic void hexdump(String prefix, byte[] b, int n)
prefix
- identifies the dumpb
- bytes to dumpn
- numberof bytespublic int isAlive()
public int open()
public String strerror(int errno)
public int getError()
public int getUsbFlag()
public void setError(int e)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |