00001 #ifndef CPHIDGET_CONSTANTS_INTERNAL 00002 #define CPHIDGET_CONSTANTS_INTERNAL 00003 00004 //internal status representation via flags - for Phidget, Manager, Dictionary 00005 /* 00006 * PHIDGET_ATTACHED_FLAG 00007 * true: Phidget is attached to computer, and you can call all commands on this handle 00008 * false: Phidget is not ready to handle calls yet - might be not connected, 00009 * in proccess of connecting, just disconnected, not initialized, etc. 00010 * This flag is returend externally to users. 00011 */ 00012 #define PHIDGET_ATTACHED_FLAG 0x01 00013 /* 00014 * PHIDGET_DETACHING_FLAG 00015 * true: Phidget has just been detached, but the detach code is still running 00016 * false: Any other time 00017 * There are two types of funtions - those that communicate with devices and those that 00018 * return cached info - the second class should succedd if this is true and PHIDGET_ATTACHED_FLAG is false, 00019 * so we can get device info in the detach handler. 00020 */ 00021 #define PHIDGET_DETACHING_FLAG 0x02 00022 /* 00023 * PHIDGET_USB_ERROR_FLAG 00024 * true: Phidget has encountered a USB error bad enough to require a detach 00025 * false: Any other time 00026 * The base thread will notice this error code and detach the device. If it is ok, it will 00027 * be picked up next iteration and an attach will occur. 00028 */ 00029 #define PHIDGET_USB_ERROR_FLAG 0x04 00030 /* 00031 * PHIDGET_ATTACHING_FLAG 00032 * true: Phidget is attached to computer, but initialization is still in progress 00033 * false: any other time 00034 * This is used internally only 00035 */ 00036 #define PHIDGET_ATTACHING_FLAG 0x08 00037 /* 00038 * PHIDGET_OPENED_FLAG 00039 * true: open has been called on the handle 00040 * false: open has not yet been called, or close has been called. 00041 * This is used internally only 00042 */ 00043 #define PHIDGET_OPENED_FLAG 0x10 00044 /* 00045 * PHIDGET_SERVER_CONNECTED_FLAG 00046 * true: networkInfo->server is valid and connected 00047 * false: networkInfo should not be considered valid 00048 * This is used internally only 00049 */ 00050 #define PHIDGET_SERVER_CONNECTED_FLAG 0x20 00051 /* 00052 * PHIDGET_REMOTE_FLAG 00053 * true: This was opened with _remote and networkInfo is valid 00054 * false: networkInfo is not valid - not opened or opened non-remote 00055 * This is used internally only 00056 */ 00057 #define PHIDGET_REMOTE_FLAG 0x40 00058 /* 00059 * PHIDGET_INERROREVENT_FLAG 00060 * true: an error event is being run 00061 * false: not 00062 * This is used internally only 00063 */ 00064 #define PHIDGET_INERROREVENT_FLAG 0x80 00065 00066 00067 //internal status representation via flags - for socket 00068 /* 00069 * PHIDGETSOCKET_CONNECTED_FLAG 00070 * true: Socket is connected, authorization succeeded and listeners and reports are set up. 00071 * false: Socket is not ready 00072 * This flag is returned externally to users. 00073 */ 00074 #define PHIDGETSOCKET_CONNECTED_FLAG 0x01 00075 /* 00076 * PHIDGETSOCKET_CONNECTING_FLAG 00077 * true: connecting is being set up 00078 * false: not 00079 * This leads to either PHIDGETSOCKET_CONNECTED_FLAG, PHIDGETSOCKET_AUTHERROR_FLAG, or PHIDGETSOCKET_CONNECTIONERROR_FLAG 00080 * This is used internally only 00081 */ 00082 #define PHIDGETSOCKET_CONNECTING_FLAG 0x02 00083 /* 00084 * PHIDGETSOCKET_CONNECTIONERROR_FLAG 00085 * true: a connection (socket) error occured 00086 * false: a socket error did not occur 00087 * This could happen any time, generally, we got a bad response from a socket, or a timeout 00088 * This is used internally only 00089 */ 00090 #define PHIDGETSOCKET_CONNECTIONERROR_FLAG 0x04 00091 /* 00092 * PHIDGETSOCKET_AUTHERROR_FLAG 00093 * true: authorization with server failed 00094 * false: authorization didn't fail (yet) 00095 * This is a password error 00096 * This is used internally only 00097 */ 00098 #define PHIDGETSOCKET_AUTHERROR_FLAG 0x08 00099 00100 00101 /* Internal error codes - start at 0x8000 */ 00102 #define EPHIDGET_TRYAGAIN 0x8000 00103 00104 /* 10 characters UTF-8, so up to 4 bytes per character */ 00105 #define MAX_LABEL_SIZE 10 00106 #define MAX_LABEL_STORAGE MAX_LABEL_SIZE*4+1 00107 00108 #define MAX_IN_PACKET_SIZE 64 00109 #define MAX_OUT_PACKET_SIZE 64 00110 00111 #define PHIDGETOPEN_ANY 0x00 00112 #define PHIDGETOPEN_SERIAL 0x01 00113 #define PHIDGETOPEN_ANY_ATTACHED 0x02 00114 #define PHIDGETOPEN_LABEL 0x04 00115 00116 /* Uninitialized values - for webservice */ 00117 #define PUNI_BOOL 0x03 00118 #define PUNI_INT 0x7FFFFFFE 00119 #define PUNI_INT64 0x7FFFFFFFFFFFFFFELL 00120 #define PUNI_DBL 1e250 00121 #define PUNI_FLT 1e25 00122 00123 00124 // this needs to reflect the size of Phid_DeviceName 00125 #define PHIDGET_DEVICE_CLASS_COUNT 24 00126 // this needs to reflect the size of Phid_Device_Def (not including the null end) 00127 #define PHIDGET_DEVICE_COUNT 55 00128 00129 #endif 00130