BluetoothSocketException


public class BluetoothSocketException
extends IOException

java.lang.Object
   ↳ java.lang.Throwable
     ↳ java.lang.Exception
       ↳ java.io.IOException
         ↳ android.bluetooth.BluetoothSocketException


Thrown when an error occurs during a Bluetooth Socket related exception.

This is currently intended to be thrown for a failure during BluetoothSocket operations.

Summary

Constants

int BLUETOOTH_OFF_FAILURE

Error code returned by BluetoothSocket during a socket operation that failed because Bluetooth is turned off.

int L2CAP_ACL_FAILURE

Error code during connect when there is an ACL connection failure.

int L2CAP_CLIENT_SECURITY_FAILURE

Error code during connect when security clearance fails on the client during L2CAP connection.

int L2CAP_INSUFFICIENT_AUTHENTICATION

Error code during connect when authentication fails on the peer device during L2CAP connection.

int L2CAP_INSUFFICIENT_AUTHORIZATION

Error code during connect when authorization fails on the peer device during L2CAP connection.

int L2CAP_INSUFFICIENT_ENCRYPTION

Error code during connect for insufficient encryption from the peer device during L2CAP connection.

int L2CAP_INSUFFICIENT_ENCRYPT_KEY_SIZE

Error code during connect indicating insufficient encryption key size on the peer device during L2CAP connection.

int L2CAP_INVALID_PARAMETERS

Error code during connect for invalid parameters from the peer device during L2CAP connection.

int L2CAP_INVALID_SOURCE_CID

Error code during connect for invalid Channel ID from the peer device during L2CAP connection.

int L2CAP_NO_PSM_AVAILABLE

Error code during connect when no PSM is available for L2CAP connection.

int L2CAP_NO_RESOURCES

Error code during connect when no resources are available for L2CAP connection.

int L2CAP_SOURCE_CID_ALREADY_ALLOCATED

Error code during connect for already allocated Channel ID from the peer device during L2CAP connection.

int L2CAP_TIMEOUT

Error code during connect when L2CAP connection timeout.

int L2CAP_UNACCEPTABLE_PARAMETERS

Error code during connect for unacceptable Parameters from the peer device during L2CAP connection.

int L2CAP_UNKNOWN

Error code returned by BluetoothSocket during a L2CAP-related socket operation that failed for an unknown reason.

int NULL_DEVICE

Error code during connect when null device attempts to do socket connection.

int RPC_FAILURE

Error code during connect when a Runtime RPC exception occurs.

int SOCKET_CLOSED

Error code returned by BluetoothSocket during a socket operation that failed because the socket has been closed.

int SOCKET_CONNECTION_FAILURE

Error code during connect for generic socket connection failures.

int SOCKET_MANAGER_FAILURE

Error code returned by BluetoothSocket during a socket operation that failed because socket manager is not available.

int UNIX_FILE_SOCKET_CREATION_FAILURE

Error code during connect when the UNIX socket connection creation fails.

int UNSPECIFIED

Error code representing a failure during BluetoothSocket.

Public constructors

BluetoothSocketException(int code)

Create a BluetoothSocketException with an error code.

BluetoothSocketException(int code, String msg)

Create a BluetoothSocketException with an error code and custom error message.

Public methods

int getErrorCode()

Returns the error code associated to this failure.

Inherited methods

final void addSuppressed(Throwable exception)

Appends the specified exception to the exceptions that were suppressed in order to deliver this exception.

Throwable fillInStackTrace()

Fills in the execution stack trace.

Throwable getCause()

Returns the cause of this throwable or null if the cause is nonexistent or unknown.

String getLocalizedMessage()

Creates a localized description of this throwable.

String getMessage()

Returns the detail message string of this throwable.

StackTraceElement[] getStackTrace()

Provides programmatic access to the stack trace information printed by printStackTrace().

final Throwable[] getSuppressed()

Returns an array containing all of the exceptions that were suppressed, typically by the try-with-resources statement, in order to deliver this exception.

Throwable initCause(Throwable cause)

Initializes the cause of this throwable to the specified value.

void printStackTrace()

Prints this throwable and its backtrace to the standard error stream.

void printStackTrace(PrintWriter s)

Prints this throwable and its backtrace to the specified print writer.

void printStackTrace(PrintStream s)

Prints this throwable and its backtrace to the specified print stream.

void setStackTrace(StackTraceElement[] stackTrace)

Sets the stack trace elements that will be returned by getStackTrace() and printed by printStackTrace() and related methods.

String toString()

Returns a short description of this throwable.

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Constants

BLUETOOTH_OFF_FAILURE

Added in API level 34
public static final int BLUETOOTH_OFF_FAILURE

Error code returned by BluetoothSocket during a socket operation that failed because Bluetooth is turned off.

Constant Value: 15 (0x0000000f)

L2CAP_ACL_FAILURE

Added in API level 34
public static final int L2CAP_ACL_FAILURE

Error code during connect when there is an ACL connection failure.

Constant Value: 2 (0x00000002)

L2CAP_CLIENT_SECURITY_FAILURE

