[Libphidget-cvs-commits] CVS: libphidget/src/libphidget phidget.c,1.2,1.3 phidget.h,1.2,1.3
Status: Alpha
Brought to you by:
jstrohm
From: Vadim T. <vt...@us...> - 2002-09-08 18:59:57
|
Update of /cvsroot/libphidget/libphidget/src/libphidget In directory usw-pr-cvs1:/tmp/cvs-serv3113/src/libphidget Modified Files: phidget.c phidget.h Log Message: Performed 'make indent' on the code - now it conforms to GNU coding style standard. In the future, don't forget to 'make indent' on the top level before doing 'cvs commit'. Otherwise, unwanted, irrelevant, and MASSIVE diffs will result. Index: phidget.c =================================================================== RCS file: /cvsroot/libphidget/libphidget/src/libphidget/phidget.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** phidget.c 7 Sep 2002 20:12:30 -0000 1.2 --- phidget.c 8 Sep 2002 18:59:54 -0000 1.3 *************** *** 22,32 **** #define DBG(a) ! int _libPhidgetInitialized=0; /**< Private variable to determine if the libphidget is initialized */ ! int _typeCount=0; /**< count of known phidget types */ ! struct phidget_type *_typeList=NULL; /**< Array that will hold all the type structures */ ! int _phidgetDeviceCount=0; //*< Count of known phidgets */ ! struct phidget *_usbDeviceList[MAX_USB_DEVICES]; //*< Array that will hold all of the phidget structures */ ! int _catchSignals=0; //*< This is set on initialization and determines if signals are caught or not. ! enum ELPError _libPhidgetError=LPE_NONE; //*< Last lib phidget error */ [...1816 lines suppressed...] ! ("During the initialization of a phidget the interface for the USB device could not be claimed"); ! case LPE_SET_ALT_INTERFACE_FAILED: ! return ! ("During the initialization of a phidget the alternate interface for the USB device could not be set"); ! case LPE_NO_SERIAL_RETURNED: ! return ("The serial number could not be requested from the phidget"); ! case LPE_PHIDGET_ALREADY_CLOSED: ! return ("Phidget is already closed"); ! case LPE_PHIDGET_ALREADY_OPENED: ! return ("Phidget is already opened"); ! case LPE_PHIDGET_NOT_OPENED: ! return ("Phidget is not opened"); ! case LPE_CONTROL_MSG_ERROR: ! return ("Error sending a control message to a phidget"); ! case LPE_BULK_READ_ERROR: ! return ("Error reading bulk data from a phidget"); ! default: ! return ("not an error number"); ! } }; Index: phidget.h =================================================================== RCS file: /cvsroot/libphidget/libphidget/src/libphidget/phidget.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** phidget.h 7 Sep 2002 20:12:30 -0000 1.2 --- phidget.h 8 Sep 2002 18:59:54 -0000 1.3 *************** *** 59,82 **** enum EDeviceClass { ! LP_ALL=1, /**< All devices match this */ ! // Actual phidget types ! LP_PHIDGET=100, /**< Generic phidget, not used in this library */ ! LP_SERVO_CONTROLLER=200, /**< Identifies all servo controller phidgets */ ! LP_INTERFACE_KIT=300, /**< Identifies all interface kit phidgets, support being added now */ ! LP_ENCODER=400, /**< Currently unsupported */ ! LP_POWER=500, /**< Currently unsupported */ ! LP_RFID=600, /**< Currently unsupported */ ! LP_LED=700, /**< Currently unsupported */ ! LP_TEXTLCD=800, /**< Currently unsupported */ ! // Phidget devices, a phidget device is something a phidget controls ! LP_SERVO=201, /**< Any servo that a servo controller controls */ ! LP_DIGITAL_IN=301, /**< Any digital input that an interface kit controls */ ! LP_DIGITAL_OUT=302, /**< Any digital output that an interface kit controls */ ! LP_ANALOG_IN=303, /**< Any analog input that an interface kit controls */ ! LP_OTHER=0, /**< Identifies all unknown phidgets, this shouldn't exists */ ! LP_INVALID=-2, /**< Invalid device class */ }; --- 59,82 ---- enum EDeviceClass { ! LP_ALL = 1, /**< All devices match this */ ! // Actual phidget types ! LP_PHIDGET = 100, /**< Generic phidget, not used in this library */ ! LP_SERVO_CONTROLLER = 200, /**< Identifies all servo controller phidgets */ ! LP_INTERFACE_KIT = 300, /**< Identifies all interface kit phidgets, support being added now */ ! LP_ENCODER = 400, /**< Currently unsupported */ ! LP_POWER = 500, /**< Currently unsupported */ ! LP_RFID = 600, /**< Currently unsupported */ ! LP_LED = 700, /**< Currently unsupported */ ! LP_TEXTLCD = 800, /**< Currently unsupported */ ! // Phidget devices, a phidget device is something a phidget controls ! LP_SERVO = 201, /**< Any servo that a servo controller controls */ ! LP_DIGITAL_IN = 301, /**< Any digital input that an interface kit controls */ ! LP_DIGITAL_OUT = 302, /**< Any digital output that an interface kit controls */ ! LP_ANALOG_IN = 303, /**< Any analog input that an interface kit controls */ ! LP_OTHER = 0, /**< Identifies all unknown phidgets, this shouldn't exists */ ! LP_INVALID = -2, /**< Invalid device class */ }; *************** *** 87,111 **** enum ELPError { ! LPE_NONE=0, /**< No error has occured */ ! LPE_PHIDGET_NOT_ATTACHED=1, /**< Phidget is not attached, this is really a warning */ ! LPE_UNKNOWN=-1, /**< An unknown error has occured */ ! LPE_INVALID_PHIDGET_CLASS=LP_INVALID,/**< Invalid device class (same as LP_INVALID), most likely the device class was NULL */ ! LPE_INVALID_PHIDGET=-3, /**< Invalid phidget, most likely the phidget was NULL */ ! LPE_NOT_INITIALIZED=-4, /**< libphidget hasn't been initialized */ ! LPE_WRONG_PHIDGET_CLASS_TYPE=-5, /**< The wrong device class type was passed to a function */ ! LPE_UNKNOWN_PHIDGET_CLASS_TYPE=-6, /**< An unknown device class type was passed to a function */ ! LPE_SET_CONFIGURATION_FAILED=-7, /**< During the initialization of a phidget the configuration for the USB device could not be set */ ! LPE_CLAIM_INTERFACE_FAILED=-8, /**< During the initialization of a phidget the interface for the USB device could not be claimed */ ! LPE_SET_ALT_INTERFACE_FAILED=-9, /**< During the initialization of a phidget the alternate interface for the USB device could not be set */ ! LPE_NO_SERIAL_RETURNED=-10, /**< The serial number could not be requested from the phidget */ ! LPE_PHIDGET_ALREADY_CLOSED=-11, /**< Phidget is already closed */ ! LPE_PHIDGET_ALREADY_OPENED=-12, /**< Phidget is already opened */ ! LPE_PHIDGET_NOT_OPENED=-13, /**< Phidget is not opened */ ! LPE_CONTROL_MSG_ERROR=-14, /**< Error sending a control message to a phidget */ ! LPE_BULK_READ_ERROR=-15 /**< Error reading bulk data from a phidget */ }; #ifdef __cplusplus ! extern "C" { #endif --- 87,112 ---- enum ELPError { ! LPE_NONE = 0, /**< No error has occured */ ! LPE_PHIDGET_NOT_ATTACHED = 1, /**< Phidget is not attached, this is really a warning */ ! LPE_UNKNOWN = -1, /**< An unknown error has occured */ ! LPE_INVALID_PHIDGET_CLASS = LP_INVALID, /**< Invalid device class (same as LP_INVALID), most likely the device class was NULL */ ! LPE_INVALID_PHIDGET = -3, /**< Invalid phidget, most likely the phidget was NULL */ ! LPE_NOT_INITIALIZED = -4, /**< libphidget hasn't been initialized */ ! LPE_WRONG_PHIDGET_CLASS_TYPE = -5, /**< The wrong device class type was passed to a function */ ! LPE_UNKNOWN_PHIDGET_CLASS_TYPE = -6, /**< An unknown device class type was passed to a function */ ! LPE_SET_CONFIGURATION_FAILED = -7, /**< During the initialization of a phidget the configuration for the USB device could not be set */ ! LPE_CLAIM_INTERFACE_FAILED = -8, /**< During the initialization of a phidget the interface for the USB device could not be claimed */ ! LPE_SET_ALT_INTERFACE_FAILED = -9, /**< During the initialization of a phidget the alternate interface for the USB device could not be set */ ! LPE_NO_SERIAL_RETURNED = -10, /**< The serial number could not be requested from the phidget */ ! LPE_PHIDGET_ALREADY_CLOSED = -11, /**< Phidget is already closed */ ! LPE_PHIDGET_ALREADY_OPENED = -12, /**< Phidget is already opened */ ! LPE_PHIDGET_NOT_OPENED = -13, /**< Phidget is not opened */ ! LPE_CONTROL_MSG_ERROR = -14, /**< Error sending a control message to a phidget */ ! LPE_BULK_READ_ERROR = -15 /**< Error reading bulk data from a phidget */ }; #ifdef __cplusplus ! extern "C" ! { #endif *************** *** 118,127 **** * long as \a phidget_deinit is called between each call to \a phidget_init. */ ! enum ELPError phidgetInit(int catchSignals); /** Must be called at the end of your program. Frees some internal data * structures. If this isn't called then there will be memory leaks. */ ! enum ELPError phidgetDeinit(); /** --- 119,128 ---- * long as \a phidget_deinit is called between each call to \a phidget_init. */ ! enum ELPError phidgetInit (int catchSignals); /** Must be called at the end of your program. Frees some internal data * structures. If this isn't called then there will be memory leaks. */ ! enum ELPError phidgetDeinit (); /** *************** *** 129,133 **** * and phidgetLastError() will return the error code. */ ! struct phidget **phidgetGetPhidgets(int *numPhidgets); /** --- 130,134 ---- * and phidgetLastError() will return the error code. */ ! struct phidget **phidgetGetPhidgets (int *numPhidgets); /** *************** *** 135,148 **** * return the error code. */ ! struct phidget *phidgetOpen( ! struct phidget *phidget //<! The phidget that we want to open ! ); /** * Close a phidget */ ! enum ELPError phidgetClose( ! struct phidget *device //<! The phidget to be closed ! ); /** --- 136,147 ---- * return the error code. */ ! struct phidget *phidgetOpen (struct phidget *phidget //<! The phidget that we want to open ! ); /** * Close a phidget */ ! enum ELPError phidgetClose (struct phidget *device //<! The phidget to be closed ! ); /** *************** *** 151,159 **** * writing to. */ ! enum ELPError phidgetWrite( ! struct phidget *device, //<! The phidget to be written to ! char *bytes, //<! Pointer to data that is to be written to the device ! int size //<! Size in bytes of data pointed to by \a bytes ! ); /** --- 150,157 ---- * writing to. */ ! enum ELPError phidgetWrite (struct phidget *device, //<! The phidget to be written to ! char *bytes, //<! Pointer to data that is to be written to the device ! int size //<! Size in bytes of data pointed to by \a bytes ! ); /** *************** *** 161,169 **** * have an interface kit or any phidget that supports reads. */ ! enum ELPError phidgetRead( ! struct phidget *device, //<! The phidget to be read from ! char *bytes, //<! Pointer allocated large enough to hold \a size bytes of data ! int size //<! Size in bytes of data to read from device ! ); /** --- 159,166 ---- * have an interface kit or any phidget that supports reads. */ ! enum ELPError phidgetRead (struct phidget *device, //<! The phidget to be read from ! char *bytes, //<! Pointer allocated large enough to hold \a size bytes of data ! int size //<! Size in bytes of data to read from device ! ); /** *************** *** 174,181 **** * motion on your servo you can simple say percent = desired_angle / range. */ ! enum ELPError phidgetSingleServo( ! struct phidget *device, //<! The phidget to be controlled ! float percent //<! Percentage to move servo 1 ! ); /** --- 171,177 ---- * motion on your servo you can simple say percent = desired_angle / range. */ ! enum ELPError phidgetSingleServo (struct phidget *device, //<! The phidget to be controlled ! float percent //<! Percentage to move servo 1 ! ); /** *************** *** 183,190 **** * device is closed (either on purpose, or when the signal handler catches it) */ ! enum ELPError pidgetSingleServoDefault( ! struct phidget *device, //<! The phidget whose default we want to set ! float percent //!< Percentage to move servo 1 ! ); /** --- 179,185 ---- * device is closed (either on purpose, or when the signal handler catches it) */ ! enum ELPError pidgetSingleServoDefault (struct phidget *device, //<! The phidget whose default we want to set ! float percent //!< Percentage to move servo 1 ! ); /** *************** *** 195,205 **** * motion on your servo you can simple say percent = desired_angle / range. */ ! enum ELPError phidgetQuadServo( ! struct phidget *device, //!< The phidget to be contorlled ! float percent1, //!< Percentage to move servo 1 ! float percent2, //!< Percentage to move servo 2 ! float percent3, //!< Percentage to move servo 3 ! float percent4 //!< Percentage to move servo 4 ! ); /** --- 190,199 ---- * motion on your servo you can simple say percent = desired_angle / range. */ ! enum ELPError phidgetQuadServo (struct phidget *device, //!< The phidget to be contorlled ! float percent1, //!< Percentage to move servo 1 ! float percent2, //!< Percentage to move servo 2 ! float percent3, //!< Percentage to move servo 3 ! float percent4 //!< Percentage to move servo 4 ! ); /** *************** *** 207,217 **** * device is closed (either on purpose, or when the signal handler catches it) */ ! enum ELPError pidgetQuadServoDefault( ! struct phidget *device, //<! The phidget whose default we want to set ! float percent1, //!< Percentage to move servo 1 ! float percent2, //!< Percentage to move servo 2 ! float percent3, //!< Percentage to move servo 3 ! float percent4 //!< Percentage to move servo 4 ! ); /** --- 201,210 ---- * device is closed (either on purpose, or when the signal handler catches it) */ ! enum ELPError pidgetQuadServoDefault (struct phidget *device, //<! The phidget whose default we want to set ! float percent1, //!< Percentage to move servo 1 ! float percent2, //!< Percentage to move servo 2 ! float percent3, //!< Percentage to move servo 3 ! float percent4 //!< Percentage to move servo 4 ! ); /** *************** *** 224,228 **** * then when it is reconnected you will be re-attached to the same USB device. */ ! int phidgetEvents(); --- 217,221 ---- * then when it is reconnected you will be re-attached to the same USB device. */ ! int phidgetEvents (); *************** *** 231,240 **** * a NULL and phidgetLastError() will return the error code. */ ! const struct phidget_type *phidgetType(const struct phidget *device); /** * Return the serial number from a phidget. If an error occurs it returns an \a ELPError equivalent error number. */ ! int phidgetSerial(const struct phidget *device); /** --- 224,233 ---- * a NULL and phidgetLastError() will return the error code. */ ! const struct phidget_type *phidgetType (const struct phidget *device); /** * Return the serial number from a phidget. If an error occurs it returns an \a ELPError equivalent error number. */ ! int phidgetSerial (const struct phidget *device); /** *************** *** 242,276 **** * a NULL and phidgetLastError() will return the error code. */ ! const char *phidgetTypeName(const struct phidget_type *tp); /** * Returns the product ID of a phidget type If an error occurs it returns an \a ELPError equivalent error number. */ ! int phidgetTypeProductID(const struct phidget_type *tp); /** * Returns a vendor ID of a phidget type If an error occurs it returns an \a ELPError equivalent error number. */ ! int phidgetTypeVendorID(const struct phidget_type *tp); /** * Returns the device class of a phidget type If an error occurs it returns an \a ELPError equivalent error number. */ ! enum EDeviceClass phidgetTypeDeviceClass(const struct phidget_type *tp); /** * Returns 1 if a phidget is attached, 0 if it isn't attached. If an error occurs it returns an \a ELPError equivalent error number. */ ! int phidgetAttached(const struct phidget *device); /** * Returns the last error that occured. No defined error can occur during this call. */ ! enum ELPError phidgetLastError(); /** * Returns a human readable string that describes the error number. */ ! const char *phidgetErrorString(const enum ELPError err); --- 235,269 ---- * a NULL and phidgetLastError() will return the error code. */ ! const char *phidgetTypeName (const struct phidget_type *tp); /** * Returns the product ID of a phidget type If an error occurs it returns an \a ELPError equivalent error number. */ ! int phidgetTypeProductID (const struct phidget_type *tp); /** * Returns a vendor ID of a phidget type If an error occurs it returns an \a ELPError equivalent error number. */ ! int phidgetTypeVendorID (const struct phidget_type *tp); /** * Returns the device class of a phidget type If an error occurs it returns an \a ELPError equivalent error number. */ ! enum EDeviceClass phidgetTypeDeviceClass (const struct phidget_type *tp); /** * Returns 1 if a phidget is attached, 0 if it isn't attached. If an error occurs it returns an \a ELPError equivalent error number. */ ! int phidgetAttached (const struct phidget *device); /** * Returns the last error that occured. No defined error can occur during this call. */ ! enum ELPError phidgetLastError (); /** * Returns a human readable string that describes the error number. */ ! const char *phidgetErrorString (const enum ELPError err); *************** *** 279,284 **** } #endif - - #endif - --- 272,274 ---- |