2012-02-06 16:44:09 +01:00
|
|
|
/*
|
2013-05-29 18:43:35 +02:00
|
|
|
* This file is part of the Owl Positioning System (OwlPS) project.
|
|
|
|
* It is subject to the copyright notice and license terms in the
|
|
|
|
* COPYRIGHT.t2t file found in the top-level directory of this
|
|
|
|
* distribution and at
|
|
|
|
* http://code.lm7.fr/p/owlps/source/tree/master/COPYRIGHT.t2t
|
|
|
|
* No part of the OwlPS Project, including this file, may be copied,
|
|
|
|
* modified, propagated, or distributed except according to the terms
|
|
|
|
* contained in the COPYRIGHT.t2t file; the COPYRIGHT.t2t file must be
|
|
|
|
* distributed along with this file, either separately or by replacing
|
2013-06-22 23:30:17 +02:00
|
|
|
* this notice by the COPYRIGHT.t2t file's contents.
|
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
|
|
|
|
2013-06-14 21:54:26 +02:00
|
|
|
#define CP_DEFAULT_CHANNEL 6
|
|
|
|
#define CP_DEFAULT_ANTENNA_GAIN 5
|
2008-04-15 12:19:15 +02:00
|
|
|
|
2013-06-04 00:39:10 +02:00
|
|
|
/// Represents a [Wi-Fi device](@ref WifiDevice) used for capturing
|
|
|
|
/// requests
|
2013-06-14 21:54:26 +02:00
|
|
|
class CapturePoint: 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:
|
2013-05-30 21:23:05 +02:00
|
|
|
* - `_antenna_gain` Antenna gain in dBi.
|
|
|
|
* - `_trx_power` Transmit power in dBm.
|
2013-06-14 21:54:26 +02:00
|
|
|
* - `channel` Wi-Fi channel the CP 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.
|
|
|
|
*/
|
2013-06-14 21:54:26 +02:00
|
|
|
CapturePoint(const Point3D &_coordinates = Point3D(),
|
|
|
|
const std::string &_ip_addr = "",
|
|
|
|
const std::string &_mac_addr = "",
|
|
|
|
const float _antenna_gain = CP_DEFAULT_ANTENNA_GAIN,
|
|
|
|
const float _trx_power = WIFIDEVICE_DEFAULT_TRX_POWER,
|
|
|
|
const unsigned int &channel = CP_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
|
|
|
|
2013-06-14 21:54:26 +02:00
|
|
|
CapturePoint(const WifiDevice &source,
|
|
|
|
const Point3D &_coordinates,
|
|
|
|
const unsigned int channel = CP_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
|
|
|
|
2013-06-14 21:54:26 +02:00
|
|
|
CapturePoint(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
|
|
|
|
2013-06-14 21:54:26 +02:00
|
|
|
CapturePoint(const CapturePoint &source):
|
2010-03-05 17:24:18 +01:00
|
|
|
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
|
|
|
|
2013-06-14 21:54:26 +02:00
|
|
|
~CapturePoint(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 ;
|
2013-06-04 00:39:10 +02:00
|
|
|
/// Computes the percentage of the calibration packets from `trx`
|
2013-06-14 21:54:26 +02:00
|
|
|
/// received by the CP
|
|
|
|
float received_calibration_from_cp(const CapturePoint &trx) const ;
|
2011-08-01 19:40:42 +02:00
|
|
|
//@}
|
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
/** @name Operators */
|
|
|
|
//@{
|
2013-06-14 21:54:26 +02:00
|
|
|
CapturePoint& operator=(const CapturePoint &source) ;
|
|
|
|
bool operator==(const CapturePoint &source) const ;
|
|
|
|
bool operator!=(const CapturePoint &source) const ;
|
2010-01-16 12:23:07 +01:00
|
|
|
//@}
|
2009-12-11 13:52:21 +01:00
|
|
|
|
2013-06-14 21:54:26 +02:00
|
|
|
/// Displays a CapturePoint
|
|
|
|
friend std::ostream &operator<<(std::ostream &os, const CapturePoint &cp) ;
|
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
|
|
|
|
|
|
|
|
2013-06-14 21:54:26 +02:00
|
|
|
inline const Point3D& CapturePoint::get_coordinates() const
|
2010-01-05 11:50:24 +01:00
|
|
|
{
|
|
|
|
return coordinates ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-14 21:54:26 +02:00
|
|
|
inline unsigned long CapturePoint::get_frequency() const
|
2010-01-05 11:50:24 +01:00
|
|
|
{
|
|
|
|
return frequency ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-14 21:54:26 +02:00
|
|
|
inline float CapturePoint::get_friis_index() const
|
2010-06-10 15:57:03 +02:00
|
|
|
{
|
|
|
|
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
|
|
|
|
|
|
|
|
2013-06-14 21:54:26 +02:00
|
|
|
inline void CapturePoint::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.
|
|
|
|
*/
|
2013-06-14 21:54:26 +02:00
|
|
|
inline void CapturePoint::set_channel(const unsigned int channel)
|
2010-02-02 12:43:12 +01:00
|
|
|
{
|
2010-03-19 14:16:55 +01:00
|
|
|
set_frequency(PosUtil::wifi_channel_to_hz(channel)) ;
|
2010-02-02 12:43:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2013-05-30 21:23:05 +02:00
|
|
|
* Sets #frequency with the value of the parameter `_frequency.` No
|
2010-02-02 12:43:12 +01:00
|
|
|
* 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
|
|
|
*/
|
2013-06-14 21:54:26 +02:00
|
|
|
inline void CapturePoint::set_frequency(const unsigned long _frequency)
|
2010-01-05 11:50:24 +01:00
|
|
|
{
|
|
|
|
frequency = _frequency ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-14 21:54:26 +02:00
|
|
|
inline void CapturePoint::set_friis_index(const float _friis_index)
|
2010-06-10 15:57:03 +02:00
|
|
|
{
|
|
|
|
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
|
|
|
|
|
|
|
|
2013-06-14 21:54:26 +02:00
|
|
|
inline bool CapturePoint::operator!=(const CapturePoint &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_
|