2009-12-11 17:56:31 +01:00
|
|
|
#ifndef _OWLPS_POSITIONING_WIFIDEVICE_HH_
|
|
|
|
#define _OWLPS_POSITIONING_WIFIDEVICE_HH_
|
|
|
|
|
|
|
|
#include "posutil.hh"
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#define WIFIDEVICE_DEFAULT_ANTENNA_GAIN 2
|
|
|
|
#define WIFIDEVICE_DEFAULT_TRX_POWER 20 // 20 dBm = 100 mW
|
|
|
|
|
|
|
|
class WifiDevice
|
|
|
|
{
|
|
|
|
protected:
|
2010-01-04 17:10:42 +01:00
|
|
|
std::string ip_addr ;
|
|
|
|
std::string mac_addr ;
|
2009-12-11 17:56:31 +01:00
|
|
|
float antenna_gain ; // Antenna gain in dBi
|
|
|
|
float trx_power ; // Transmit power in dBm
|
|
|
|
|
|
|
|
public:
|
2010-01-04 17:10:42 +01:00
|
|
|
WifiDevice(const std::string &_ip_addr,
|
|
|
|
const std::string &_mac_addr,
|
2009-12-11 17:56:31 +01:00
|
|
|
const float &_antenna_gain = WIFIDEVICE_DEFAULT_ANTENNA_GAIN,
|
|
|
|
const float &_trx_power = WIFIDEVICE_DEFAULT_TRX_POWER) ;
|
|
|
|
WifiDevice(const WifiDevice &wd) ;
|
|
|
|
|
|
|
|
~WifiDevice() {}
|
|
|
|
|
2010-01-04 17:10:42 +01:00
|
|
|
std::string get_ip_addr(void) const ;
|
|
|
|
std::string get_mac_addr(void) const ;
|
2009-12-11 17:56:31 +01:00
|
|
|
float get_antenna_gain(void) const ;
|
|
|
|
float get_trx_power(void) const ;
|
|
|
|
|
2010-01-04 17:10:42 +01:00
|
|
|
void set_ip_addr(const std::string &_ip_addr) ;
|
|
|
|
void set_mac_addr(const std::string &_mac_addr) ;
|
2009-12-11 17:56:31 +01:00
|
|
|
void set_antenna_gain(float &_antenna_gain) ;
|
|
|
|
void set_trx_power(float &_trx_power) ;
|
|
|
|
|
|
|
|
WifiDevice operator=(const WifiDevice &wd) ;
|
|
|
|
bool operator==(const WifiDevice &wd) const ;
|
|
|
|
bool operator!=(const WifiDevice &wl) const ;
|
|
|
|
|
2010-01-04 17:10:42 +01:00
|
|
|
friend std::ostream &operator<<(std::ostream &os, const WifiDevice &wd) ;
|
2009-12-11 17:56:31 +01:00
|
|
|
} ;
|
|
|
|
|
2010-01-05 11:50:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*** Accesseurs lecture ***/
|
|
|
|
|
|
|
|
|
|
|
|
inline std::string WifiDevice::get_ip_addr() const
|
|
|
|
{
|
|
|
|
return ip_addr ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline std::string WifiDevice::get_mac_addr() const
|
|
|
|
{
|
|
|
|
return mac_addr ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline float WifiDevice::get_antenna_gain() const
|
|
|
|
{
|
|
|
|
return antenna_gain ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline float WifiDevice::get_trx_power() const
|
|
|
|
{
|
|
|
|
return trx_power ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** Accesseurs écriture ***/
|
|
|
|
|
|
|
|
|
|
|
|
inline void WifiDevice::set_ip_addr(const std::string &_ip_addr)
|
|
|
|
{
|
|
|
|
ip_addr = _ip_addr ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline void WifiDevice::set_mac_addr(const std::string &_mac_addr)
|
|
|
|
{
|
|
|
|
mac_addr = _mac_addr ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline void WifiDevice::set_antenna_gain(float &_antenna_gain)
|
|
|
|
{
|
|
|
|
antenna_gain = PosUtil::channel_to_frequency(_antenna_gain) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline void WifiDevice::set_trx_power(float &_trx_power)
|
|
|
|
{
|
|
|
|
trx_power = _trx_power ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** Opérateurs ***/
|
|
|
|
|
|
|
|
|
|
|
|
inline bool WifiDevice::operator!=(const WifiDevice &wd) const
|
|
|
|
{
|
|
|
|
return !(*this == wd) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-12-11 17:56:31 +01:00
|
|
|
#endif // _OWLPS_POSITIONING_WIFIDEVICE_HH_
|