public class DeviceException
extends java.lang.Exception
DeviceException
class represents exceptions that occur when access problems are detected by
service controls in the device handling logic. It is designed to be lightweight and suitable for dynamic
creation and disposal, even in resource-constrained environments.
This exception class does not provide "set" methods for its fields; the cause of the exception is set
exclusively by constructors. Each DeviceException
instance has an associated error code that indicates
the reason for the exception. The descriptions of these codes provide context for their occurrence.
Modifier and Type | Field and Description |
---|---|
static int |
ARGUMENT_EXCEPTION
Parameter error
|
static int |
BAD_CONTROL_MODE
Indicates that the device object is not in the appropriate mode to perform the requested action.
|
static int |
DUPLICATE_USER_KEY
Duplicate user key
|
static int |
GENERAL_EXCEPTION
Other undefined exception
|
static int |
LEVEL_3_HALTED
Level 3 halted
|
static int |
NO_IMPLEMENT
Device doesn't support the request
|
static int |
NO_PERMISSION
No permissions associated
|
static int |
NO_REQUEST_PENDING
No request was pending when cancelRequest() was invoked
|
static int |
REQUEST_PENDING
Indicates that a previous request made by this device object has not been completed.
|
static int |
TIMEOUT_EXCEPTION
Time out
|
Constructor and Description |
---|
DeviceException(int code)
Constructs an
DeviceException with the given detail message
code. |
DeviceException(int code,
java.lang.String message) |
DeviceException(int code,
java.lang.String message,
java.lang.Throwable throwable) |
DeviceException(java.lang.String message)
Constructs an
DeviceException with the given detail message. |
DeviceException(java.lang.Throwable throwable) |
Modifier and Type | Method and Description |
---|---|
int |
getCode()
Retrieves the error code associated with this exception.
|
java.lang.String |
toString()
Returns a short description of this exception, including the error code and message.
|
public static final int BAD_CONTROL_MODE
open()
is called while the device is already open.
open()
is called while the device is not open.
public static final int NO_IMPLEMENT
public static final int REQUEST_PENDING
public static final int NO_REQUEST_PENDING
public static final int NO_PERMISSION
public static final int GENERAL_EXCEPTION
public static final int ARGUMENT_EXCEPTION
public static final int DUPLICATE_USER_KEY
public static final int TIMEOUT_EXCEPTION
public static final int LEVEL_3_HALTED
public DeviceException(int code)
DeviceException
with the given detail message
code.
code
- a constant, defined in DeviceException, identifying
the cause of the exceptionpublic DeviceException(java.lang.String message)
DeviceException
with the given detail message.message
- public DeviceException(int code, java.lang.String message)
public DeviceException(java.lang.Throwable throwable)
public DeviceException(int code, java.lang.String message, java.lang.Throwable throwable)
public final int getCode()
public java.lang.String toString()
toString
in class java.lang.Throwable