2012-02-06 16:44:09 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the Owl Positioning System (OwlPS).
|
2012-11-03 14:52:33 +01:00
|
|
|
* OwlPS is a project of the University of Franche-Comte
|
2012-02-06 16:44:09 +01:00
|
|
|
* (Université de Franche-Comté), France.
|
2012-11-03 14:52:33 +01:00
|
|
|
*
|
|
|
|
* Copyright © Université de Franche-Comté 2007-2012.
|
|
|
|
*
|
|
|
|
* Corresponding author: Matteo Cypriani <mcy@lm7.fr>
|
|
|
|
*
|
|
|
|
***********************************************************************
|
|
|
|
*
|
|
|
|
* This software is governed by the CeCILL license under French law and
|
|
|
|
* abiding by the rules of distribution of free software. You can use,
|
|
|
|
* modify and/or redistribute the software under the terms of the CeCILL
|
|
|
|
* license as circulated by CEA, CNRS and INRIA at the following URL:
|
|
|
|
* http://www.cecill.info
|
|
|
|
*
|
|
|
|
* As a counterpart to the access to the source code and rights to copy,
|
|
|
|
* modify and redistribute granted by the license, users are provided
|
|
|
|
* only with a limited warranty and the software's authors, the holder
|
|
|
|
* of the economic rights, and the successive licensors have only
|
|
|
|
* limited liability.
|
|
|
|
*
|
|
|
|
* In this respect, the user's attention is drawn to the risks
|
|
|
|
* associated with loading, using, modifying and/or developing or
|
|
|
|
* reproducing the software by the user in light of its specific status
|
|
|
|
* of free software, that may mean that it is complicated to manipulate,
|
|
|
|
* and that also therefore means that it is reserved for developers and
|
|
|
|
* experienced professionals having in-depth computer knowledge. Users
|
|
|
|
* are therefore encouraged to load and test the software's suitability
|
|
|
|
* as regards their requirements in conditions enabling the security of
|
|
|
|
* their systems and/or data to be ensured and, more generally, to use
|
|
|
|
* and operate it in the same conditions as regards security.
|
|
|
|
*
|
|
|
|
* The fact that you are presently reading this means that you have had
|
|
|
|
* knowledge of the CeCILL license and that you accept its terms.
|
|
|
|
*
|
|
|
|
***********************************************************************
|
2012-02-06 16:44:09 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2009-12-11 13:52:21 +01:00
|
|
|
#ifndef _OWLPS_POSITIONING_ACCESSPOINT_HH_
|
|
|
|
#define _OWLPS_POSITIONING_ACCESSPOINT_HH_
|
2008-04-11 10:11:29 +02:00
|
|
|
|
2009-12-11 17:56:31 +01:00
|
|
|
#include "wifidevice.hh"
|
2009-12-11 13:52:21 +01:00
|
|
|
#include "point3d.hh"
|
2010-02-02 12:43:12 +01:00
|
|
|
#include "posutil.hh"
|
Incorporation de la dernière version de Julien
Extrait de son courriel :
« Par rapport à la précédente j'ai surtout corrigé des bugs. »
Note : la version du listener portable sur Fonera, envoyée en même temps
par Julien, viendra plus tard (le temps que je l'incorpore).
Détail des changements après analyse du code :
aggregator : correction de bogues.
positioning :
* Ajout d'un fichier de config format boost (cfg/config.cfg).
* Makefile : implantation des cibles "install" et "uninstall" ; la cible
"astyle" devient "style".
* accesspoint.{hh,cc}, area.cc, measurement.hh, point.{hh,cc},
referencepoint.{hh,cc} : cosmétique.
* owlps-positioning.c : correction de la lecture du fichier de config
(ajout d'une option permettant de spécifier un fichier alternatif).
* server.cc : essentiellement correction des requêtes.
* libowlps-positioning.{hh,cc} : passage de "unsigned long long" à
"uint64_t" comme type de retour de timeval_to_ms().
writeInDb :
* Ajout de la gestion d'un fichier de config.
* Ajout de deux scripts pour la BDD.
git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@96 785a6c6c-259e-4ff1-8b91-dc31627914f0
2009-07-01 15:39:58 +02:00
|
|
|
|
2009-12-11 13:52:21 +01:00
|
|
|
#define AP_DEFAULT_CHANNEL 6
|
2009-12-11 17:56:31 +01:00
|
|
|
#define AP_DEFAULT_ANTENNA_GAIN 5
|
2008-04-15 12:19:15 +02:00
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
/// Represents a capture \link WifiDevice Wi-Fi device\endlink
|
2009-12-11 17:56:31 +01:00
|
|
|
class AccessPoint: public WifiDevice
|
2010-05-21 10:35:15 +02:00
|
|
|
{
|
|
|
|
protected:
|
2010-03-05 17:24:18 +01:00
|
|
|
Point3D coordinates ;
|
2010-03-19 14:16:55 +01:00
|
|
|
unsigned long frequency ; ///< Frequency (channel) in Hz
|
2010-06-10 15:57:03 +02:00
|
|
|
float friis_index ; ///< Friis index used by FBCM
|
Incorporation de la dernière version de Julien
Extrait de son courriel :
« Par rapport à la précédente j'ai surtout corrigé des bugs. »
Note : la version du listener portable sur Fonera, envoyée en même temps
par Julien, viendra plus tard (le temps que je l'incorpore).
Détail des changements après analyse du code :
aggregator : correction de bogues.
positioning :
* Ajout d'un fichier de config format boost (cfg/config.cfg).
* Makefile : implantation des cibles "install" et "uninstall" ; la cible
"astyle" devient "style".
* accesspoint.{hh,cc}, area.cc, measurement.hh, point.{hh,cc},
referencepoint.{hh,cc} : cosmétique.
* owlps-positioning.c : correction de la lecture du fichier de config
(ajout d'une option permettant de spécifier un fichier alternatif).
* server.cc : essentiellement correction des requêtes.
* libowlps-positioning.{hh,cc} : passage de "unsigned long long" à
"uint64_t" comme type de retour de timeval_to_ms().
writeInDb :
* Ajout de la gestion d'un fichier de config.
* Ajout de deux scripts pour la BDD.
git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@96 785a6c6c-259e-4ff1-8b91-dc31627914f0
2009-07-01 15:39:58 +02:00
|
|
|
|
2010-05-21 10:35:15 +02:00
|
|
|
public:
|
2010-02-02 12:43:12 +01:00
|
|
|
/**
|
2010-03-05 17:24:18 +01:00
|
|
|
* Special parameters:
|
|
|
|
* - \em _antenna_gain Antenna gain in dBi.
|
|
|
|
* - \em _trx_power Transmit power in dBm.
|
|
|
|
* - \em channel Wi-Fi channel the AP is listening to (integer
|
2010-02-02 12:43:12 +01:00
|
|
|
* between 1 and 14). It will be converted to a frequency in Hz.
|
|
|
|
*/
|
2010-01-12 00:31:22 +01:00
|
|
|
AccessPoint(const Point3D &_coordinates = Point3D(),
|
|
|
|
const std::string &_ip_addr = "",
|
|
|
|
const std::string &_mac_addr = "",
|
2010-06-10 15:57:03 +02:00
|
|
|
const float _antenna_gain = AP_DEFAULT_ANTENNA_GAIN,
|
|
|
|
const float _trx_power = WIFIDEVICE_DEFAULT_TRX_POWER,
|
2010-02-02 12:43:12 +01:00
|
|
|
const unsigned int &channel = AP_DEFAULT_CHANNEL):
|
2009-12-11 17:56:31 +01:00
|
|
|
WifiDevice(_ip_addr, _mac_addr, _antenna_gain, _trx_power),
|
2010-02-02 12:43:12 +01:00
|
|
|
coordinates(_coordinates),
|
2010-06-10 15:57:03 +02:00
|
|
|
frequency(PosUtil::wifi_channel_to_hz(channel)),
|
|
|
|
friis_index(0) {}
|
2010-01-16 12:23:07 +01:00
|
|
|
|
2010-03-05 17:24:18 +01:00
|
|
|
AccessPoint(const WifiDevice &source,
|
2010-01-16 12:23:07 +01:00
|
|
|
const Point3D &_coordinates,
|
2010-06-10 15:57:03 +02:00
|
|
|
const unsigned int channel = AP_DEFAULT_CHANNEL):
|
2010-03-05 17:24:18 +01:00
|
|
|
WifiDevice(source), coordinates(_coordinates),
|
2010-06-10 15:57:03 +02:00
|
|
|
frequency(PosUtil::wifi_channel_to_hz(channel)),
|
|
|
|
friis_index(0) {}
|
2010-01-16 12:23:07 +01:00
|
|
|
|
2010-03-05 17:24:18 +01:00
|
|
|
AccessPoint(const WifiDevice &source):
|
2010-06-10 15:57:03 +02:00
|
|
|
WifiDevice(source), coordinates(Point3D()), frequency(0),
|
|
|
|
friis_index(0) {}
|
2010-01-16 12:23:07 +01:00
|
|
|
|
2010-03-05 17:24:18 +01:00
|
|
|
AccessPoint(const AccessPoint &source):
|
|
|
|
WifiDevice(source), coordinates(source.coordinates),
|
2010-06-10 15:57:03 +02:00
|
|
|
frequency(source.frequency), friis_index(0) {}
|
2009-12-11 13:52:21 +01:00
|
|
|
|
2010-03-05 17:24:18 +01:00
|
|
|
~AccessPoint(void) {}
|
2009-12-11 13:52:21 +01:00
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
/** @name Read accessors */
|
|
|
|
//@{
|
2010-01-13 15:29:44 +01:00
|
|
|
const Point3D& get_coordinates(void) const ;
|
2010-03-19 14:16:55 +01:00
|
|
|
unsigned long get_frequency(void) const ;
|
2010-06-10 15:57:03 +02:00
|
|
|
float get_friis_index(void) const ;
|
2010-01-16 12:23:07 +01:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/** @name Write accessors */
|
|
|
|
//@{
|
|
|
|
void set_coordinates(const Point3D &_coordinates) ;
|
2010-02-02 12:43:12 +01:00
|
|
|
void set_channel(const unsigned int channel) ;
|
2010-03-19 14:16:55 +01:00
|
|
|
void set_frequency(const unsigned long _frequency) ;
|
2010-06-10 15:57:03 +02:00
|
|
|
void set_friis_index(const float _friis_index) ;
|
2010-01-16 12:23:07 +01:00
|
|
|
//@}
|
|
|
|
|
2011-08-01 19:40:42 +02:00
|
|
|
/** @name Operations */
|
|
|
|
//@{
|
|
|
|
/// Returns the Friis formula's constant term
|
|
|
|
double friis_constant_term(void) const ;
|
2011-12-29 14:40:50 +01:00
|
|
|
/// \brief Computes the percentage of the calibration packets from
|
|
|
|
/// \em trx received by the AP
|
|
|
|
float received_calibration_from_ap(const AccessPoint &trx) const ;
|
2011-08-01 19:40:42 +02:00
|
|
|
//@}
|
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
/** @name Operators */
|
|
|
|
//@{
|
2011-07-30 20:38:42 +02:00
|
|
|
AccessPoint& operator=(const AccessPoint &source) ;
|
2010-03-05 17:24:18 +01:00
|
|
|
bool operator==(const AccessPoint &source) const ;
|
|
|
|
bool operator!=(const AccessPoint &source) const ;
|
2010-01-16 12:23:07 +01:00
|
|
|
//@}
|
2009-12-11 13:52:21 +01:00
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
/// Displays an AccessPoint
|
2010-01-04 17:10:42 +01:00
|
|
|
friend std::ostream &operator<<(std::ostream &os, const AccessPoint &ap) ;
|
2009-12-11 13:52:21 +01:00
|
|
|
} ;
|
|
|
|
|
2010-01-05 11:50:24 +01:00
|
|
|
|
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
/* *** Read accessors *** */
|
2010-01-05 11:50:24 +01:00
|
|
|
|
|
|
|
|
2010-01-13 15:29:44 +01:00
|
|
|
inline const Point3D& AccessPoint::get_coordinates() const
|
2010-01-05 11:50:24 +01:00
|
|
|
{
|
|
|
|
return coordinates ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-19 14:16:55 +01:00
|
|
|
inline unsigned long AccessPoint::get_frequency() const
|
2010-01-05 11:50:24 +01:00
|
|
|
{
|
|
|
|
return frequency ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-10 15:57:03 +02:00
|
|
|
inline float AccessPoint::get_friis_index() const
|
|
|
|
{
|
|
|
|
return friis_index ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-05 11:50:24 +01:00
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
/* *** Write accessors *** */
|
2010-01-05 11:50:24 +01:00
|
|
|
|
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
inline void AccessPoint::set_coordinates(const Point3D &_coordinates)
|
2010-01-05 11:50:24 +01:00
|
|
|
{
|
|
|
|
coordinates = _coordinates ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-02 12:43:12 +01:00
|
|
|
/**
|
|
|
|
* @param channel A Wi-Fi channel (integer between 1 and 14). It will
|
|
|
|
* be converted into a frequency in Hz and affected to #frequency. If
|
|
|
|
* it is not a Wi-Fi channel number, 0 will be affected to #frequency.
|
|
|
|
*/
|
|
|
|
inline void AccessPoint::set_channel(const unsigned int channel)
|
|
|
|
{
|
2010-03-19 14:16:55 +01:00
|
|
|
set_frequency(PosUtil::wifi_channel_to_hz(channel)) ;
|
2010-02-02 12:43:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets #frequency with the value of the parameter \em _frequency. No
|
|
|
|
* control is done, so you should pass a correct value.
|
|
|
|
*
|
|
|
|
* Note that set_channel() is more secure because a wrong channel
|
2011-05-04 19:20:46 +02:00
|
|
|
* number will cause #frequency to be set to zero.
|
2010-02-02 12:43:12 +01:00
|
|
|
*/
|
2010-03-19 14:16:55 +01:00
|
|
|
inline void AccessPoint::set_frequency(const unsigned long _frequency)
|
2010-01-05 11:50:24 +01:00
|
|
|
{
|
|
|
|
frequency = _frequency ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-10 15:57:03 +02:00
|
|
|
inline void AccessPoint::set_friis_index(const float _friis_index)
|
|
|
|
{
|
|
|
|
friis_index = _friis_index ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-05 11:50:24 +01:00
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
/* *** Operators *** */
|
2010-01-05 11:50:24 +01:00
|
|
|
|
|
|
|
|
2010-03-05 17:24:18 +01:00
|
|
|
inline bool AccessPoint::operator!=(const AccessPoint &source) const
|
2010-01-05 11:50:24 +01:00
|
|
|
{
|
2010-03-05 17:24:18 +01:00
|
|
|
return !(*this == source) ;
|
2010-01-05 11:50:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-12-11 13:52:21 +01:00
|
|
|
#endif // _OWLPS_POSITIONING_ACCESSPOINT_HH_
|