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
|
|
|
*/
|
|
|
|
|
|
|
|
|
2010-01-07 16:34:31 +01:00
|
|
|
#ifndef _OWLPS_POSITIONING_INPUTMEDIUM_HH_
|
|
|
|
#define _OWLPS_POSITIONING_INPUTMEDIUM_HH_
|
|
|
|
|
2011-04-26 16:42:35 +02:00
|
|
|
class ReferencePoint ;
|
|
|
|
class Direction ;
|
|
|
|
|
2010-01-11 19:40:45 +01:00
|
|
|
#include "request.hh"
|
2010-01-07 16:34:31 +01:00
|
|
|
|
2011-08-01 12:28:33 +02:00
|
|
|
#include <string>
|
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
/// Super class of all input media
|
|
|
|
/**
|
2011-06-20 12:11:20 +02:00
|
|
|
* This class Provides an interface for input media, i.e. to read
|
|
|
|
* Request sent by a Mobile.
|
2010-01-16 12:23:07 +01:00
|
|
|
*/
|
2010-01-07 16:34:31 +01:00
|
|
|
class InputMedium
|
|
|
|
{
|
|
|
|
protected:
|
2010-02-16 20:00:14 +01:00
|
|
|
Request *current_request ;
|
2010-01-16 12:23:07 +01:00
|
|
|
/// Number of the current line proceeded
|
2010-02-02 19:37:37 +01:00
|
|
|
unsigned long current_line_nb ;
|
2010-01-07 16:34:31 +01:00
|
|
|
|
2011-08-01 12:03:41 +02:00
|
|
|
/** @name Operations */
|
|
|
|
//@{
|
|
|
|
/// Reads data & fills the current request
|
|
|
|
virtual bool fill_current_request(void) = 0 ;
|
2013-06-04 00:39:10 +02:00
|
|
|
/// Checks if the current request is a calibration request and, if so,
|
|
|
|
/// fills it with additionnal data
|
2011-08-01 12:28:33 +02:00
|
|
|
void fill_calibration_request_data(const std::string &mac_mobile,
|
|
|
|
Point3D &position,
|
|
|
|
const Direction &direction,
|
2013-10-02 20:38:45 +02:00
|
|
|
const uint8_t type) ;
|
2011-08-01 12:03:41 +02:00
|
|
|
//@}
|
|
|
|
|
2010-01-07 16:34:31 +01:00
|
|
|
public:
|
2010-01-16 12:23:07 +01:00
|
|
|
InputMedium(void) ;
|
2010-01-07 16:34:31 +01:00
|
|
|
|
2010-02-16 20:00:14 +01:00
|
|
|
virtual ~InputMedium(void) ;
|
2010-01-16 12:23:07 +01:00
|
|
|
|
|
|
|
/** @name Read accessors */
|
|
|
|
//@{
|
|
|
|
|
2010-01-11 19:40:45 +01:00
|
|
|
const Request& get_current_request(void) const ;
|
2010-01-16 12:23:07 +01:00
|
|
|
|
2010-02-02 19:37:37 +01:00
|
|
|
unsigned int get_current_line_nb(void) const ;
|
2010-01-07 16:34:31 +01:00
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
/// Checks if the last request has been reached
|
|
|
|
/**
|
2013-05-30 21:23:05 +02:00
|
|
|
* @returns `true` if the last request has been reached.
|
|
|
|
* @returns `false` if there is something more to read.
|
2010-01-07 16:34:31 +01:00
|
|
|
*/
|
2010-01-16 12:23:07 +01:00
|
|
|
virtual bool eof(void) const = 0 ;
|
2010-01-07 16:34:31 +01:00
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
//@} // End Read accessors
|
|
|
|
|
|
|
|
/** @name Operations */
|
|
|
|
//@{
|
|
|
|
|
|
|
|
/// Reads the next request
|
2011-08-01 12:03:41 +02:00
|
|
|
const Request& get_next_request(void) ;
|
2010-01-16 12:23:07 +01:00
|
|
|
|
2010-02-17 17:33:26 +01:00
|
|
|
/// Converts #current_request into a CalibrationRequest
|
2011-03-31 17:08:24 +02:00
|
|
|
void current_request_to_calibration_request(
|
2011-04-26 16:42:35 +02:00
|
|
|
const ReferencePoint *const reference_point,
|
|
|
|
const Direction &direction,
|
2013-10-02 20:38:45 +02:00
|
|
|
const uint_fast8_t request_type) ;
|
2010-02-17 17:33:26 +01:00
|
|
|
/// Clears (reallocates to Request if needed) #current_request
|
|
|
|
void clear_current_request(void) ;
|
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
//@} // End Operations
|
2010-01-07 16:34:31 +01:00
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
/* *** Read accessors *** */
|
2010-01-07 16:34:31 +01:00
|
|
|
|
|
|
|
|
2010-01-11 19:40:45 +01:00
|
|
|
inline const Request& InputMedium::get_current_request() const
|
2010-01-07 16:34:31 +01:00
|
|
|
{
|
2010-02-16 20:00:14 +01:00
|
|
|
return *current_request ;
|
2010-01-07 16:34:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-02 19:37:37 +01:00
|
|
|
inline unsigned int InputMedium::get_current_line_nb() const
|
2010-01-07 16:34:31 +01:00
|
|
|
{
|
2010-02-02 19:37:37 +01:00
|
|
|
return current_line_nb ;
|
2010-01-07 16:34:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _OWLPS_POSITIONING_INPUTMEDIUM_HH_
|