|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.openuat.util.BluetoothRFCOMMChannel
public class BluetoothRFCOMMChannel
This is a very simple class that uses the JSR82 API to open an RFCOMM channel to a Bluetooth device.
| Nested Class Summary | |
|---|---|
static class |
BluetoothRFCOMMChannel.RDevice
The RemoteDevice constructor taking a Bluetooth MAC address is, for some weird reason, protected. |
protected static class |
BluetoothRFCOMMChannel.TempHandler
Switches the state of the local device between Master and Slave |
| Constructor Summary | |
|---|---|
BluetoothRFCOMMChannel(java.lang.String connectionURL)
Construct a Bluetooth RFCOMM channel object with a specific remote endpoint. |
|
BluetoothRFCOMMChannel(java.lang.String remoteDeviceAddress,
int remoteChannelNumber)
Construct a Bluetooth RFCOMM channel object with a specific remote endpoint. |
|
| Method Summary | |
|---|---|
void |
close()
Closes the channel to the endpoint given to the constructor. |
boolean |
equals(java.lang.Object other)
This implementation of equals either compares either the connection objects (if set) or serviceURL. |
java.io.InputStream |
getInputStream()
Returns the InputStream object for reading from the remote Bluetooth device. |
static BluetoothRFCOMMChannel[] |
getOpenChannels()
Returns all BluetoothRFCOMMChannel objects whose channel is currently open or is being tried to be opened. |
java.io.OutputStream |
getOutputStream()
Returns the OutputStream object for writing to the remote Bluetooth device. |
java.lang.Object |
getRemoteAddress()
Implementation of RemoteConnection.getRemoteAddress. |
int |
getRemoteChannelNumber()
Returns the remote channel number. |
java.lang.String |
getRemoteName()
Implementation of RemoteConnection.getRemoteName. |
int |
hashCode()
Override hashCode so as to provide the same integer when two objects are equal as defined by the overrode equals implementation. |
boolean |
isOpen()
Implementation of RemoteConnection.isOpen. |
static void |
main(java.lang.String[] args)
|
boolean |
open()
Opens a channel to the endpoint given to the constructor. |
void |
setRemoteChannelNumber(int remoteChannelNumber)
Sets the remote channel number that will be used in the next open() call. |
static void |
shutdownAllChannels()
This method can be used to speed up shutdown of the overall application by closing all RFCOMM channels that are still open at this time. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public BluetoothRFCOMMChannel(java.lang.String connectionURL)
throws java.io.IOException
connectionURL - The complete Bluetooth service URL, as returned e.g.
by a service search.
java.io.IOException - When the local Bluetooth stack was not initialized properly.
public BluetoothRFCOMMChannel(java.lang.String remoteDeviceAddress,
int remoteChannelNumber)
throws java.io.IOException
remoteDeviceAddress - The Bluetooth MAC address to connect to, in format
"AABBCCDDEEFF".remoteChannelNumber - The SDP RFCOMM channel number to connect to, usually between
1 and 10.
java.io.IOException - When the local Bluetooth stack was not initialized properly.| Method Detail |
|---|
public static BluetoothRFCOMMChannel[] getOpenChannels()
public static void shutdownAllChannels()
public boolean open()
throws java.io.IOException
open in interface RemoteConnectionjava.io.IOException - On Bluetooth errors.
java.io.IOException - When the channel has already been opened.public void close()
close in interface RemoteConnectionjava.io.IOException - On Bluetooth errors.
java.io.IOException - When the channel has not yet been opened.RemoteConnection.closepublic boolean isOpen()
isOpen in interface RemoteConnection
public java.io.InputStream getInputStream()
throws java.io.IOException
getInputStream in interface RemoteConnectionjava.io.IOException - When the channel has not yet been opened.RemoteConnection.getInputStream
public java.io.OutputStream getOutputStream()
throws java.io.IOException
getOutputStream in interface RemoteConnectionjava.io.IOException - When the channel has not yet been opened.RemoteConnection.getOutputStreampublic java.lang.Object getRemoteAddress()
getRemoteAddress in interface RemoteConnectionRemoteConnection.getRemoteAddresspublic java.lang.String getRemoteName()
getRemoteName in interface RemoteConnectionRemoteConnection.getRemoteNamepublic int getRemoteChannelNumber()
public void setRemoteChannelNumber(int remoteChannelNumber)
public boolean equals(java.lang.Object other)
equals in interface RemoteConnectionequals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object
public static void main(java.lang.String[] args)
throws java.io.IOException,
java.lang.NumberFormatException,
java.lang.InterruptedException
java.io.IOException
java.lang.NumberFormatException
java.lang.InterruptedException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||