[Libphidget-cvs-commits] CVS: libphidget/src/phidget++ CPhidgetManager.cc,1.6,1.7
Status: Alpha
Brought to you by:
jstrohm
From: Jack S. <js...@us...> - 2002-09-16 06:57:53
|
Update of /cvsroot/libphidget/libphidget/src/phidget++ In directory usw-pr-cvs1:/tmp/cvs-serv6265/phidget++ Modified Files: CPhidgetManager.cc Log Message: Fixed problem where if any phidget besides a servo manager was attached the library would throw an exception. Now it should ignore any unknown phidgets. This is a temporary solution, a better solution is coming soon. Index: CPhidgetManager.cc =================================================================== RCS file: /cvsroot/libphidget/libphidget/src/phidget++/CPhidgetManager.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CPhidgetManager.cc 16 Sep 2002 06:43:33 -0000 1.6 --- CPhidgetManager.cc 16 Sep 2002 06:57:50 -0000 1.7 *************** *** 259,268 **** throw runtime_error("Id must be -1 for all phidgets"); ! CServoController *sc = new CServoController (uid); ! //_uniqueDevices.push_back(sc); ! return (sc); METHOD_UNGUARD; } --- 259,285 ---- throw runtime_error("Id must be -1 for all phidgets"); + struct phidget *_device=CPhidgetManager::getInstance()->getDeviceHandle(uid); ! if (_device!=NULL) ! { ! enum EDeviceClass deviceClass=error(phidgetTypeDeviceClass(error(phidgetType(_device)))); ! ! phidgetClose(_device); ! switch (deviceClass) ! { ! case LP_SERVO_CONTROLLER: ! { ! CServoController *sc = new CServoController (uid); ! return(sc); ! break; ! } ! default: ! return(NULL); // unsupported device type ! } ! } ! ! return (NULL); METHOD_UNGUARD; } |