|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjosx.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 |
int |
setFast(int fast)
Set fast mode |
String |
strerror(int errno)
Converts an error number to a string Note you should negate the error number before passing it to this method as this method expects a positive value. |
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 setFast(int fast)
fast
- - 0 = slow mode, 1 = fast modepublic int open(String p)
public int close()
public int write(byte[] b, int n)
b
- bytes to sendn
- number of bytes
public int send(byte[] b, int n)
b
- packet to sendn
- number of bytes
public int read(byte[] b)
b
- buffer to receive bytes
public int receive(byte[] b)
b
- buffer to receive packet
public 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: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |