00001 #ifndef _emitter_vrpn_H_ 00002 #define _emitter_vrpn_H_ 00003 00004 #include "dev/emitter.H" 00005 #include "dev/polled.H" 00006 #include "vrpn/vrpn_Tracker.h" 00007 00008 class TempEvent { 00009 protected: 00010 double _time_stamp; 00011 Wtransf _tracker_to_device; 00012 public: 00013 TempEvent(double time_stamp = -1, cWtransf &tracker_to_device= Wtransf()) 00014 :_time_stamp(time_stamp), _tracker_to_device(tracker_to_device) {} 00015 double time_stamp() const { return _time_stamp; } 00016 cWtransf &tracker_to_device() const { return _tracker_to_device; } 00017 bool operator== (const TempEvent &event) { cerr << "TempEvent == called" 00018 << endl; return true; } 00019 }; 00020 // 00021 // A VRPN tracker (which is a set of what we call trackers which all 00022 // happen to be on the same physical emitter device set) 00023 // 00024 class DEVemitter_VRPN : public DEVemitter, public DEVpolled { 00025 protected: 00026 vrpn_Tracker_Remote *_vrpndev; 00027 int _new_data_flag; 00028 ARRAY<TempEvent> _tracker_events; 00029 00030 static void vrpn_tracker_handler(void *emtr, const vrpn_TRACKERCB info); 00031 00032 virtual void clear_new_data_flag() { _new_data_flag = 0; } 00033 virtual void set_new_data_flag() { _new_data_flag = 1; } 00034 virtual int new_data_flag() const { return _new_data_flag; } 00035 00036 /* ------------- DEVpolled methods --------------- */ 00037 void do_poll(); 00038 00039 public: 00040 DEVemitter_VRPN(Cstr_ptr &dev_name); 00041 virtual ~DEVemitter_VRPN(); 00042 }; 00043 00044 #endif