#include "wifidevice.hh" using namespace std ; /*** Constructeurs ***/ WifiDevice::WifiDevice(const string &_ip_addr, const string &_mac_addr, const float &_antenna_gain, const float &_trx_power) { ip_addr = _ip_addr ; mac_addr = _mac_addr ; antenna_gain = PosUtil::channel_to_frequency(_antenna_gain) ; trx_power = _trx_power ; } WifiDevice::WifiDevice(const WifiDevice &wd) { ip_addr = wd.ip_addr ; mac_addr = wd.mac_addr ; antenna_gain = wd.antenna_gain ; trx_power = wd.trx_power ; } /*** Accesseurs lecture ***/ string WifiDevice::get_ip_addr() const { return ip_addr ; } string WifiDevice::get_mac_addr() const { return mac_addr ; } float WifiDevice::get_antenna_gain() const { return antenna_gain ; } float WifiDevice::get_trx_power() const { return trx_power ; } /*** Accesseurs écriture ***/ void WifiDevice::set_ip_addr(const string &_ip_addr) { ip_addr = _ip_addr ; } void WifiDevice::set_mac_addr(const string &_mac_addr) { mac_addr = _mac_addr ; } void WifiDevice::set_antenna_gain(float &_antenna_gain) { antenna_gain = PosUtil::channel_to_frequency(_antenna_gain) ; } void WifiDevice::set_trx_power(float &_trx_power) { trx_power = _trx_power ; } /*** Opérateurs ***/ WifiDevice WifiDevice::operator=(const WifiDevice &wd) { if (this == &wd) return *this ; ip_addr = wd.ip_addr ; mac_addr = wd.mac_addr ; antenna_gain = wd.antenna_gain ; trx_power = wd.trx_power ; return *this ; } bool WifiDevice::operator==(const WifiDevice &wd) const { if (this == &wd) return true ; return ip_addr == wd.ip_addr && mac_addr == wd.mac_addr && antenna_gain == wd.antenna_gain && trx_power == wd.trx_power ; } bool WifiDevice::operator!=(const WifiDevice &wd) const { return !(*this == wd) ; } ostream &operator<<(ostream &os, const WifiDevice &wd) { os << "IP address: " << wd.ip_addr << endl << "MAC address: " << wd.mac_addr << endl << "Antenna gain: " << wd.antenna_gain << "dBi" << endl << "Output power: " << wd.trx_power << "dBm" ; return os ; }