L2CAP

JSR-82 defines the L2CAPConnectionNotifier and L2CAPConnection interfaces for sending and receiving packets over L2CAP channels. These are derived from the CLDC Generic Connection Framework interface Connection.

An L2CAP server is created by calling Connector.open() with an appropriate server connection string. The format of the string is defined by JSR-82. The connector string begins with the protocol prefix “btl2cap://” and may contain parameters related to a master/slave preference, or security parameters (authentication, encryption, and authorization). It may also contain parameters related to the application’s preference for a desired Maximum Transmit Unit (MTU) size in the send and/or receive directions. An L2CAPConnectionNotifier object is returned when opening a server connection. The method acceptAndOpen can be used to accept connections from remote clients.

L2CAP packets are sent or received using the send and receive methods of class L2CAPConnection. An application using L2CAP connections must provide its own flow control if needed.

L2CAP clients are created in a similar way with method Connector.open() using a client connection string.