/**@class android.bluetooth.BluetoothServerSocket implements java.io.Closeable @extends java.lang.Object A listening Bluetooth socket. <p>The interface for Bluetooth Sockets is similar to that of TCP sockets: {@link java.net.Socket} and {@link java.net.ServerSocket}. On the server side, use a {@link android.bluetooth.BluetoothServerSocket} to create a listening server socket. When a connection is accepted by the {@link android.bluetooth.BluetoothServerSocket}, it will return a new {@link android.bluetooth.BluetoothSocket} to manage the connection. On the client side, use a single {@link android.bluetooth.BluetoothSocket} to both initiate an outgoing connection and to manage the connection. <p>For Bluetooth BR/EDR, the most common type of socket is RFCOMM, which is the type supported by the Android APIs. RFCOMM is a connection-oriented, streaming transport over Bluetooth BR/EDR. It is also known as the Serial Port Profile (SPP). To create a listening {@link android.bluetooth.BluetoothServerSocket} that's ready for incoming Bluetooth BR/EDR connections, use {@link android.bluetooth.BluetoothAdapter#listenUsingRfcommWithServiceRecord android.bluetooth.BluetoothAdapter.listenUsingRfcommWithServiceRecord()}. <p>For Bluetooth LE, the socket uses LE Connection-oriented Channel (CoC). LE CoC is a connection-oriented, streaming transport over Bluetooth LE and has a credit-based flow control. Correspondingly, use {@link android.bluetooth.BluetoothAdapter#listenUsingL2capChannel android.bluetooth.BluetoothAdapter.listenUsingL2capChannel()} to create a listening {@link android.bluetooth.BluetoothServerSocket} that's ready for incoming Bluetooth LE CoC connections. For LE CoC, you can use {@link #getPsm}() to get the protocol/service multiplexer (PSM) value that the peer needs to use to connect to your socket. <p> After the listening {@link android.bluetooth.BluetoothServerSocket} is created, call {@link #accept}() to listen for incoming connection requests. This call will block until a connection is established, at which point, it will return a {@link android.bluetooth.BluetoothSocket} to manage the connection. Once the {@link android.bluetooth.BluetoothSocket} is acquired, it's a good idea to call {@link #close}() on the {@link android.bluetooth.BluetoothServerSocket} when it's no longer needed for accepting connections. Closing the {@link android.bluetooth.BluetoothServerSocket} will <em>not</em> close the returned {@link android.bluetooth.BluetoothSocket}. <p>{@link android.bluetooth.BluetoothServerSocket} is thread safe. In particular, {@link #close} will always immediately abort ongoing operations and close the server socket. <p class="note"><strong>Note:</strong> Requires the {@link android.Manifest.permission#BLUETOOTH} permission. <div class="special reference"> <h3>Developer Guides</h3> <p>For more information about using Bluetooth, read the <a href="{@docRoot}guide/topics/connectivity/bluetooth.html">Bluetooth</a> developer guide.</p> </div> {@see BluetoothSocket} */ var BluetoothServerSocket = { /**Block until a connection is established. <p>Returns a connected {@link android.bluetooth.BluetoothSocket} on successful connection. <p>Once this call returns, it can be called again to accept subsequent incoming connections. <p>{@link #close} can be used to abort this call from another thread. @return {Object {android.bluetooth.BluetoothSocket}} a connected {@link BluetoothSocket} @throws IOException on error, for example this call was aborted, or timeout */ accept : function( ) {}, /**Block until a connection is established, with timeout. <p>Returns a connected {@link android.bluetooth.BluetoothSocket} on successful connection. <p>Once this call returns, it can be called again to accept subsequent incoming connections. <p>{@link #close} can be used to abort this call from another thread. @return {Object {android.bluetooth.BluetoothSocket}} a connected {@link BluetoothSocket} @throws IOException on error, for example this call was aborted, or timeout */ accept : function( ) {}, /**Immediately close this socket, and release all associated resources. <p>Causes blocked calls on this socket in other threads to immediately throw an IOException. <p>Closing the {@link android.bluetooth.BluetoothServerSocket} will <em>not</em> close any {@link android.bluetooth.BluetoothSocket} received from {@link #accept}(). */ close : function( ) {}, /**Returns the channel on which this socket is bound. @hide */ getChannel : function( ) {}, /**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 android.bluetooth.BluetoothAdapter#listenUsingL2capChannel()} or {@link android.bluetooth.BluetoothAdapter#listenUsingInsecureL2capChannel()}. The returned value is undefined if this method is called on non-L2CAP server sockets. @return {Number} the assigned PSM or LE_PSM value depending on transport */ getPsm : function( ) {}, /** */ toString : function( ) {}, };