Added in API level 34
public static final int L2CAP_CLIENT_SECURITY_FAILURE

Error code during connect when security clearance fails on the client during L2CAP connection.

Constant Value: 3 (0x00000003)

L2CAP_INSUFFICIENT_AUTHENTICATION

Added in API level 34
public static final int L2CAP_INSUFFICIENT_AUTHENTICATION

Error code during connect when authentication fails on the peer device during L2CAP connection.

Constant Value: 4 (0x00000004)

L2CAP_INSUFFICIENT_AUTHORIZATION

Added in API level 34
public static final int L2CAP_INSUFFICIENT_AUTHORIZATION

Error code during connect when authorization fails on the peer device during L2CAP connection.

Constant Value: 5 (0x00000005)

L2CAP_INSUFFICIENT_ENCRYPTION

Added in API level 34
public static final int L2CAP_INSUFFICIENT_ENCRYPTION

Error code during connect for insufficient encryption from the peer device during L2CAP connection.

Constant Value: 7 (0x00000007)

L2CAP_INSUFFICIENT_ENCRYPT_KEY_SIZE

Added in API level 34
public static final int L2CAP_INSUFFICIENT_ENCRYPT_KEY_SIZE

Error code during connect indicating insufficient encryption key size on the peer device during L2CAP connection.

Constant Value: 6 (0x00000006)

L2CAP_INVALID_PARAMETERS

Added in API level 34
public static final int L2CAP_INVALID_PARAMETERS

Error code during connect for invalid parameters from the peer device during L2CAP connection.

Constant Value: 11 (0x0000000b)

L2CAP_INVALID_SOURCE_CID

Added in API level 34
public static final int L2CAP_INVALID_SOURCE_CID

Error code during connect for invalid Channel ID from the peer device during L2CAP connection.

Constant Value: 8 (0x00000008)

L2CAP_NO_PSM_AVAILABLE

Added in API level 34
public static final int L2CAP_NO_PSM_AVAILABLE

Error code during connect when no PSM is available for L2CAP connection.

Constant Value: 13 (0x0000000d)

L2CAP_NO_RESOURCES

Added in API level 34
public static final int L2CAP_NO_RESOURCES

Error code during connect when no resources are available for L2CAP connection.

Constant Value: 12 (0x0000000c)

L2CAP_SOURCE_CID_ALREADY_ALLOCATED

Added in API level 34
public static final int L2CAP_SOURCE_CID_ALREADY_ALLOCATED

Error code during connect for already allocated Channel ID from the peer device during L2CAP connection.

Constant Value: 9 (0x00000009)

L2CAP_TIMEOUT

Added in API level 34
public static final int L2CAP_TIMEOUT

Error code during connect when L2CAP connection timeout.

Constant Value: 14 (0x0000000e)

L2CAP_UNACCEPTABLE_PARAMETERS

Added in API level 34
public static final int L2CAP_UNACCEPTABLE_PARAMETERS

Error code during connect for unacceptable Parameters from the peer device during L2CAP connection.

Constant Value: 10 (0x0000000a)

L2CAP_UNKNOWN

Added in API level 34
public static final int L2CAP_UNKNOWN

Error code returned by BluetoothSocket during a L2CAP-related socket operation that failed for an unknown reason.

Constant Value: 1 (0x00000001)

NULL_DEVICE

Added in API level 34
public static final int NULL_DEVICE

Error code during connect when null device attempts to do socket connection.

Constant Value: 19 (0x00000013)

RPC_FAILURE

Added in API level 34
public static final int RPC_FAILURE

Error code during connect when a Runtime RPC exception occurs.

Constant Value: 20 (0x00000014)

SOCKET_CLOSED

Added in API level 34
public static final int SOCKET_CLOSED

Error code returned by BluetoothSocket during a socket operation that failed because the socket has been closed.

Constant Value: 17 (0x00000011)

SOCKET_CONNECTION_FAILURE

Added in API level 34
public static final int SOCKET_CONNECTION_FAILURE

Error code during connect for generic socket connection failures.

Constant Value: 18 (0x00000012)

SOCKET_MANAGER_FAILURE

Added in API level 34
public static final int SOCKET_MANAGER_FAILURE

Error code returned by BluetoothSocket during a socket operation that failed because socket manager is not available.

Constant Value: 16 (0x00000010)

UNIX_FILE_SOCKET_CREATION_FAILURE

Added in API level 35
public static final int UNIX_FILE_SOCKET_CREATION_FAILURE

Error code during connect when the UNIX socket connection creation fails.

Constant Value: 21 (0x00000015)

UNSPECIFIED

Added in API level 34
public static final int UNSPECIFIED

Error code representing a failure during BluetoothSocket. The reason for failure isn't specified.

Constant Value: 0 (0x00000000)

Public constructors

BluetoothSocketException

Added in API level 34
public BluetoothSocketException (int code)

Create a BluetoothSocketException with an error code. A generic error message is generated based on the code provided.

BluetoothSocketException

Added in API level 34
public BluetoothSocketException (int code, 
                String msg)

Create a BluetoothSocketException with an error code and custom error message.

Public methods