owlps/owlps-positioning/src/accesspoint.cc

68 lines
1.3 KiB
C++

/*
* This file is part of the Owl Positioning System (OwlPS).
* OwlPS is a project of the University of Franche-Comté
* (Université de Franche-Comté), France.
*/
#include "accesspoint.hh"
using namespace std ;
/* *** Operations *** */
double AccessPoint::friis_constant_term() const
{
double wavelength =
static_cast<double>(PosUtil::LIGHT_SPEED) / frequency ;
return antenna_gain + 20 * log10(wavelength) - 20 * log10(4 * M_PI) ;
}
/* *** Operators *** */
AccessPoint& AccessPoint::operator=(const AccessPoint &source)
{
if (this == &source)
return *this ;
this->WifiDevice::operator=(source) ;
coordinates = source.coordinates ;
frequency = source.frequency ;
friis_index = source.friis_index ;
return *this ;
}
bool AccessPoint::operator==(const AccessPoint &source) const
{
if (this == &source)
return true ;
return
this->WifiDevice::operator==(source) &&
coordinates == source.coordinates &&
frequency == source.frequency &&
friis_index == source.friis_index ;
}
ostream &operator<<(ostream &os, const AccessPoint &ap)
{
os
<< "Coordinates: " << ap.coordinates << '\n'
<< "Frequency: " << ap.frequency << " Hz" << '\n'
<< "Friis index: " << ap.friis_index << '\n'
<< (WifiDevice) ap ;
return os ;
}