|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Throwable
java.lang.Exception
com.phidgets.PhidgetException
This class represents Phidget related exceptions. All Phidget exceptions originate in the phidget21 C library.
These exceptions can be thrown by most function in the library and cover such things as trying to access
a Phidget before opening it, or before it is attached and ready to use, out of bounds Index and data values,
trying to read data that isn't available, and other less common problems. EPHIDGET_(error) errors are thrown
by any API calls, EEPHIDGET_(error) errors are returned via the Error
event.
Field Summary | |
static int |
EEPHIDGET_BADPASSWORD
Authorization exception. |
static int |
EEPHIDGET_BADPOWER
Bad power exception. |
static int |
EEPHIDGET_BADVERSION
Version mismatch exception. |
static int |
EEPHIDGET_NETWORK
Network exception. |
static int |
EEPHIDGET_OUTOFRANGE
Out of range exception. |
static int |
EEPHIDGET_OVERCURRENT
Overcurrent exception. |
static int |
EEPHIDGET_OVERRUN
Overrun exception. |
static int |
EEPHIDGET_OVERTEMP
Overtemperature exception. |
static int |
EEPHIDGET_PACKETLOST
Packet lost exception. |
static int |
EEPHIDGET_WRAP
Wraparound exception. |
static int |
EPHIDGET_BADPASSWORD
Authorization exception. |
static int |
EPHIDGET_BADVERSION
Version mismatch exception. |
static int |
EPHIDGET_CLOSED
Phidget closed exception. |
static int |
EPHIDGET_DUPLICATE
Duplicate request exception. |
static int |
EPHIDGET_EVENT
Event exception. |
static int |
EPHIDGET_INTERRUPTED
Interrupted exception. |
static int |
EPHIDGET_INVALID
Invalid error exception. |
static int |
EPHIDGET_INVALIDARG
Invalid argument exception. |
static int |
EPHIDGET_NETWORK
Network exception. |
static int |
EPHIDGET_NETWORK_NOTCONNECTED
Network not connected exception. |
static int |
EPHIDGET_NOMEMORY
No memory exception. |
static int |
EPHIDGET_NOTATTACHED
Phidget not attached exception. |
static int |
EPHIDGET_NOTFOUND
Phidget not found exception. |
static int |
EPHIDGET_OUTOFBOUNDS
Out of bounds exception. |
static int |
EPHIDGET_TIMEOUT
Timeout exception. |
static int |
EPHIDGET_UNEXPECTED
Unexpected exception. |
static int |
EPHIDGET_UNKNOWNVAL
Value unknown exception. |
static int |
EPHIDGET_UNSUPPORTED
Unsupported exception. |
static int |
EPHIDGET_WRONGDEVICE
Wrong device exception. |
Constructor Summary | |
PhidgetException(int errno,
java.lang.String description)
Constructor which takes in an error number and description. |
Method Summary | |
java.lang.String |
getDescription()
Returns a description of this exception. |
int |
getErrorNumber()
Returns the error number of this exception. |
java.lang.String |
toString()
Returns a string containing the error number and exception description. |
Methods inherited from class java.lang.Throwable |
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int EPHIDGET_NOTFOUND
This exception is not currently used externally.
This is returned by getErrorNumber
public static final int EPHIDGET_NOMEMORY
This exception is thrown when a memory allocation (malloc) call fails in the c library.
This is returned by getErrorNumber
public static final int EPHIDGET_UNEXPECTED
This exception is thrown when something unexpected happens (more enexpected then another exception). This generally points to a bug or bad code in the C library, and hopefully won't even be seen.
This is returned by getErrorNumber
public static final int EPHIDGET_INVALIDARG
This exception is thrown whenever a function receives an unexpected null pointer, or a value that is out of range. ie setting a motor's speed to 101 when the maximum is 100.
This is returned by getErrorNumber
public static final int EPHIDGET_NOTATTACHED
This exception is thrown when a method is called on a device that is not attached, and the method requires the device to be attached. ie trying to read the serial number, or the state of an ouput.
This is returned by getErrorNumber
public static final int EPHIDGET_INTERRUPTED
This exception is not currently used externally.
This is returned by getErrorNumber
public static final int EPHIDGET_INVALID
This exception is thrown when trying to get the string description of an undefined error code. This should not be seen in Java.
This is returned by getErrorNumber
public static final int EPHIDGET_NETWORK
This exception is thrown when a network related error occurs. The EEPHIDGET_NETWORK
code is more often used (in error events)
because most network exceptions come through asynchronously.
This is returned by getErrorNumber
public static final int EPHIDGET_UNKNOWNVAL
This exception is thrown when a device that is set to unknow is read. ie trying to read the position of a servo before setting it's position.
Every effort is made in the library to fill in as much of a device's state before the attach event gets thrown, however, many there are some states that cannot be filled in automatically. ie older interface kits do not return their output states, and so these will be unknown until they are set.
This is a quite common exception for some devices, and so should always be caught
This is returned by getErrorNumber
public static final int EPHIDGET_BADPASSWORD
This exception has been replaced by EEPHIDGET_BADPASSWORD
.
This is returned by getErrorNumber
public static final int EPHIDGET_UNSUPPORTED
This exception is thrown when a method is called that is not supported, either by that device, or by the system. ie calling setRatiometric on an interfaceKit that does not have sensors.
This is also used for methods that are not yet complete, ie setLabel on Windows.
This is returned by getErrorNumber
public static final int EPHIDGET_DUPLICATE
This exception is thrown when open is called twice on a device, without calling close in between. The second call to open is ignored.
This is returned by getErrorNumber
public static final int EPHIDGET_TIMEOUT
This exception is thrown by waitForAttachment(int)
if the provided timeout expires before an attach happens.
This may also be thrown by a device set request, if the set times out - though this should not happen, and would generally mean a problem with the device.
This is returned by getErrorNumber
public static final int EPHIDGET_OUTOFBOUNDS
This exception is thrown anytime an indexed set or get method is called with an out of bounds index.
This is returned by getErrorNumber
public static final int EPHIDGET_EVENT
This exception is not currently used.
This is returned by getErrorNumber
public static final int EPHIDGET_NETWORK_NOTCONNECTED
This exception is thrown when a network specific method is called on a device that was opened remotely, but there is no connection to a server. ie getServerID.
This is returned by getErrorNumber
public static final int EPHIDGET_WRONGDEVICE
This exception is thrown when a method from device is called by another device. ie casting an InterfaceKit to a Servo and calling setPosition.
This is returned by getErrorNumber
public static final int EPHIDGET_CLOSED
This exception is thrown when waitForAttachment
is called on a Phidget that has not been opened, or was closed.
This is returned by getErrorNumber
public static final int EPHIDGET_BADVERSION
This exception has been replaced by EEPHIDGET_BADVERSION
.
This is returned by getErrorNumber
public static final int EEPHIDGET_NETWORK
This exception is sent via the Error
event. It will be accompanied by a specific Description of the network problem.
This is returned by getErrorNumber
public static final int EEPHIDGET_BADPASSWORD
This exception is sent via the Error
event. It means that a connection could not be authenticated because of a passwrod missmatch.
This is returned by getErrorNumber
public static final int EEPHIDGET_BADVERSION
This exception is sent via the Error
event when trying to connect to a remote phidget and the webservice version does not match your client library version.
This is returned by getErrorNumber
public static final int EEPHIDGET_OVERRUN
This exception sent via in the Error
event. It is accompanied by a specific description
.
This is returned by getErrorNumber
public static final int EEPHIDGET_PACKETLOST
This exception sent via in the Error
event. It is accompanied by a specific description
.
This is returned by getErrorNumber
public static final int EEPHIDGET_WRAP
This exception sent via in the Error
event. It is accompanied by a specific description
.
This is returned by getErrorNumber
public static final int EEPHIDGET_OVERTEMP
This exception sent via in the Error
event. It is accompanied by a specific description
.
This is returned by getErrorNumber
public static final int EEPHIDGET_OVERCURRENT
This exception sent via in the Error
event. It is accompanied by a specific description
.
This is returned by getErrorNumber
public static final int EEPHIDGET_OUTOFRANGE
This exception sent via in the Error
event. It is accompanied by a specific description
.
This is returned by getErrorNumber
public static final int EEPHIDGET_BADPOWER
This exception sent via in the Error
event. It is accompanied by a specific description
.
This is returned by getErrorNumber
Constructor Detail |
public PhidgetException(int errno, java.lang.String description)
Method Detail |
public int getErrorNumber()
There are 19 error codes defined, as follows:
EPHIDGET_NOTFOUND
,
EPHIDGET_NOMEMORY
,
EPHIDGET_UNEXPECTED
,
EPHIDGET_INVALIDARG
,
EPHIDGET_NOTATTACHED
,
EPHIDGET_INTERRUPTED
,
EPHIDGET_INVALID
,
EPHIDGET_NETWORK
,
EPHIDGET_UNKNOWNVAL
,
EPHIDGET_BADPASSWORD
,
EPHIDGET_UNSUPPORTED
,
EPHIDGET_DUPLICATE
,
EPHIDGET_TIMEOUT
,
EPHIDGET_OUTOFBOUNDS
,
EPHIDGET_EVENT
,
EPHIDGET_NETWORK_NOTCONNECTED
,
EPHIDGET_WRONGDEVICE
,
EPHIDGET_CLOSED
and
EPHIDGET_BADVERSION
There are also 9 error event codes defined, as follows:
EEPHIDGET_NETWORK
,
EEPHIDGET_BADPASSWORD
,
EEPHIDGET_BADVERSION
,
EEPHIDGET_OVERRUN
,
EEPHIDGET_PACKETLOST
,
EEPHIDGET_WRAP
,
EEPHIDGET_OVERTEMP
,
EEPHIDGET_OVERCURRENT
,
EEPHIDGET_OUTOFRANGE
public java.lang.String getDescription()
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |