Commit Graph

315 Commits

Author SHA1 Message Date
Matteo Cypriani 6ad31f9af4 [Positioning] InputCSV: prepare handling CalibrationRequest
InputMedium:
- Split into two files (inputmedium.{hh,cc}).
- Add polymorphic handling of CalibrationRequest.
- Write unit tests.

InputCSV:
- Use new code of InputMedium to handle calibration requests.
- We detect if the read request is a calibration request, but
  specific attributes are not initialised.
2011-03-16 14:36:20 +01:00
Matteo Cypriani 1ceab071a2 [Positioning] InputMedium: current_request now pointer
To handle calibration requests, we will need to make current_request be
either a Request or a CalibrationRequest, so we must dynamically
allocate it.
2011-03-16 14:36:20 +01:00
Matteo Cypriani 0b461bf4d0 [Positioning] InputCSV: read direction as int
Prepare handling of calibration requests.
2011-03-16 14:36:20 +01:00
Matteo Cypriani ce92f0979e [Positioning] +CalibrationRequest, -CalibrationMeasurement
Delete class CalibrationMeasurement and add class CalibrationRequest:
the ReferencePoint must be linked by the Request, not by each
Measurement of the Request.

Adapt ReferencePoint to link a CalibrationRequest instead of a
CalibrationMeasurement.

Request:
- Destructor is now virtual to allow polymorphism.
- Reactivate tests on get_measurements() and set_measurements().
2011-03-16 14:36:20 +01:00
Matteo Cypriani a5aa1af433 [Positioning] Add logging support
Add interface InputLogMedium and class InputLogCSV.

Input: Add logging support.

UserInterface: Add logging options.

Configuration:
- Rename functions (suppress "get_").
- Add functions to allow multiple values in one option (needed by
  logging options):
  - value_exists_in_string_vector()
  - string_vector_value()

InputCSV: Add a destructor.

posexcept.hh: Add no_log_csv_file exception.

TestUtil:
- Improve set_up().
- Add functions used in InputLogCSV_test:
  - functions to compare Request & Co,
  - functions to compare the sizes of two files.
2011-03-16 14:36:19 +01:00
Matteo Cypriani 8257e9e67d [Positioning] Tests: add global set up & tear down
Work on unit tests:
- TestUtil:
  - Add set_up(), that sets up lists of Request, Mobile and AccessPoint,
    primarily to be used with create_test_csv_file().
  - Add public attributes for these lists.
  - Update create_test_csv_file() to use these lists.
- Update InputCSV_test to use new TestUtil.
- Add class TestSetUp, a global fixture class. Before all tests off all
  test suites, it calls TestUtil::set_up().
- Update and clean Makefile.
2011-03-16 14:36:19 +01:00
Matteo Cypriani dbd58f8178 [Positioning] TestUtil: Add create_test_csv_file() 2011-03-16 14:36:19 +01:00
Matteo Cypriani b6ab3c841d [Positioning] Use new exceptions in posexcept
Replace use of standard exceptions (std::out_of_range,
std::runtime_error) by new exceptions in posexcept.
2011-03-16 14:36:19 +01:00
Matteo Cypriani fc1ceb25c7 [Positioning] Add Input & posexcept.{hh,cc}
- Add files posexcept.{hh,cc} that contains exception classes.
- Add class Input, that handles InputMedium (and InputLogMedium, in the
  future). Note that for the moment, the unit test is *very* minimal.
- UserInterface: Add options for the input medium and the CSV file.
2011-03-16 14:36:19 +01:00
Matteo Cypriani 0ddef4c747 [Positioning] Add TestUtil, utilitary test class
Add the class TestUtil, that provides functions used in several unit
tests. For the moment, it contains two function:
- fill_file(), that creates and fills a test file.
- remove_file(), that deletes a test file.
2011-03-16 14:36:19 +01:00
Matteo Cypriani c341f852b7 [Positioning] Clean Makefile 2011-03-16 14:36:19 +01:00
Matteo Cypriani 9cf4daca3b [Positioning] Add Configuration and UserInterface
- Add class Configuration, a stock for the configuration structure.
- Add class UserInterface, that handles the configuration input.
- Update owlps-positioning.cc (delete old stuff like configuration) and
  delete owlps-positioning.hh: we now have a compilable executable.
2011-03-16 14:36:19 +01:00
Matteo Cypriani 12d14b805f [Positioning] Measurement: test avg. computation
This commit pass finally all unit tests without any warning!

Measurement:
- Finish unit test (test the average SS).
- Fix update_average_ss() and add_ss().
- average_ss is now double.
2011-03-16 14:36:19 +01:00
Matteo Cypriani a9a2331cfa [Positioning] Finish unit tests for Area & Point3D
Area:
- Unit test: test inversion of points.
- Add reorder_coordinates().
- Remove all set_{x,y,z}_{min,max}() accessors.
- Remove set_p_min() and set_p_max().
- Add set_coordinates().
- The constructor now takes 2 Point3D instead of 6 float coordinates.

