public abstract class RfcommConnection
- Object
- RfcommConnection
An open RFCOMM (Serial Port Profile style) stream connection to a
classic Bluetooth device, obtained via BluetoothClassic.connect or
accepted from an RfcommServer.
The streams block and must be consumed off the EDT; reads/writes
throw plain java.io.IOException on transport failure. Always
close() the connection when done.
Constructors
protected RfcommConnection(BluetoothDevice device) | Constructed by ports; not application API. |
Methods
public abstract InputStream getInputStream()
throws IOException | The blocking input stream; consume off the EDT. |
public abstract OutputStream getOutputStream()
throws IOException | The blocking output stream; use off the EDT. |
public abstract void close()
throws IOException | Closes the connection and both streams. |
public abstract boolean isOpen() | true while the connection is open. |
public BluetoothDevice getDevice() | The remote device of this connection. |
Inherited methods
Constructor details
RfcommConnection
protected RfcommConnection(BluetoothDevice device)Constructed by ports; not application API.
Method details
getInputStream
public abstract InputStream getInputStream()
throws IOExceptionThe blocking input stream; consume off the EDT.
Throws
getOutputStream
public abstract OutputStream getOutputStream()
throws IOExceptionThe blocking output stream; use off the EDT.
Throws
close
public abstract void close()
throws IOExceptionCloses the connection and both streams.
Throws
isOpen
public abstract boolean isOpen()true while the connection is open.getDevice
public BluetoothDevice getDevice()The remote device of this connection.