Thread: [Libphidget-cvs-commits] CVS: libphidget/src/libphidget phidget.c,1.3,1.4 phidget.h,1.3,1.4
Status: Alpha
Brought to you by:
jstrohm
From: Vadim T. <vt...@us...> - 2002-09-12 00:24:32
|
Update of /cvsroot/libphidget/libphidget/src/libphidget In directory usw-pr-cvs1:/tmp/cvs-serv4358/src/libphidget Modified Files: phidget.c phidget.h Log Message: Merged back the results of INDENT branch changes Index: phidget.c =================================================================== RCS file: /cvsroot/libphidget/libphidget/src/libphidget/phidget.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** phidget.c 8 Sep 2002 18:59:54 -0000 1.3 --- phidget.c 12 Sep 2002 00:24:29 -0000 1.4 *************** *** 43,67 **** struct phidget_type { ! /*! ! * Currently supported names are: ! * - RFID VID/PID ! * - QuadServo .1 Degree ! * - UniServo .1 Degree ! * - 8-AdvancedServo ! * - Interface Kit 884 ! * - Interface Kit 088 [...1772 lines suppressed...] case LPE_CLAIM_INTERFACE_FAILED: ! return ("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.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** phidget.h 8 Sep 2002 18:59:54 -0000 1.3 --- phidget.h 12 Sep 2002 00:24:29 -0000 1.4 *************** *** 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,107 **** 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 */ }; --- 87,107 ---- 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 */ }; *************** *** 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 (); /** --- 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(); /** *************** *** 130,134 **** * 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); /** *************** *** 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 ! ); /** --- 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 ! ); /** *************** *** 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 ! ); /** --- 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 ! ); /** *************** *** 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 ! ); /** --- 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 ! ); /** *************** *** 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 ! ); /** --- 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 ! ); /** *************** *** 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 ! ); /** --- 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 ! ); /** *************** *** 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 ! ); /** --- 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 ! ); /** *************** *** 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 ! ); /** --- 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 ! ); /** *************** *** 217,221 **** * 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(); *************** *** 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); /** --- 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); /** *************** *** 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); --- 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); |