diff options
| author | Stanley Tng <stng@google.com> | 2017-11-22 16:04:40 -0800 |
|---|---|---|
| committer | Stanley Tng <stng@google.com> | 2018-01-12 07:26:14 -0800 |
| commit | e48468d8be0c74fec135bb12d84b23cc0168cd53 (patch) | |
| tree | 394817cb21a64da5dae6c570eaba9c2091ddeec7 /core/java/android/bluetooth/BluetoothServerSocket.java | |
| parent | ee48176ad6bb61abf4a2eb1024be2a1ee555c8a8 (diff) | |
Added APIs for Connection-oriented channels
Experimental and hidden APIs are defined for the Connection-oriented Channel
(CoC) features. The APIs using PSM are implemented.
Test: Can compile
Bug: 70683224
Change-Id: Icdb5fa190b0e21881a60437fa48cd575371ee1e4
Diffstat (limited to 'core/java/android/bluetooth/BluetoothServerSocket.java')
| -rw-r--r-- | core/java/android/bluetooth/BluetoothServerSocket.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/core/java/android/bluetooth/BluetoothServerSocket.java b/core/java/android/bluetooth/BluetoothServerSocket.java index 58d090dc287b..ebb7f187aea5 100644 --- a/core/java/android/bluetooth/BluetoothServerSocket.java +++ b/core/java/android/bluetooth/BluetoothServerSocket.java @@ -68,6 +68,7 @@ import java.io.IOException; public final class BluetoothServerSocket implements Closeable { private static final String TAG = "BluetoothServerSocket"; + private static final boolean DBG = false; /*package*/ final BluetoothSocket mSocket; private Handler mHandler; private int mMessage; @@ -169,6 +170,7 @@ public final class BluetoothServerSocket implements Closeable { * close any {@link BluetoothSocket} received from {@link #accept()}. */ public void close() throws IOException { + if (DBG) Log.d(TAG, "BluetoothServerSocket:close() called. mChannel=" + mChannel); synchronized (this) { if (mHandler != null) { mHandler.obtainMessage(mMessage).sendToTarget(); @@ -197,6 +199,20 @@ public final class BluetoothServerSocket implements Closeable { } /** + * Returns the assigned dynamic protocol/service multiplexer (PSM) value for the listening L2CAP + * Connection-oriented Channel (CoC) server socket. This server socket must be returned by the + * {#link BluetoothAdapter.listenUsingL2capCoc(int)} or {#link + * BluetoothAdapter.listenUsingInsecureL2capCoc(int)}. The returned value is undefined if this + * method is called on non-L2CAP server sockets. + * + * @return the assigned PSM or LE_PSM value depending on transport + * @hide + */ + public int getPsm() { + return mChannel; + } + + /** * Sets the channel on which future sockets are bound. * Currently used only when a channel is auto generated. */ @@ -227,6 +243,10 @@ public final class BluetoothServerSocket implements Closeable { sb.append("TYPE_L2CAP"); break; } + case BluetoothSocket.TYPE_L2CAP_LE: { + sb.append("TYPE_L2CAP_LE"); + break; + } case BluetoothSocket.TYPE_SCO: { sb.append("TYPE_SCO"); break; |
