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 "InputDevice.H"
00028
00029 class vrpn_Analog_Remote;
00030
00031 namespace VRG3D {
00032
00035 class VRPNAnalogDevice : public InputDevice
00036 {
00037 public:
00038 VRPNAnalogDevice(const std::string &vrpnAnalogDeviceName,
00039 const Array<std::string> &eventsToGenerate);
00040
00041 virtual ~VRPNAnalogDevice();
00042
00043 void pollForInput(Array<EventRef> &events);
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 Array<EventRef> _pendingEvents;
00053 };
00054
00055 }
00056
00057 #endif
00058
00059 #endif // USE_VRPN defined
00060
00061