Point3D:
- Unit test: finish to test distances, test new cast operator.
- Add a cast to string operator.

Unit tests:
- Add valuetraits.hh with class to display correctly a Point3D in a
  wrong assertion.
2011-03-16 14:36:19 +01:00
Matteo Cypriani b921263795 [Positioning] Add class Timestamp
Add a class Timestamp that boxes the structure timespec from <ctime>.
timespec manipulation functions are removed from PosUtil.
2011-03-16 14:36:19 +01:00
Matteo Cypriani 0bce0ad2bd [Positioning] Point3D: beautify
Use "source" as parameter name for several functions.
2011-03-16 14:36:19 +01:00
Matteo Cypriani 1ddebc9cf4 [Positioning] Area: Suppress debug cout
Suppress the last preprocessor-controlled debug display in Area.
2011-03-16 14:36:19 +01:00
Matteo Cypriani c5eff5f857 [Positioning] const_iterators instead of iterators 2011-03-16 14:36:19 +01:00
Matteo Cypriani 910d9a04d9 [Positioning] InputCSV: handle auto EOF & closing
InputCSV:
- Add eof_close() to automatically close the file when EOF is reached.
- Add read_next_line(), that read the next non-blank line and skips
  blank characters.
- Add current_line, a string containing the current line data.
- Update unit test.

InputMedium:
- Rename InputMedium::current_line to current_line_nb.
2011-03-16 14:36:19 +01:00
Matteo Cypriani ec10ed71a1 [Positioning] Add test for InputCSV
- Add unit test for InputCSV.
- Request: Add get_measurements().
- Stock:
  - Add clear().
  - Update tests to use it.
2011-03-16 14:36:19 +01:00
Matteo Cypriani bd28a26fa3 [Positioning] Add unit tests
Add tests for all (rewriten) classes, except for InputCSV.
2011-03-16 14:36:19 +01:00
Matteo Cypriani fb73ba03c1 [Positioning] Add README (CxxTest install how-to) 2011-03-16 14:36:18 +01:00
Matteo Cypriani d8c604f3ba [Positioning] Fix AccessPoint & WifiDevice
AccessPoint:
- Fix a bug with the frequency.
- Add an accessor set_channel() that calls set_frequency().

WifiDevice:
- Fix a bug with the antenna gain (which was converted with
  PosUtil::channel_to_frequency()).
- Pass float arguments as values and not references.
2011-03-16 14:36:10 +01:00
Matteo Cypriani efac35a515 [Positioning] Get rid of STLport, complete Request
- Now use Boost.TR1 instead of STLport, for unordered_map.
- Add operator=(), operator==(), operator!=() and a copy constructor to
  Request.
2011-03-16 14:36:10 +01:00
Matteo Cypriani 7c6492645d [Positioning] Fix some errors
Fix some errors revealed during writing of unit tests.

Building: Fix wrong #ifndef in building.hh.

Measurement: New default constructor.

PosUtil:
- Remove nanosecond-precision functions.
- Add timespec_round_to_ms() to lower the precision of a struct timespec
  to millisecond.
- Add timespec_equals to compare two struct timespec (maybe an
  operator==() would be better?).
2011-03-16 14:36:10 +01:00
Matteo Cypriani f4c825c2d9 [Positioning] const_cast & other minor enhancements
- In all classes where we used a C-style cast to suppress const, we now
  use a const_cast.
- Area: Add operator=().
- InputCSV:
	- Document get_next_request().
	- Handle exception when using Stock::get_{ap,mobile}().
	- In constructor, throw an exception in case of error when opening the
	  input file.
- CalibrationMeasurement: Remove operator<<() which is useless (it is a
  simple call to Measurement operator<<()).
- Makefile: Add target 'check'.
2011-03-16 14:36:10 +01:00
Matteo Cypriani 1f1d7de4f5 [Positioning] Doxygen comments + fixes
- Add/update comments to be Doxygen compliant. Translate existing
  comments in English.
- Various fixes (more or less importants):
	- NULL pointer verification when adding an element to a vector of
	  pointers.
	- Add some missing accessors.
	- Add some more error handling with exceptions. Class Stock: correct
	  accessors (pure read accessors do not create a missing element any
		more, but throw an exception).
- Makefile: Add 'doc' target.
- Update TODO (some things noticed when reviewing the code for
  comments).
2011-03-16 14:36:10 +01:00
Matteo Cypriani ab3302ff28 [Positioning] Beautify code
In all classes:
- Read accessors return a const reference instead of a value.
- operator=() returns a const reference.
- Use '\n' instead of std::endl in all stream manipulations, when
  buffer flush is not required.
