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
|
|
|
//@}
|
|
|
|
|
|
|
|
/** @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_
|