| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectrcx.josx.rcxcomm.RCXBean
public class 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(java.lang.Object o)Make the RCX bean available for other threads. | 
|  java.lang.String | getComPort()Getter for the property "ComPort". | 
|  void | lock(java.lang.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(java.lang.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, wait | 
| Constructor Detail | 
|---|
public RCXBean()
| Method Detail | 
|---|
public java.lang.String getComPort()
public void setComPort(java.lang.String value)
                throws java.io.IOException
value - A identifier for the comPort e.g. COM1
 or /dev/ttyS0
java.io.IOException - If the initialysation of the comPort goes wrong.
public void sendInt(int v)
             throws java.io.IOException
v - The integer to be sent.
java.io.IOException - If the integer can not be sent.
public void send(byte b)
          throws java.io.IOException
b - The byte to send.
java.io.IOException - If the byte can  not be sent.
public void send(byte[] b)
          throws java.io.IOException
b - The byte array to send.
java.io.IOException - If the byte array can not be sent.
public byte receive()
             throws java.io.IOException
java.io.IOException - If the read times out, or something else goes wrong.
public int receiveInt()
               throws java.io.IOException
java.io.IOException - If the read times out, or something else goes wrong.
public byte[] receive(int n)
               throws java.io.IOException
n bytes from the RCX.
- 
 
- 
- Parameters:
- n- The number of bytes to receive.
- Returns:
- A byte array with bytes from the RCX.
- Throws:
- java.io.IOException- If the read times out.
 
public void lock(java.lang.Object o)
          throws java.io.IOException
free()
 has bin run.
o - The lock is bound to this object. It should therefore be unique for the thread.
java.io.IOException - If an other object has allready locked the RCX bean.public void free(java.lang.Object o)
o - The object which has the lock.public void close()
public void finalize()
finalize in class java.lang.Object| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||