- Use pre-incrementing where possible, instead of post-incrementing.

- Point3D: Destructor must be virtual (thanks cppcheck!).
- Update TODO.
2011-03-16 14:36:10 +01:00
Matteo Cypriani cc31b5dcc6 [Positioning] Add class Stock, finish InputCSV
Add AP and mobile management in InputCSV. Lists of known APs and mobiles
are static attributes of the class Stock.
2011-03-16 14:36:10 +01:00
Matteo Cypriani 5f8f955a3d [Positioning] Add Request, complete InputCSV
== code/owlps-positioning ==

- Add new class Request (split of Measurement).
- Update Measurement and CalibrationMeasurement (suppress the 'mobile'
  attribute).
- Update InputCSV (and InputMedium) to use Request instead of
  Measurement. Complete the file reading (mobile & ap pointers remain to
  be implemented).
- PosUtil: Add timespec_to_ms(), timespec_to_ns(), ms_to_timespec(), and
  ns_to_timespec().
- Makefile: Update to use stlport, fix all deps and add new classes.
- Minor fixes.
- TODO: Add UML-related things, updates Measurement & Request.

== code ==

- libowlps: Add ms_to_timeval() (commented), may be useful later.
- Add TODO.
2011-03-16 14:35:56 +01:00
Matteo Cypriani 8f071d13b0 [Positioning] Add classes InputMedium & InputCSV
- Add classes InputMedium and InputCSV. They handle Measurements.
- Measurement: add set_ss_list() and clear().
- Add new files in Makefile.
- TODO: thinking about Measurement vs. a new class Request.
2011-03-16 14:35:45 +01:00
Matteo Cypriani 1cf560309a [Positioning] Several fixes
- Makefile: fix waypoint.o.
- UTF-8 calibrationmeasurement.{hh,cc}, measurement.cc.
- CalibrationMeasurement: fix destructor.
- Measurement: fix const functions, add operator bool().
- Update TODO.
2011-03-16 14:07:24 +01:00
Matteo Cypriani 4e5db1af92 [Positioning] Fix #include and class declarations
Where possible, put the #include in the .cc file instead of the header
file.
Include <ostream> when <iostream> is not needed.

Fix a bug in operator<<() for Measurement: NULL value of ap and mobile
was not checked.
2011-03-16 14:07:24 +01:00
Matteo Cypriani d156e91379 [Positioning] Inline short functions
Short functions (accessors and simple operators) are declared inline and
moved in header files, after the class definition.
2011-03-16 14:07:24 +01:00
Matteo Cypriani 96023d8285 [Positioning] Suppress "using" directives in *.hh
(and add .gitignore)
2011-03-16 14:07:24 +01:00
Matteo Cypriani 40617901f6 [Positioning] Class declarations, vector.at(), iterators
- Add section « C++ en action » in TODO.
- Where possible, class declarations instead of #include.
- Use of iterators and at() instead of operator[] for vectors.
- Const arguments for operator<< where forgotten.
2011-03-16 14:07:24 +01:00
Matteo Cypriani d257d08d8d [Positioning] Makefile & Compilation fixes
- Updated Makefile to be able to compile each class.
- Fixed some compilation errors (CalibrationMeasurement, Point3D,
  ReferencePoint, WayPoint) and a warning in Measurement.
2011-03-16 14:07:24 +01:00
Matteo Cypriani 326f1245ed [Positioning] AccessPoint, Mobile, Measurement, ReferencePoint
- Adding WifiDevice and Mobile. AccessPoint and Mobile are sub-classes
  of WifiDevice.
- Measurement: link to Mobile and AccessPoint.
- Adding CalibrationMeasurement.
- ReferencePoint: add_measurement() and operators, link to
  CalibrationMeasurement (not Measurement).
- Area and Waypoint : using pointers (not references) for attribute
  setting.
- Deleted class ClientInfo (replaced by Mobile).
2011-03-16 14:07:24 +01:00
Matteo Cypriani 1808acd870 [Positioning] Work on AccessPoint and Measurement
Modification of AccessPoint and Measurement to fit the class diagram.
Adding class PosUtil, for static utilitary functions (will be the
successor of the false library libowlps-positioning).
2011-03-16 14:07:23 +01:00
Matteo Cypriani 85cca4debd [Positioning] Rewriting begins
/!\ This branch does not compile! (But some single files can.)
/!\ All the following commits are broken code. (Hopefully it will work
/!\ in a few days.)

Backup commit. Beginning of the rewriting work on OWLPS Positioning,
following the new class diagram.
2011-03-16 14:07:23 +01:00
Matteo Cypriani d35e0dd5e5 [Positioning] Reindent with astyle 1.24 2011-03-16 14:07:23 +01:00
Matteo Cypriani 3b6eb55e38 Nettoyage du code de listener et libowlps
listener + libowlps : nettoyage, amélioration de la qualité du code,
tests sur le type du paquet capturé.

