public abstract class L2capServer

  1. Object
  2. L2capServer
A listening L2CAP endpoint on the local device, opened via BluetoothLE.openL2capServer(boolean) when acting as a peripheral. Publish getPsm() to centrals (typically through a GATT characteristic) so they can connect.

Constructors

protected L2capServer()Constructed by ports; not application API.

Methods

public abstract int getPsm()The dynamic Protocol/Service Multiplexer the stack assigned to this listener; advertise it to centrals.
public abstract AsyncResource<L2capChannel> accept()Resolves with the next incoming L2capChannel.
public abstract void close()Stops listening; pending accept() calls fail with BluetoothError.IO_ERROR.

Inherited methods

Constructor details

L2capServer

protected L2capServer()
Constructed by ports; not application API.

Method details

getPsm

public abstract int getPsm()
The dynamic Protocol/Service Multiplexer the stack assigned to this listener; advertise it to centrals.

accept

public abstract AsyncResource<L2capChannel> accept()
Resolves with the next incoming L2capChannel. Call again after each resolution to accept further channels.

close

public abstract void close()
Stops listening; pending accept() calls fail with BluetoothError.IO_ERROR.