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   | 
    
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   | 
    
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   | 
    
int | 
        
          SOCKET_CONNECTION_FAILURE
          Error code during connect for generic socket connection failures.  | 
    
int | 
        
          SOCKET_MANAGER_FAILURE
          Error code returned by   | 
    
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   | 
    
Public constructors | |
|---|---|
      
      BluetoothSocketException(int code)
      
      
        Create a   | 
  |
      
      BluetoothSocketException(int code, String msg)
      
      
        Create a   | 
  |
Public methods | |
|---|---|
        
        
        
        
        
        int
     | 
  
    
      
      getErrorCode()
      
      
        Returns the error code associated to this failure.  | 
  
Inherited methods | |
|---|---|
Constants
BLUETOOTH_OFF_FAILURE
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
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
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
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
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
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
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
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
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
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
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
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
public static final int L2CAP_TIMEOUT
Error code during connect when L2CAP connection timeout.
Constant Value: 14 (0x0000000e)
L2CAP_UNACCEPTABLE_PARAMETERS
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
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
public static final int NULL_DEVICE
Error code during connect when null device attempts to do socket connection.
Constant Value: 19 (0x00000013)
RPC_FAILURE
public static final int RPC_FAILURE
Error code during connect when a Runtime RPC exception occurs.
Constant Value: 20 (0x00000014)
SOCKET_CLOSED
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
public static final int SOCKET_CONNECTION_FAILURE
Error code during connect for generic socket connection failures.
Constant Value: 18 (0x00000012)
SOCKET_MANAGER_FAILURE
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
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
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
public BluetoothSocketException (int code)
Create a BluetoothSocketException with an error code. A generic error message is
 generated based on the code provided.
| Parameters | |
|---|---|
code | 
        
          int: : error code representing the reason for failure.
 Value is UNSPECIFIED, L2CAP_UNKNOWN, L2CAP_ACL_FAILURE, L2CAP_CLIENT_SECURITY_FAILURE, L2CAP_INSUFFICIENT_AUTHENTICATION, L2CAP_INSUFFICIENT_AUTHORIZATION, L2CAP_INSUFFICIENT_ENCRYPT_KEY_SIZE, L2CAP_INSUFFICIENT_ENCRYPTION, L2CAP_INVALID_SOURCE_CID, L2CAP_SOURCE_CID_ALREADY_ALLOCATED, L2CAP_UNACCEPTABLE_PARAMETERS, L2CAP_INVALID_PARAMETERS, L2CAP_NO_RESOURCES, L2CAP_NO_PSM_AVAILABLE, L2CAP_TIMEOUT, BLUETOOTH_OFF_FAILURE, SOCKET_MANAGER_FAILURE, SOCKET_CLOSED, SOCKET_CONNECTION_FAILURE, NULL_DEVICE, RPC_FAILURE, or UNIX_FILE_SOCKET_CREATION_FAILURE | 
      
BluetoothSocketException
public BluetoothSocketException (int code, 
                String msg)Create a BluetoothSocketException with an error code and custom error message.
| Parameters | |
|---|---|
code | 
        
          int: : error code representing the reason for failure.
 Value is UNSPECIFIED, L2CAP_UNKNOWN, L2CAP_ACL_FAILURE, L2CAP_CLIENT_SECURITY_FAILURE, L2CAP_INSUFFICIENT_AUTHENTICATION, L2CAP_INSUFFICIENT_AUTHORIZATION, L2CAP_INSUFFICIENT_ENCRYPT_KEY_SIZE, L2CAP_INSUFFICIENT_ENCRYPTION, L2CAP_INVALID_SOURCE_CID, L2CAP_SOURCE_CID_ALREADY_ALLOCATED, L2CAP_UNACCEPTABLE_PARAMETERS, L2CAP_INVALID_PARAMETERS, L2CAP_NO_RESOURCES, L2CAP_NO_PSM_AVAILABLE, L2CAP_TIMEOUT, BLUETOOTH_OFF_FAILURE, SOCKET_MANAGER_FAILURE, SOCKET_CLOSED, SOCKET_CONNECTION_FAILURE, NULL_DEVICE, RPC_FAILURE, or UNIX_FILE_SOCKET_CREATION_FAILURE | 
      
msg | 
        
          String: : Custom error message associated to the failure.
 This value cannot be null. | 
      
Public methods
getErrorCode
public int getErrorCode ()
Returns the error code associated to this failure.