javax.bluetooth
Class BluetoothConnectionException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--java.io.IOException
                    |
                    +--javax.bluetooth.BluetoothConnectionException

public class BluetoothConnectionException
extends java.io.IOException

This BluetoothConnectionException is thrown when a Bluetooth connection (L2CAP, RFCOMM, or OBEX over RFCOMM) cannot be established successfully. The fields in this exception class indicate the cause of the exception. For example, an L2CAP connection may fail due to a security problem. This reason is passed on to the application through this class.


Field Summary
static int FAILED_NOINFO
          Indicates the connection to the server failed due to unknown reasons.
static int NO_RESOURCES
          Indicates the connection failed due to a lack of resources either on the local device or on the remote device.
static int SECURITY_BLOCK
          Indicates the connection failed because the security settings on the local device or the remote device were incompatible with the request.
static int TIMEOUT
          Indicates the connection to the server failed due to a timeout.
static int UNACCEPTABLE_PARAMS
          Indicates the connection failed because the configuration parameters provided were not acceptable to either the remote device or the local device.
static int UNKNOWN_PSM
          Indicates the connection to the server failed because no service for the given PSM was registered.
 
Constructor Summary
BluetoothConnectionException(int error)
          Creates a new BluetoothConnectionException with the error indicator specified.
BluetoothConnectionException(int error, java.lang.String msg)
          Creates a new BluetoothConnectionException with the error indicator and message specified.
 
Method Summary
 int getStatus()
          Gets the status set in the constructor that will indicate the reason for the exception.
 
Methods inherited from class java.lang.Throwable
getMessage, printStackTrace, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNKNOWN_PSM

public static final int UNKNOWN_PSM
Indicates the connection to the server failed because no service for the given PSM was registered.

The value for UNKNOWN_PSM is 0x0001 (1).


SECURITY_BLOCK

public static final int SECURITY_BLOCK
Indicates the connection failed because the security settings on the local device or the remote device were incompatible with the request.

The value for SECURITY_BLOCK is 0x0002 (2).


NO_RESOURCES

public static final int NO_RESOURCES
Indicates the connection failed due to a lack of resources either on the local device or on the remote device.

The value for NO_RESOURCES is 0x0003 (3).


FAILED_NOINFO

public static final int FAILED_NOINFO
Indicates the connection to the server failed due to unknown reasons.

The value for FAILED_NOINFO is 0x0004 (4).


TIMEOUT

public static final int TIMEOUT
Indicates the connection to the server failed due to a timeout.

The value for TIMEOUT is 0x0005 (5).


UNACCEPTABLE_PARAMS

public static final int UNACCEPTABLE_PARAMS
Indicates the connection failed because the configuration parameters provided were not acceptable to either the remote device or the local device.

The value for UNACCEPTABLE_PARAMS is 0x0006 (6).

Constructor Detail

BluetoothConnectionException

public BluetoothConnectionException(int error)
Creates a new BluetoothConnectionException with the error indicator specified.
Parameters:
error - indicates the exception condition; must be one of the constants described in this class
Throws:
IllegalArgumentException - if the input value is not one of the constants in this class

BluetoothConnectionException

public BluetoothConnectionException(int error,
                                    java.lang.String msg)
Creates a new BluetoothConnectionException with the error indicator and message specified.
Parameters:
error - indicates the exception condition; must be one of the constants described in this class
msg - a description of the exception; may by null
Throws:
IllegalArgumentException - if the input value is not one of the constants in this class
Method Detail

getStatus

public int getStatus()
Gets the status set in the constructor that will indicate the reason for the exception.
Returns:
cause for the exception; will be one of the constants defined in this class