Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1fdd0822 authored by Stanley Tng's avatar Stanley Tng
Browse files

Add more documentation for LE CoC

Added more information into Android SDK for LE Connection-oriented
Channels (CoC) so that it matches the corresponding RFComm
documentation.

Bug: 70683224
Test: Compile
Change-Id: I40abde70a7ca6bcd194ee75bd8367c0ed9e97d05
(cherry picked from commit bcbc1302351cbba2f786384293271fdc4289678f)
Merged-In: I40abde70a7ca6bcd194ee75bd8367c0ed9e97d05
parent dd916b81
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -56,7 +56,8 @@ import java.util.UUID;
 * returned by {@link BluetoothAdapter#getBondedDevices()
 * returned by {@link BluetoothAdapter#getBondedDevices()
 * BluetoothAdapter.getBondedDevices()}. You can then open a
 * BluetoothAdapter.getBondedDevices()}. You can then open a
 * {@link BluetoothSocket} for communication with the remote device, using
 * {@link BluetoothSocket} for communication with the remote device, using
 * {@link #createRfcommSocketToServiceRecord(UUID)}.
 * {@link #createRfcommSocketToServiceRecord(UUID)} over Bluetooth BR/EDR or using
 * {@link #createL2capChannel(int)} over Bluetooth LE.
 *
 *
 * <p class="note"><strong>Note:</strong>
 * <p class="note"><strong>Note:</strong>
 * Requires the {@link android.Manifest.permission#BLUETOOTH} permission.
 * Requires the {@link android.Manifest.permission#BLUETOOTH} permission.
+21 −14
Original line number Original line Diff line number Diff line
@@ -35,21 +35,28 @@ import java.io.IOException;
 * On the client side, use a single {@link BluetoothSocket} to both initiate
 * On the client side, use a single {@link BluetoothSocket} to both initiate
 * an outgoing connection and to manage the connection.
 * an outgoing connection and to manage the connection.
 *
 *
 * <p>The most common type of Bluetooth socket is RFCOMM, which is the type
 * <p>For Bluetooth BR/EDR, the most common type of socket is RFCOMM, which is the type supported by
 * supported by the Android APIs. RFCOMM is a connection-oriented, streaming
 * the Android APIs. RFCOMM is a connection-oriented, streaming transport over Bluetooth BR/EDR. It
 * transport over Bluetooth. It is also known as the Serial Port Profile (SPP).
 * is also known as the Serial Port Profile (SPP). To create a listening
 * {@link BluetoothServerSocket} that's ready for incoming Bluetooth BR/EDR connections, use {@link
 * BluetoothAdapter#listenUsingRfcommWithServiceRecord
 * BluetoothAdapter.listenUsingRfcommWithServiceRecord()}.
 *
 *
 * <p>To create a listening {@link BluetoothServerSocket} that's ready for
 * <p>For Bluetooth LE, the socket uses LE Connection-oriented Channel (CoC). LE CoC is a
 * incoming connections, use
 * connection-oriented, streaming transport over Bluetooth LE and has a credit-based flow control.
 * {@link BluetoothAdapter#listenUsingRfcommWithServiceRecord
 * Correspondingly, use {@link BluetoothAdapter#listenUsingL2capChannel
 * BluetoothAdapter.listenUsingRfcommWithServiceRecord()}. Then call
 * BluetoothAdapter.listenUsingL2capChannel()} to create a listening {@link BluetoothServerSocket}
 * {@link #accept()} to listen for incoming connection requests. This call
 * that's ready for incoming Bluetooth LE CoC connections. For LE CoC, you can use {@link #getPsm()}
 * will block until a connection is established, at which point, it will return
 * to get the protocol/service multiplexer (PSM) value that the peer needs to use to connect to your
 * a {@link BluetoothSocket} to manage the connection. Once the {@link
 * socket.
 * BluetoothSocket} is acquired, it's a good idea to call {@link #close()} on
 *
 * the {@link BluetoothServerSocket} when it's no longer needed for accepting
 * <p> After the listening {@link BluetoothServerSocket} is created, call {@link #accept()} to
 * connections. Closing the {@link BluetoothServerSocket} will <em>not</em>
 * listen for incoming connection requests. This call will block until a connection is established,
 * close the returned {@link BluetoothSocket}.
 * at which point, it will return a {@link BluetoothSocket} to manage the connection. Once the
 * {@link BluetoothSocket} is acquired, it's a good idea to call {@link #close()} on the {@link
 * BluetoothServerSocket} when it's no longer needed for accepting
 * connections. Closing the {@link BluetoothServerSocket} will <em>not</em> close the returned
 * {@link BluetoothSocket}.
 *
 *
 * <p>{@link BluetoothServerSocket} is thread
 * <p>{@link BluetoothServerSocket} is thread
 * safe. In particular, {@link #close} will always immediately abort ongoing
 * safe. In particular, {@link #close} will always immediately abort ongoing