public abstract class L2capChannel

  1. Object
  2. L2capChannel

An open L2CAP connection-oriented channel – a raw bidirectional byte stream to a peripheral, obtained via BlePeripheral.openL2capChannel(int, boolean) on the central side or accepted from an L2capServer on the peripheral side.

The streams block and must be consumed off the EDT; reads/writes throw plain java.io.IOException on transport failure. Always close() the channel when done.

Constructors

protected L2capChannel(int psm)Constructed by ports; not application API.

Methods

public abstract InputStream getInputStream() throws IOExceptionThe blocking input stream of the channel; consume off the EDT.
public abstract OutputStream getOutputStream() throws IOExceptionThe blocking output stream of the channel; use off the EDT.
public abstract void close() throws IOExceptionCloses the channel and both streams.
public abstract boolean isOpen()true while the channel is open.
public int getPsm()The Protocol/Service Multiplexer this channel is bound to.

Inherited methods

Constructor details

L2capChannel

protected L2capChannel(int psm)
Constructed by ports; not application API.

Method details

getInputStream

public abstract InputStream getInputStream() throws IOException
The blocking input stream of the channel; consume off the EDT.

getOutputStream

public abstract OutputStream getOutputStream() throws IOException
The blocking output stream of the channel; use off the EDT.

close

public abstract void close() throws IOException
Closes the channel and both streams.

isOpen

public abstract boolean isOpen()
true while the channel is open.

getPsm

public int getPsm()
The Protocol/Service Multiplexer this channel is bound to.