git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@108 785a6c6c-259e-4ff1-8b91-dc31627914f0
2011-03-16 14:07:23 +01:00
Matteo Cypriani 629ed77470 [i-c] Mode passif dans aggregator et listener
Implantation (basique) du mode passif dans aggregator et listener.

git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@107 785a6c6c-259e-4ff1-8b91-dc31627914f0
2011-03-16 14:07:23 +01:00
Matteo Cypriani 24fef29457 [Listener] Add -v -q -m + other modifications
owlps-listener :
* Détail des erreurs d'ouverture / parcours du fichier de configuration.
* Ajout des option -v et -q permettant de choisir si le programme doit
  être verbeux ou silencieux.
* Modification des en-têtes de capture() et read_packet() pour utiliser
  la structure de configuration plutôt que des passages d'arguments.
  Note : peut-être serait-il bien de déplacer read_packet() dans
  capture() (à la place de got_packet) pour éviter le passage incessant
  des arguments sockfd et server.
* Ajout de l'option -m permettant de choisir le mode (actif, passif,
  mixte).
* Préparation de l'implantation du mode passif (dans read_packet).

git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@106 785a6c6c-259e-4ff1-8b91-dc31627914f0
2011-03-16 14:07:23 +01:00
Matteo Cypriani c2f18d715e [Positioning] Intégration commentaires de Julien
git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@105 785a6c6c-259e-4ff1-8b91-dc31627914f0
2011-03-16 14:07:23 +01:00
Matteo Cypriani 92194b4f50 [Positioning] Fix -f option
git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@102 785a6c6c-259e-4ff1-8b91-dc31627914f0
2011-03-16 14:07:23 +01:00
Matteo Cypriani d619b621ff [Positioning] Revue code Julien
Début de revue du code de Julien sur owlps-positioning :
* Cosmétique.
* owlps-positioning.cc, server.cc : correction/amélioration de la
  gestion des arguments.
* Fichiers de config : suppression de cfg/config.cfg et
  déplacement-renommage de ./owlps-positioning.cfg dans
  cfg/owlps-positioning.conf.
* Makefile : passage de Boost 1.35 à 1.38, l'option
  -lboost_program_options devient -lboost_program_options-mt.

git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@101 785a6c6c-259e-4ff1-8b91-dc31627914f0
2011-03-16 14:07:23 +01:00
Matteo Cypriani e0d3e07e11 [Client] Ajout d'options
client :
* Ajout de l'option -l permettant d'activer ou non l'attente d'une
  réponse après l'envoi d'une demande, et éventuellement de spécifier un
  port alternatif.
* Ajout de l'option -p permettant de spécifier le port d'envoi des
  demandes.

git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@100 785a6c6c-259e-4ff1-8b91-dc31627914f0
2011-03-16 14:07:22 +01:00
Matteo Cypriani bb51f59328 [i-c] Ajouts dans les options et fichier de config
aggregator :
* Ajout de l'option getopt manquante pour le port d'envoi.
* Modification des noms des options getopt (options DB en majuscule).
* Correction et harmonisation des noms des options libconfuse et des
  #define correspondants.
* Correction et complément de l'aide.

listener :
* Ajout d'une option pour le port d'écoute (-l / listening_port).
* Passage des listes d'options en global (nécessaire pour le port
  d'écoute).
* Passage de int à long pour le type du port d'agrégation.

Fichier code/infrastructure-centred/TODO :
* Mise à jour et déplacement des lignes pertinentes dans des TODO
  spécialisés (créés pour l'occasion).

git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@99 785a6c6c-259e-4ff1-8b91-dc31627914f0
2011-03-16 14:07:22 +01:00
Julien Graeffly 15979c6597 [Listener] Modifs spécifiques Fon
Intégration des modifications spécifiques à la Fonera provenant du code
de Julien.
Extrait de son message :
« Je rappelle que le programme contenu dans les FON ne contient pas la
dernière version du listener (celle avec la lib confuse) celà est dû au
fait que cette lib n'était pas installé. »

Grâce aux options préprocesseur définies à la révision précédente, cette
révision devrait pouvoir se cross-compiler (grâce au Makefile_atheros),
si on active l'option PLATFORM_ATHEROS, et fonctionner sur les Fonera.
Pour mémoire, toutes les fonctionnalités devraient pouvoir fonctionner,
puisque des paquets libpthread et confuse existent pour OpenWRT
Kamikaze.

Ajout d'un fichier TODO avec quelques trucs à faire dans la même veine
(compilation croisée et options préprocesseur).

git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@98 785a6c6c-259e-4ff1-8b91-dc31627914f0
2011-03-16 14:07:22 +01:00