00001 00024 #ifndef _GSM_H 00025 #define _GSM_H 00026 00027 #include "../AbstractString.h" 00028 #include "../../util/Thread.h" 00029 00031 #define GSM_SCANDELAY 30 00032 00036 class FEATURE_EXPORT_CLASS GSMCellFeature : public AbstractStringFeature 00037 { 00038 friend class GSMFeatureProvider; 00039 00040 protected: 00055 GSMCellFeature(stringcode* code, long* maxlen) : AbstractStringFeature(AbstractStringFeature::None, code, maxlen) {} 00056 00071 GSMCellFeature(stringcode* code, long* maxlen, string cellid) : AbstractStringFeature(AbstractStringFeature::None, code, maxlen, cellid) {} 00072 00073 public: 00074 virtual const string getName() const { return "GSM.CellID"; } 00075 00076 #if _DEBUG_FEATURES 00077 virtual string toString() const; 00078 #endif 00079 }; 00080 00081 00085 class FEATURE_EXPORT_CLASS GSMFeatureProvider : public FeatureProvider, private Thread 00086 { 00087 private: 00089 00090 stringvector features; 00091 int delay; 00092 stringcode gsmCellFeature_code; 00093 long gsmCellFeature_maxlen; 00094 00095 // these have to be implemented for each OS 00096 void init(featureparams& params); 00097 virtual bool openSerialPort(string serialport); 00098 virtual void closeSerialPort(); 00099 virtual bool writeLine(string line); 00100 virtual string readLine(); 00102 00103 protected: 00105 00106 string cellId; 00107 bool cellIdValid; 00108 mutable Lock lockCellId; 00109 00110 string serialPort; 00112 00113 public: 00119 GSMFeatureProvider(providerparams& params); 00121 virtual ~GSMFeatureProvider(); 00122 00123 virtual void run(); 00124 00125 virtual Feature* getFeature(string name) const; 00126 virtual Feature* getSample(string name) const; 00127 virtual void nextSample(clock_t checkpoint); 00128 }; 00129 00130 #endif // _GSM_H