00001
00015
00016 #ifdef USE_VRPN
00017
00018
00019 #ifndef VRPNANALOGDEVICE_H
00020 #define VRPNANALOGDEVICE_H
00021
00022
00023 #include <G3D/G3DAll.h>
00024 using namespace G3D;
00025 #include <iostream>
00026
00027 #include "PolledDevice.H"
00028
00029 class vrpn_Analog_Remote;
00030
00031 namespace IS3D {
00032
00033 class VRPNAnalogDevice : public PolledDevice
00034 {
00035 public:
00036 VRPNAnalogDevice(const std::string &vrpnAnalogDeviceName,
00037 const Array<std::string> &eventsToGenerate);
00038
00039 static VRPNAnalogDevice* fromConfigVals(const std::string &devname);
00040
00041 virtual ~VRPNAnalogDevice();
00042
00043 void pollForEvents();
00044 void sendEventIfChanged(int channelNumber, double data);
00045 std::string getEventName(int channelNumber);
00046 int numChannels() { return _eventNames.size(); }
00047
00048 private:
00049 vrpn_Analog_Remote *_vrpnDevice;
00050 Array<std::string> _eventNames;
00051 Array<double> _channelValues;
00052 };
00053
00054 }
00055
00056 #endif
00057
00058 #endif // USE_VRPN defined
00059
00060