00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 #ifndef SENSOR_CONFIG_H__
00040 #define SENSOR_CONFIG_H__
00041 
00042 #include <stdio.h>
00043 #include "JString.h"
00044 #include "ResizeArray.h"
00045 #include "Matrix4.h"
00046 
00049 class SensorConfig {
00050 public:
00052   SensorConfig(const char *thedevice);
00053   ~SensorConfig();
00054 
00056   const char *getUSL() const;
00057 
00059   const char *getdevice() const;
00060 
00062   static ResizeArray<JString *> *getnames();
00063 
00065   float getmaxforce() const;
00066   float getscale() const;
00067   const float *getoffset() const;
00068   const Matrix4 *getright_rot() const;
00069   const Matrix4 *getleft_rot() const;
00070   const char *gettype() const;
00071   const char *getplace() const;
00072   const char *getname() const;
00073   const char *getnums() const;
00074   const ResizeArray<int> *getsensors() const;
00075 
00078   int have_one_sensor() const;
00079   
00081   int require_local() const;
00082 
00084   int require_cave_name() const;
00085 
00087   int require_freevr_name() const;
00088 
00090   void make_vrpn_address(char *buf) const;
00091  
00092 private:
00094   static void ScanSensorFiles (int behavior, SensorConfig *sensor, void* params);
00095   void parseconfigfordevice(FILE *f, void *);
00096   static void parseconfigfornames(FILE *f, void *ret_void);
00097         
00098   float getfloat(const char *from, float defalt);
00099   int needargs(int argc,int need);
00100   int parseUSL();          
00101   void read_sensor_nums(); 
00102   
00103   int line;                
00104 
00105   
00106   JString USL;
00107   char device[50];
00108   char type[21];
00109   char place[101];
00110   char name[101];
00111   char nums[101];
00112   ResizeArray<int> sensors;
00113 
00114   float scale;
00115   float maxforce;
00116   float offset[3];
00117   Matrix4 right_rot;
00118   Matrix4 left_rot;
00119 };
00120 
00121 #endif // SENSOR_CONFIG_H__