|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjosx.rcxcomm.RCXBean
Handles communication with a LEGO RCX Based on original code by the LEGO3 Team at DTU-IAU
Constructor Summary | |
RCXBean()
Creates new RCXBean |
Method Summary | |
void |
close()
Close this RCX bean. |
void |
finalize()
|
void |
free(Object o)
Make the RCX bean available for other threads. |
String |
getComPort()
Getter for the property "ComPort". |
void |
lock(Object o)
Create a lock of this the RCX bean. |
byte |
receive()
Receive a byte from the RCX. |
byte[] |
receive(int n)
Receive n |
int |
receiveInt()
Receive a byte from the RCX. |
void |
send(byte b)
Send a byte to the RCX. |
void |
send(byte[] b)
Send a byte array to the RCX |
void |
sendInt(int v)
Send an integer to the RCX. |
void |
setComPort(String value)
Change or set which comPort should be used for communication with the RCX |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait |
Constructor Detail |
public RCXBean()
Method Detail |
public String getComPort()
public void setComPort(String value) throws IOException
value
- A identifier for the comPort e.g. COM1
or /dev/ttyS0
IOException
- If the initialysation of the comPort goes wrong.public void sendInt(int v) throws IOException
v
- The integer to be sent.
IOException
- If the integer can not be sent.public void send(byte b) throws IOException
b
- The byte to send.
IOException
- If the byte can not be sent.public void send(byte[] b) throws IOException
b
- The byte array to send.
IOException
- If the byte array can not be sent.public byte receive() throws IOException
IOException
- If the read times out, or something else goes wrong.public int receiveInt() throws IOException
IOException
- If the read times out, or something else goes wrong.public byte[] receive(int n) throws IOException
n bytes from the RCX.
- Parameters:
n
- The number of bytes to receive.
- Returns:
- A byte array with bytes from the RCX.
- Throws:
IOException
- If the read times out.
public void lock(Object o) throws IOException
free()
has bin run.
o
- The lock is bound to this object. It should therefore be unique for the thread.
IOException
- If an other object has allready locked the RCX bean.public void free(Object o)
o
- The object which has the lock.public void close()
public void finalize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |