|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectjBotBrain.comm.BTCommPort
public class BTCommPort
Bluetooth communication abstraction class.
jBrain acts as client in communication. PC or other device must
create "Serial Port" connection to jBrain.
To detect state of bluetooth device use getStatus() method.
Communication parameters like speed, parity, stop and data bits are ignored.
NOTE: This class is not static, it must be allocated.
CommPort| Field Summary |
|---|
| Fields inherited from interface jBotBrain.comm.CommPort |
|---|
BR_115200, BR_1200, BR_19200, BR_2400, BR_38400, BR_4800, BR_57600, BR_9600, DATABITS_EIGHT, DATABITS_SEVEN, DEVICE_CONNECTED, DEVICE_OFF, DEVICE_ON, DEVICE_WAIT_CONN, PARITY_EVEN, PARITY_MARK, PARITY_NONE, PARITY_ODD, PARITY_SPACE, STOPBIT_1_5, STOPBIT_ONE, STOPBIT_TWO |
| Constructor Summary | |
|---|---|
BTCommPort()
Constructs BTCommPort object. |
|
| Method Summary | |
|---|---|
void |
close()
Close communication port |
int |
getStatus()
Returns Bluetooth interface status. |
boolean |
open(int baudrate,
int parity,
int databits,
int stopbits)
Function used for compatibility, but function fails if Bluetooth hardware is powered off. |
int |
read(byte[] buffer,
int offset,
int len)
Reads len bytes to buffer at offset from Bluetooth communication interface. |
int |
write(byte[] buffer,
int offset,
int len)
Writes len bytes from buffer starting from offset to Bluetooth communication interface. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait |
| Constructor Detail |
|---|
public BTCommPort()
port - number of port (0 or 1)| Method Detail |
|---|
public boolean open(int baudrate,
int parity,
int databits,
int stopbits)
open in interface CommPortCommPort.BR_115200,
CommPort.BR_57600,
CommPort.BR_38400,
CommPort.BR_19200,
CommPort.BR_9600,
CommPort.BR_4800,
CommPort.BR_2400,
CommPort.BR_1200,
CommPort.PARITY_NONE,
CommPort.PARITY_ODD,
CommPort.PARITY_EVEN,
CommPort.PARITY_MARK,
CommPort.PARITY_SPACE,
CommPort.DATABITS_EIGHT,
CommPort.DATABITS_SEVEN,
CommPort.STOPBIT_ONE,
CommPort.STOPBIT_1_5,
CommPort.STOPBIT_TWOpublic void close()
close in interface CommPortpublic int getStatus()
getStatus in interface CommPortCommPort.DEVICE_OFF,
CommPort.DEVICE_ON,
CommPort.DEVICE_WAIT_CONN,
CommPort.DEVICE_CONNECTED
public int read(byte[] buffer,
int offset,
int len)
read in interface CommPort
public int write(byte[] buffer,
int offset,
int len)
write in interface CommPort
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||