00001 #ifndef FCAM_PHIDGETDEVICE_H
00002 #define FCAM_PHIDGETDEVICE_H
00003
00004 #include "../Device.h"
00005 #include "lib/phidget21.h"
00006 #include <vector>
00007 #include <utility>
00008
00009 namespace FCam {
00010 namespace F2 {
00011 class Device;
00018 class PhidgetDevice : public FCam::Device {
00019 public:
00025 PhidgetDevice();
00027 virtual void tagFrame(Frame *) {}
00028
00029 protected:
00032 static CPhidgetInterfaceKitHandle ifKit;
00034 static bool phidgetsAvailable;
00036 static void registerInputChangeHandler(int index, PhidgetDevice * device);
00038 static void registerOutputChangeHandler(int index, PhidgetDevice * device);
00040 static void registerSensorChangeHandler(int index, PhidgetDevice * device);
00041
00042
00046 virtual int handleInputChange(CPhidgetInterfaceKitHandle IFK, int index, int state);
00050 virtual int handleOutputChange(CPhidgetInterfaceKitHandle IFK, int index, int state);
00054 virtual int handleSensorChange(CPhidgetInterfaceKitHandle IFK, int index, int state);
00055 private:
00056 static std::vector<PhidgetDevice *> inputChangeHandlers[8];
00057 static std::vector<PhidgetDevice *> outputChangeHandlers[8];
00058 static std::vector<PhidgetDevice *> sensorChangeHandlers[8];
00059
00060 static int phidgetAttachHandler(CPhidgetHandle IFK, void *userptr);
00061 static int phidgetDetachHandler(CPhidgetHandle IFK, void *userptr);
00062 static int phidgetErrorHandler(CPhidgetHandle IFK, void *userptr, int errCode, const char *errMsg);
00063 static int phidgetInputChangeHandler(CPhidgetInterfaceKitHandle IFK, void *userptr, int index, int state);
00064 static int phidgetOutputChangeHandler(CPhidgetInterfaceKitHandle IFK, void *userptr, int index, int state);
00065 static int phidgetSensorChangeHandler(CPhidgetInterfaceKitHandle IFK, void *userptr, int index, int value);
00066 };
00067 }
00068 }
00069
00070
00071 #endif