Wlan.h

Go to the documentation of this file.
00001 
00024 #ifndef _WLAN_H
00025 #define _WLAN_H
00026 
00027 #include "../AbstractString.h"
00028 #include "../Numerical.h"
00029 
00035 class FEATURE_EXPORT_CLASS WlanActiveEssidFeature : public AbstractStringFeature
00036 {
00037         friend class WlanFeatureProvider;
00038 
00039         protected:
00044                 WlanActiveEssidFeature(stringcode* code, long* maxlen) : AbstractStringFeature(AbstractStringFeature::Levenshtein, code, maxlen) {}
00046                 WlanActiveEssidFeature(stringcode* code, long* maxlen, const string essid) : AbstractStringFeature(AbstractStringFeature::Levenshtein, code, maxlen, essid) {}
00047 
00048         public:
00049                 virtual const string getName() const { return "Wlan.ActiveEssid"; }
00050 
00051 #if _DEBUG_FEATURES
00052                 virtual string toString() const;
00053 #endif
00054 };
00055 
00061 class FEATURE_EXPORT_CLASS WlanActiveMacAddressFeature : public AbstractStringFeature
00062 {
00063         friend class WlanFeatureProvider;
00064 
00065         protected:
00070                 WlanActiveMacAddressFeature(stringcode* code, long* maxlen) : AbstractStringFeature(AbstractStringFeature::None, code, maxlen) {}
00071 
00076                 WlanActiveMacAddressFeature(stringcode* code, long* maxlen, const string mac) : AbstractStringFeature(AbstractStringFeature::None, code, maxlen, mac) {}
00077 
00078         public:
00079                 virtual const string getName() const { return "Wlan.ActiveMacAddress"; }
00080 
00081 #if _DEBUG_FEATURES
00082 
00083                 virtual string toString() const;
00084 #endif
00085 };
00086 
00090 class FEATURE_EXPORT_CLASS WlanActiveModeFeature : public Feature
00091 {
00092         friend class WlanFeatureProvider;
00093 
00094         public:
00096                 typedef enum {Unknown, Master, Managed, AdHoc, Last /* don't use */} FeatureKind;
00097 
00098         protected:
00103                 WlanActiveModeFeature();
00104 
00109                 WlanActiveModeFeature(FeatureKind mode);
00110 
00111         public:
00112                 virtual double getPosition() const;
00113                 virtual double getDistance(Feature *f) const;
00114                 virtual void moveTowards(Feature *f, double factor);
00115 
00116                 virtual string serialize() const;
00117                 virtual void unserialize(string value);
00118 
00119                 virtual Feature* clone() const;
00120                 void aggregate(aggregatelist samples);
00121 
00122                 virtual FeatureType getType() const { return nominal; }
00123                 virtual const string getName() const { return "Wlan.ActiveMode"; }
00124 
00125                 const FeatureKind getVal() const { return mode; }
00126 
00127 #if _DEBUG_FEATURES
00128 
00129                 virtual string toString() const;
00130 #endif
00131 
00132         private:
00134                 FeatureKind mode;
00135 };
00136 
00140 class FEATURE_EXPORT_CLASS WlanActiveSignalLevelFeature : public NumericalContinuousFeature
00141 {
00142         friend class WlanFeatureProvider;
00143 
00144         protected:
00149                 WlanActiveSignalLevelFeature(double* minval, double* maxval) : NumericalContinuousFeature(minval, maxval) {}
00150 
00155                 WlanActiveSignalLevelFeature(double* minval, double* maxval, const double level) : NumericalContinuousFeature(minval, maxval, level) {}
00156 
00157         public:
00158                 virtual const string getName() const { return "Wlan.ActiveSignalLevel"; }
00159 
00160 #if _DEBUG_FEATURES
00161 
00162                 virtual string toString() const;
00163 #endif
00164 };
00165 
00169 struct FEATURE_EXPORT_CLASS WlanPeerInfo {
00171 
00172         string essid;
00173         string mac;
00174         WlanActiveModeFeature::FeatureKind mode;
00175         double signalLevel;
00177 };
00178 
00182 class FEATURE_EXPORT_CLASS WlanPeersFeature : public AbstractStringListFeature
00183 {
00184         friend class WlanFeatureProvider;
00185 
00186         protected:
00191                 WlanPeersFeature(stringcode* code, long* maxlen);
00192 
00197                 WlanPeersFeature(stringcode* code, long* maxlen, const vector<WlanPeerInfo> *peers);
00198 
00199         public:
00200                 virtual const string getName() const { return "Wlan.Peers"; }
00201 
00202 #if _DEBUG_FEATURES
00203 
00204                 virtual string toString() const;
00205 #endif
00206 };
00207 
00211 class FEATURE_EXPORT_CLASS WlanNumPeersFeature : public NumericalDiscreteFeature
00212 {
00213         friend class WlanFeatureProvider;
00214 
00215         protected:
00220                 WlanNumPeersFeature(long* minval, long* maxval) : NumericalDiscreteFeature(minval, maxval) {}
00221 
00226                 WlanNumPeersFeature(long* minval, long* maxval, const long numPeers) : NumericalDiscreteFeature(minval, maxval, numPeers) {}
00227 
00228         public:
00229                 virtual const string getName() const { return "Wlan.NumPeers"; }
00230 
00231 #if _DEBUG_FEATURES
00232 
00233                 virtual string toString() const;
00234 #endif
00235 };
00236 
00237 
00241 class FEATURE_EXPORT_CLASS WlanFeatureProvider : public FeatureProvider
00242 {
00243         public:
00245                 typedef enum {ActiveEssid, ActiveMode, ActiveSignalLevel, ActiveMacAddress, Peers, NumPeers} FeatureKind;
00246 
00248                 WlanFeatureProvider(providerparams &params);
00249 
00250                 virtual Feature* getFeature(string name) const;
00251                 virtual Feature* getSample(string name) const;
00252                 virtual void nextSample(clock_t checkpoint);
00253 
00254         private:
00256 
00257                 stringvector features;
00258                 // ARGH: hack
00259                 mutable map<string, FeatureKind> featuremap;
00260 
00261                 stringcode activeEssidFeature_code;
00262                 long activeEssidFeature_maxlen;
00263                 stringcode activeMacAddressFeature_code;
00264                 long activeMacAddressFeature_maxlen;
00265                 double activeSignalLevelFeature_minval;
00266                 double activeSignalLevelFeature_maxval;
00267                 stringcode peersFeature_code;
00268                 long peersFeature_maxlen;
00269                 long numPeersFeature_minval;
00270                 long numPeersFeature_maxval;
00272 
00273 
00274         protected:
00276 
00277                 WlanPeerInfo activePeer;
00278                 vector<WlanPeerInfo> peerList;
00279                 bool activePeerValid, peerListValid;
00281 };
00282 
00283 #endif // _WLAN_H

Generated on Mon Jun 5 10:20:42 2006 for Intelligence.kdevelop by  doxygen 1.4.6