orca-robotics


INTRODUCTION
Overview
Download and Install
Documentation

REPOSITORY
Interfaces
Drivers
Libraries
Utilities
Software Map

DEVELOPER
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

wifiutil.h

00001 /*
00002  * Orca-Robotics Project: Components for robotics 
00003  *               http://orca-robotics.sf.net/
00004  * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
00005  *
00006  * This distribution is licensed to you under the terms described in
00007  * the LICENSE file included in this distribution.
00008  *
00009  */
00010  
00011 #ifndef WIFI_UTIL_H
00012 #define WIFI_UTIL_H
00013 
00014 #include <string>
00015 #include <vector>
00016 
00017 namespace wifiutil {
00018 
00019     enum Result
00020     {
00021         NoWirelessInterface,
00022         IoctlProblem,
00023         OtherError
00024     };
00025     
00027     class Exception : public std::exception
00028     {
00029     public:
00030 
00031         Exception(const char *message)
00032             : message_(message) {}
00033         Exception(const std::string &message)
00034             : message_(message) {}
00035 
00036         virtual ~Exception() throw() {}
00037 
00038         virtual const char* what() const throw() { return message_.c_str(); }
00039         
00040         virtual Result type() const { return OtherError; }
00041 
00042     protected:
00043 
00044         std::string  message_;
00045     };
00046     
00047     class NoWirelessInterfaceException : public Exception
00048     {  
00049         public:
00050             NoWirelessInterfaceException( const char * message )
00051                 : Exception( message ) {}
00052             virtual Result type() const { return NoWirelessInterface; }        
00053     };
00054     
00055     class IoctlException : public Exception
00056     {  
00057         public:
00058             IoctlException( const char * message )
00059                 : Exception( message ) {}
00060             virtual Result type() const { return IoctlProblem; }        
00061     };
00062     
00064     struct ProcData
00065     {
00066         std::string interfaceName;
00067         int status;
00068         int linkQuality;
00069         int signalLevel;
00070         int noiseLevel;
00071         int numInvalidNwid;
00072         int numInvalidCrypt;
00073         int numInvalidFrag;
00074         int numRetries;
00075         int numInvalidMisc;
00076         int numMissedBeacons;   
00077     };
00078     
00080     enum OperationMode
00081     {
00082         // unknown operating mode
00083         OperationModeUnknown,
00084         // driver decides the mode
00085         OperationModeAuto,
00086         // ad hoc mode
00087         OperationModeAdhoc,
00088         // infrastructure mode (multi cell network, roaming)
00089         OperationModeInfrastructure,
00090         // access point, master mode
00091         OperationModeMaster,
00092         // repeater mode
00093         OperationModeRepeat,
00094         // secondary/backup repeater
00095         OperationModeSecondRepeater
00096     };
00097     
00099     struct WirelessConfig
00100     {
00101         std::string interfaceName;
00102         OperationMode mode;
00103         int bitrate;
00104         std::string accessPoint;
00105     };
00106     
00108     enum LinkQualityType 
00109     {
00110         // link quality type is unknown
00111         LinkQualityTypeUnknown,
00112         // link quality is in dBm
00113         LinkQualityTypeDbm,
00114         // link quality is relative
00115         LinkQualityTypeRelative
00116     };
00117     
00119     struct IoctlData
00120     {
00121         std::string interfaceName;
00122         int throughPut;
00123         LinkQualityType linkType;
00124         int linkQuality;
00125         int signalLevel;
00126         int noiseLevel;
00127         int maxLinkQuality;
00128         int maxSignalLevel;
00129         int maxNoiseLevel;
00130     };
00131     
00134     void readFromProc( std::vector<ProcData> &wifiData );
00135     
00137     void printData( std::vector<ProcData> &wifiData );
00138     
00141     void readConfig( std::vector<WirelessConfig> &wifiConfigs );
00142     
00144     void printConfig( std::vector<WirelessConfig> &wifiConfigs );
00145     
00148     void readUsingIoctl( std::vector<IoctlData> &wifiDataIoctl );
00149     
00151     void printDataIoctl( std::vector<IoctlData> &wifiDataIoctl );
00152     
00154     void getInterfaceNames( std::vector<std::string> &interfaceNames );
00155 
00156 }
00157  
00158 #endif
00159  
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5