Merge "Add more documentation for LE CoC"

am: 964f6265ad

Change-Id: I40ba8a95f3df26cd7d036c781cd867abdb10ba6f
This commit is contained in:
Stanley Tng
2019-04-21 19:17:24 -07:00
committed by android-build-merger
2 changed files with 23 additions and 15 deletions

View File

@@ -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.

View File

@@ -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