[Libphidget-cvs-commits] CVS: libphidget/src/phidget++ CInterfaceKit.h,1.7,1.8 CPhidget.h,1.6,1.7 CP
Status: Alpha
Brought to you by:
jstrohm
|
From: Jack S. <js...@us...> - 2002-12-17 03:10:14
|
Update of /cvsroot/libphidget/libphidget/src/phidget++
In directory sc8-pr-cvs1:/tmp/cvs-serv29565/phidget++
Modified Files:
CInterfaceKit.h CPhidget.h CPhidgetManager.cc CTextLCD.h
CUniqueDevice.h
Log Message:
Bug fixes and code modifications to support the new example ik2lcd. Also the start of the rebuild of the device query system in phidget++
Index: CInterfaceKit.h
===================================================================
RCS file: /cvsroot/libphidget/libphidget/src/phidget++/CInterfaceKit.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** CInterfaceKit.h 16 Dec 2002 22:37:11 -0000 1.7
--- CInterfaceKit.h 17 Dec 2002 03:10:10 -0000 1.8
***************
*** 13,16 ****
--- 13,17 ----
#include "CPhidget.h"
#include <vector>
+ #include <set>
using namespace std;
***************
*** 81,84 ****
--- 82,97 ----
CDigitalIn *digitalIn(const int id, bool create=true);
CDigitalOut *digitalOut(const int id, bool create=true);
+
+ virtual void query(const EDeviceClass tp, set < CUID >&devices)
+ {
+ printf("query interface kit\n");
+ if (tp == LP_INTERFACE_KIT_488 || tp==LP_INTERFACE_KIT_880)
+ {
+ printf("Found interface kit\n");
+ devices.insert(UID());
+ }
+ else
+ CPhidget::query(tp,devices);
+ }
};
Index: CPhidget.h
===================================================================
RCS file: /cvsroot/libphidget/libphidget/src/phidget++/CPhidget.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** CPhidget.h 15 Dec 2002 20:40:11 -0000 1.6
--- CPhidget.h 17 Dec 2002 03:10:10 -0000 1.7
***************
*** 83,90 ****
virtual void query(const EDeviceClass tp, set < CUID >&devices)
{
- CUniqueDevice::query(tp, devices);
-
if (tp == LP_PHIDGET)
devices.insert(UID());
}
};
--- 83,90 ----
virtual void query(const EDeviceClass tp, set < CUID >&devices)
{
if (tp == LP_PHIDGET)
devices.insert(UID());
+ else
+ CUniqueDevice::query(tp, devices);
}
};
Index: CPhidgetManager.cc
===================================================================
RCS file: /cvsroot/libphidget/libphidget/src/phidget++/CPhidgetManager.cc,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** CPhidgetManager.cc 15 Dec 2002 23:41:55 -0000 1.12
--- CPhidgetManager.cc 17 Dec 2002 03:10:10 -0000 1.13
***************
*** 119,122 ****
--- 119,123 ----
// Ask libphidget for any known phidgets
+ /*
if (
tp == LP_ALL ||
***************
*** 125,157 ****
tp == LP_SERVO_CONTROLLER ||
tp == LP_INTERFACE_KIT_488 ||
! tp == LP_INTERFACE_KIT_880
)
{
int phidget_count;
struct phidget **phidgets = error(phidgetGetPhidgets(&phidget_count));
-
for (int t = 0; t < phidget_count; t++)
{
if (
(tp == LP_PHIDGET) ||
(tp == LP_ALL) ||
(tp == LP_TEXT_LCD) ||
! (tp == LP_SERVO_CONTROLLER && error(phidgetTypeDeviceClass(error(phidgetType(phidgets[t])))) == LP_SERVO_CONTROLLER) ||
(tp == LP_INTERFACE_KIT_488) ||
! (tp == LP_INTERFACE_KIT_880)
! /*||
! (tp == LP_INTERFACE_KIT && error(phidgetTypeDeviceClass(error(phidgetType(phidgets[t])))) == LP_INTERFACE_KIT)*/ )
{
CUID temp_uid(error(phidgetSerial(phidgets[t])));
-
printf("found\n");
devices.insert(temp_uid);
}
}
}
// Ask each known device if it knows about any devices that match the type we are searching for
- //if (tp == LP_ALL || tp == LP_SERVO || tp == LP_DIGITAL_IN || tp == LP_DIGITAL_OUT || tp == LP_TEXT_LCD)
{
for (int t = 0; t < _uniqueDevices.size(); t++)
--- 126,166 ----
tp == LP_SERVO_CONTROLLER ||
tp == LP_INTERFACE_KIT_488 ||
! tp == LP_INTERFACE_KIT_880 ||
! tp == LP_TEXT_LCD
)
+ */
{
int phidget_count;
struct phidget **phidgets = error(phidgetGetPhidgets(&phidget_count));
for (int t = 0; t < phidget_count; t++)
{
+ CUID temp_uid(error(phidgetSerial(phidgets[t])));
+ enum EDeviceClass dc=error(phidgetTypeDeviceClass(error(phidgetType(phidgets[t]))));
+
+ if (tp==dc)
+ devices.insert(temp_uid);
+ else
+ if (tp==LP_PHIDGET || tp==LP_ALL)
+ devices.insert(temp_uid);
+
+ /*
if (
(tp == LP_PHIDGET) ||
(tp == LP_ALL) ||
(tp == LP_TEXT_LCD) ||
! (tp == LP_SERVO_CONTROLLER) ||
(tp == LP_INTERFACE_KIT_488) ||
! (tp == LP_INTERFACE_KIT_880) )
{
CUID temp_uid(error(phidgetSerial(phidgets[t])));
printf("found\n");
devices.insert(temp_uid);
}
+ */
}
}
// Ask each known device if it knows about any devices that match the type we are searching for
{
for (int t = 0; t < _uniqueDevices.size(); t++)
Index: CTextLCD.h
===================================================================
RCS file: /cvsroot/libphidget/libphidget/src/phidget++/CTextLCD.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CTextLCD.h 16 Dec 2002 04:54:56 -0000 1.2
--- CTextLCD.h 17 Dec 2002 03:10:10 -0000 1.3
***************
*** 13,16 ****
--- 13,17 ----
#include "CPhidget.h"
#include <vector>
+ #include <set>
using namespace std;
***************
*** 28,41 ****
void update();
CUniqueDevice *find(const CUID &uid, bool create);
- virtual void query(const EDeviceClass tp, set < CUID >&devices)
- {
- CPhidget::query(tp, devices);
- //if (tp == LP_TEXT_LCD || tp == LP_ALL)
- //for (int t = 0; t < _servoCount; t++)
- //devices.insert(CUID (UID().serial(), t));
- }
void sendText(string text, int row, int col);
void on();
void off();
};
--- 29,42 ----
void update();
CUniqueDevice *find(const CUID &uid, bool create);
void sendText(string text, int row, int col);
void on();
void off();
+ virtual void query(const EDeviceClass tp, set < CUID >&devices)
+ {
+ if (tp == LP_TEXT_LCD)
+ devices.insert(UID());
+ else
+ CPhidget::query(tp,devices);
+ }
};
Index: CUniqueDevice.h
===================================================================
RCS file: /cvsroot/libphidget/libphidget/src/phidget++/CUniqueDevice.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** CUniqueDevice.h 15 Dec 2002 20:40:12 -0000 1.5
--- CUniqueDevice.h 17 Dec 2002 03:10:10 -0000 1.6
***************
*** 58,62 ****
/**
* Queries for any unique id devices that may exists, or are known how to create.
! */ virtual void query(const EDeviceClass tp, set < CUID >&devices)
{
if (tp == LP_ALL)
--- 58,63 ----
/**
* Queries for any unique id devices that may exists, or are known how to create.
! */
! virtual void query(const EDeviceClass tp, set < CUID >&devices)
{
if (tp == LP_ALL)
|