[Libphidget-cvs-commits] CVS: libphidget/src/phidget++ CPhidget.cc,1.6,1.7 CPhidget.h,1.9,1.10
Status: Alpha
Brought to you by:
jstrohm
|
From: Jack S. <js...@us...> - 2002-12-21 03:23:04
|
Update of /cvsroot/libphidget/libphidget/src/phidget++
In directory sc8-pr-cvs1:/tmp/cvs-serv14348
Modified Files:
CPhidget.cc CPhidget.h
Log Message:
updated some documentation
Index: CPhidget.cc
===================================================================
RCS file: /cvsroot/libphidget/libphidget/src/phidget++/CPhidget.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** CPhidget.cc 16 Sep 2002 06:43:33 -0000 1.6
--- CPhidget.cc 21 Dec 2002 03:23:01 -0000 1.7
***************
*** 10,13 ****
--- 10,14 ----
#include "CPhidget.h"
#include "CPhidgetManager.h"
+ #include <set>
#include <string>
#include <phidget.h>
***************
*** 15,28 ****
#include "helper.h"
! CPhidget::CPhidget (const CUID &uid):CUniqueDevice (uid),
! _device(CPhidgetManager::getInstance()->getDeviceHandle(uid))
{
METHOD_GUARD;
- // Ask the phidget manager if we really exist as a device, if not throw an exception
! if (_device == NULL)
! throw runtime_error("Phidget doesn't exist.");
! //_last_wasAttached = error(phidgetAttached(_device)) == 1;
METHOD_UNGUARD;
}
--- 16,32 ----
#include "helper.h"
! CPhidget::CPhidget (const CUID &uid) :
! CUniqueDevice (uid),
! _device(CPhidgetManager::getInstance()->getDeviceHandle(uid))
{
METHOD_GUARD;
! // Ask the phidget manager if we really exist as a device, if not throw an exception
! // as seen above, _device should have a non-null value if this phidget is attached (or
! // has been attached since the program started)
! if (_device == NULL)
! throw runtime_error("Phidget doesn't exist.");
! //_last_wasAttached = error(phidgetAttached(_device)) == 1;
METHOD_UNGUARD;
}
***************
*** 31,35 ****
{
METHOD_GUARD;
! error(phidgetClose(_device));
METHOD_UNGUARD;
}
--- 35,39 ----
{
METHOD_GUARD;
! error(phidgetClose(_device));
METHOD_UNGUARD;
}
***************
*** 38,42 ****
{
METHOD_GUARD;
! return (error(phidgetTypeDeviceClass(error(phidgetType(_device)))));
METHOD_UNGUARD;
}
--- 42,46 ----
{
METHOD_GUARD;
! return (error(phidgetTypeDeviceClass(error(phidgetType(_device)))));
METHOD_UNGUARD;
}
***************
*** 45,49 ****
{
METHOD_GUARD;
! return (error(phidgetTypeName(error(phidgetType(_device)))));
METHOD_UNGUARD;
}
--- 49,53 ----
{
METHOD_GUARD;
! return (error(phidgetTypeName(error(phidgetType(_device)))));
METHOD_UNGUARD;
}
***************
*** 52,56 ****
{
METHOD_GUARD;
! return (error(phidgetTypeVendorID(error(phidgetType(_device)))));
METHOD_UNGUARD;
}
--- 56,60 ----
{
METHOD_GUARD;
! return (error(phidgetTypeVendorID(error(phidgetType(_device)))));
METHOD_UNGUARD;
}
***************
*** 59,63 ****
{
METHOD_GUARD;
! return (error(phidgetTypeProductID(error(phidgetType(_device)))));
METHOD_UNGUARD;
}
--- 63,67 ----
{
METHOD_GUARD;
! return (error(phidgetTypeProductID(error(phidgetType(_device)))));
METHOD_UNGUARD;
}
***************
*** 66,73 ****
{
METHOD_GUARD;
! if (error(phidgetAttached(_device)) == 1)
! return (true);
! return (false);
METHOD_UNGUARD;
}
--- 70,77 ----
{
METHOD_GUARD;
! if (error(phidgetAttached(_device)) == 1)
! return (true);
! return (false);
METHOD_UNGUARD;
}
***************
*** 94,96 ****
--- 98,113 ----
METHOD_GUARD;
METHOD_UNGUARD;
+ }
+
+ void CPhidget::query(const EDeviceClass tp, set < CUID >&devices)
+ {
+ CUniqueDevice::query(tp, devices);
+
+ // This phidget device matches the tp they are searching for
+ if (tp == phidgetTypeDeviceClass(phidgetType(device())))
+ devices.insert(UID());
+
+ // Just looking for a phidget
+ if (tp == LP_PHIDGET)
+ devices.insert(UID());
}
Index: CPhidget.h
===================================================================
RCS file: /cvsroot/libphidget/libphidget/src/phidget++/CPhidget.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** CPhidget.h 18 Dec 2002 02:51:16 -0000 1.9
--- CPhidget.h 21 Dec 2002 03:23:01 -0000 1.10
***************
*** 24,48 ****
{
private:
! friend class CServoController;
! friend class CInterfaceKit;
! struct phidget *_device;
/**
! * This constructor will only be called when a predefined phidget
! * derives from CPhidget (ex. CServoController)
*/
! CPhidget (phidget *device /*!< The libphidget phidget device handle */ );
!
! protected:
! friend class CPhidgetManager;
/**
* The device that this CPhidget uses
*/
! struct phidget *device()
! {
! return (_device);
! }
/**
--- 24,42 ----
{
private:
! struct phidget *_device; //!< The libphidget phidget device that this CPhidget represents
! protected:
/**
! * This constructor will be called by derived types to initialize a phidget
*/
! CPhidget (
! const CUID &uid //!< The CUID of the device you are creating
! );
/**
* The device that this CPhidget uses
*/
! struct phidget *device() { return (_device); }
/**
***************
*** 54,79 ****
public:
! CPhidget (const CUID &uid);
! virtual ~ CPhidget (); //!< If it is user constructed, this destructor replaces the original phidget back in the manager
! int classType(); //!< Get the device class as defined in the libphidget documentation.
! const char *name(); //!< Get the device name as defined in the libphidget documentation.
! int vendorID(); //!< Get the vendor ID as defined by the USB standard.
! int productID(); //!< Get the product ID as defined by the USB standard.
! bool isAttached(); //!< Returns if this device is attached or not.
! virtual void onAttach(); //!<This method is called when the device is attached.
! virtual void onDetach(); //!<This method is called when the device is detached.
!
! virtual void query(const EDeviceClass tp, set < CUID >&devices)
! {
! CUniqueDevice::query(tp, devices);
!
! // This phidget device matches the tp they are searching for
! if (tp == phidgetTypeDeviceClass(phidgetType(device())))
! devices.insert(UID());
! // Just looking for a phidget
! if (tp == LP_PHIDGET)
! devices.insert(UID());
! }
};
--- 48,67 ----
public:
! virtual ~ CPhidget (); //!< If it is user constructed, this destructor replaces the original phidget back in the manager
! int classType(); //!< Get the device class as defined in the libphidget documentation.
! const char *name(); //!< Get the device name as defined in the libphidget documentation.
! int vendorID(); //!< Get the vendor ID as defined by the USB standard.
! int productID(); //!< Get the product ID as defined by the USB standard.
! bool isAttached(); //!< Returns if this device is attached or not.
! virtual void onAttach(); //!< This method is called when the device is attached.
! virtual void onDetach(); //!< This method is called when the device is detached.
! /**
! * Query for a device that matches the libphidget device class passed in.
! */
! virtual void query(
! const EDeviceClass tp, //!< The device class we are looking for
! set < CUID >&devices //!< This will be filled with UID's of phidgets (or sub-objects) that match the device class
! );
};
|