[Positioning] TCPEvAAL: send area of interest
The areas of interest must be defined as areas in the topology configuration file. Their names must be integer values, to conform with the EvAAL naming.
This commit is contained in:
parent
a951717433
commit
593da5e422
|
@ -1,10 +1,13 @@
|
||||||
#include "outputtcpsocketevaal.hh"
|
#include "outputtcpsocketevaal.hh"
|
||||||
#include "request.hh"
|
#include "request.hh"
|
||||||
#include "resultlist.hh"
|
#include "resultlist.hh"
|
||||||
|
#include "area.hh"
|
||||||
|
#include "stock.hh"
|
||||||
#include "posexcept.hh"
|
#include "posexcept.hh"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <cstdio> // For perror()
|
#include <cstdio> // For perror()
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
|
@ -91,11 +94,22 @@ bool OutputTCPSocketEvAAL::close_socket()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param results Must contain only one element, since the EvAAL format
|
||||||
|
* accepts only one algorithm result.
|
||||||
|
*/
|
||||||
|
void OutputTCPSocketEvAAL::write(const ResultList &results)
|
||||||
|
{
|
||||||
|
assert(results.get_results().size() == 1) ;
|
||||||
|
write(results.get_results()[0]) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void OutputTCPSocketEvAAL::write(const Result &result)
|
void OutputTCPSocketEvAAL::write(const Result &result)
|
||||||
{
|
{
|
||||||
const Point3D &position = result.get_position() ;
|
const Point3D &position = result.get_position() ;
|
||||||
Timestamp request_time = result.get_request()->get_time_sent() ;
|
Timestamp request_time = result.get_request()->get_time_sent() ;
|
||||||
int area_of_interest = 0 ; // FIXME
|
int area_of_interest = area_of_interest_number(position) ;
|
||||||
|
|
||||||
ostringstream str ;
|
ostringstream str ;
|
||||||
str
|
str
|
||||||
|
@ -110,14 +124,27 @@ void OutputTCPSocketEvAAL::write(const Result &result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
int OutputTCPSocketEvAAL::
|
||||||
* @param results Must contain only one element, since the EvAAL format
|
area_of_interest_number(const Point3D &position) const
|
||||||
* accepts only one algorithm result.
|
|
||||||
*/
|
|
||||||
void OutputTCPSocketEvAAL::write(const ResultList &results)
|
|
||||||
{
|
{
|
||||||
assert(results.get_results().size() == 1) ;
|
const Area *area = Stock::in_which_area_is(position) ;
|
||||||
write(results.get_results()[0]) ;
|
if (area == NULL)
|
||||||
|
return 0 ;
|
||||||
|
|
||||||
|
int aoi_number = 0 ;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
aoi_number = boost::lexical_cast<int>(area->get_name()) ;
|
||||||
|
}
|
||||||
|
catch (boost::bad_lexical_cast &e)
|
||||||
|
{
|
||||||
|
cerr
|
||||||
|
<< "Cannot convert the area of interest's name (« "
|
||||||
|
<< area->get_name() << " ») into an integer value: "
|
||||||
|
<< e.what() << '\n' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return aoi_number ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef _OWLPS_POSITIONING_OUTPUTTCPSOCKETEVAAL_HH_
|
#ifndef _OWLPS_POSITIONING_OUTPUTTCPSOCKETEVAAL_HH_
|
||||||
#define _OWLPS_POSITIONING_OUTPUTTCPSOCKETEVAAL_HH_
|
#define _OWLPS_POSITIONING_OUTPUTTCPSOCKETEVAAL_HH_
|
||||||
|
|
||||||
|
class Point3D ;
|
||||||
|
|
||||||
#include "outputmedium.hh"
|
#include "outputmedium.hh"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -39,8 +41,10 @@ public:
|
||||||
|
|
||||||
/** @name Operations */
|
/** @name Operations */
|
||||||
//@{
|
//@{
|
||||||
void write(const Result &result) ;
|
|
||||||
void write(const ResultList &results) ;
|
void write(const ResultList &results) ;
|
||||||
|
void write(const Result &result) ;
|
||||||
|
/// Get the area of interest number from the position
|
||||||
|
int area_of_interest_number(const Point3D &position) const ;
|
||||||
/// Closes the socket
|
/// Closes the socket
|
||||||
bool close_socket(void) ;
|
bool close_socket(void) ;
|
||||||
//@}
|
//@}
|
||||||
|
|
Loading…
Reference in New Issue