Commit 4a2cc076 authored by garciay's avatar garciay
Browse files

Start UpperTester changes

parent 411af05b
......@@ -5,10 +5,10 @@
#include "TTCN3.hh"
// include ASN1C sceleton
#include "asn1/INTEGER.h"
#include "asn1/BOOLEAN.h"
#include "asn1/OCTET_STRING.h"
#include "asn1/BIT_STRING.h"
#include "asn1c/INTEGER.h"
#include "asn1c/BOOLEAN.h"
#include "asn1c/OCTET_STRING.h"
#include "asn1c/BIT_STRING.h"
extern "C" {
int asn1c_collect_encoded_data(const void *buffer, size_t size, void *application_specific_key);
......
......@@ -235,6 +235,26 @@ namespace LibItsGeoNetworking__EncdecDeclarations {
OCTETSTRING os;
codec.encode(p_utGnInitialize, os);
return oct2bit(os);
}
}
BITSTRING fx__enc__UtGnChangePosition (const LibItsGeoNetworking__TypesAndValues::UtGnChangePosition& p_utGnChangePosition)
{
loggers::get_instance().log_msg(">>> fx__enc__UtGnChangePosition: ", p_utGnChangePosition);
UpperTesterCodec codec;
OCTETSTRING os;
codec.encode(p_utGnChangePosition, os);
return oct2bit(os);
}
BITSTRING fx__enc__UtGnTrigger (const LibItsGeoNetworking__TypesAndValues::UtGnTrigger& p_utGnTrigger)
{
loggers::get_instance().log_msg(">>> fx__enc__UtGnTrigger: ", p_utGnTrigger);
UpperTesterCodec codec;
OCTETSTRING os;
codec.encode(p_utGnTrigger, os);
return oct2bit(os);
}
} //end namespace
......@@ -37,6 +37,7 @@ public:
virtual void sendData(OCTETSTRING& data, Params& params) { loggers::get_instance().log("Layer::sendData"); };
virtual void receiveData(OCTETSTRING& data, Params& params) { loggers::get_instance().log("Layer::receiveData"); }
virtual OCTETSTRING trigger_ac_event(OCTETSTRING& data, Params& params) { loggers::get_instance().log("Layer::trigger_ac_event"); return int2oct(0, 2); }
inline const std::string& to_string() const { return type; };
......
......@@ -58,7 +58,7 @@ void UpperTesterPort::user_stop()
}
void UpperTesterPort::outgoing_send(const LibItsCommon__TypesAndValues::UtInitialize& /*send_par*/)
void UpperTesterPort::outgoing_send(const LibItsBtp__TypesAndValues::UtBtpInitialize& /*send_par*/)
{
}
......
......@@ -24,7 +24,7 @@ protected:
void user_start();
void user_stop();
void outgoing_send(const LibItsCommon__TypesAndValues::UtInitialize& send_par);
void outgoing_send(const LibItsBtp__TypesAndValues::UtBtpInitialize& send_par);
void outgoing_send(const LibItsBtp__TypesAndValues::UtBtpTrigger& send_par);
};
......
......@@ -58,7 +58,7 @@ void UpperTesterPort::user_stop()
}
void UpperTesterPort::outgoing_send(const LibItsCommon__TypesAndValues::UtInitialize& /*send_par*/)
void UpperTesterPort::outgoing_send(const LibItsCam__TypesAndValues::UtCamInitialize& /*send_par*/)
{
}
......@@ -68,17 +68,17 @@ void UpperTesterPort::outgoing_send(const LibItsCam__TypesAndValues::UtCamTrigge
}
void UpperTesterPort::outgoing_send(const LibItsCommon__TypesAndValues::UtChangePosition& /*send_par*/)
void UpperTesterPort::outgoing_send(const LibItsCam__TypesAndValues::UtCamChangePosition& /*send_par*/)
{
}
void UpperTesterPort::outgoing_send(const LibItsCommon__TypesAndValues::UtActivatePositionTime& /*send_par*/)
void UpperTesterPort::outgoing_send(const LibItsCam__TypesAndValues::UtActivatePositionTime& /*send_par*/)
{
}
void UpperTesterPort::outgoing_send(const LibItsCommon__TypesAndValues::UtDeactivatePositionTime& /*send_par*/)
void UpperTesterPort::outgoing_send(const LibItsCam__TypesAndValues::UtDeactivatePositionTime& /*send_par*/)
{
}
......
......@@ -24,15 +24,15 @@ protected:
void user_start();
void user_stop();
void outgoing_send(const LibItsCommon__TypesAndValues::UtInitialize& send_par);
void outgoing_send(const LibItsCam__TypesAndValues::UtCamInitialize& send_par);
void outgoing_send(const LibItsCam__TypesAndValues::UtCamTrigger& send_par);
void outgoing_send(const LibItsCommon__TypesAndValues::UtChangePosition& send_par);
void outgoing_send(const LibItsCam__TypesAndValues::UtCamChangePosition& send_par);
void outgoing_send(const LibItsCommon__TypesAndValues::UtActivatePositionTime& send_par);
void outgoing_send(const LibItsCam__TypesAndValues::UtActivatePositionTime& send_par);
void outgoing_send(const LibItsCommon__TypesAndValues::UtDeactivatePositionTime& send_par);
void outgoing_send(const LibItsCam__TypesAndValues::UtDeactivatePositionTime& send_par);
};
......
......@@ -58,7 +58,7 @@ void UpperTesterPort::user_stop()
}
void UpperTesterPort::outgoing_send(const LibItsCommon__TypesAndValues::UtInitialize& /*send_par*/)
void UpperTesterPort::outgoing_send(const LibItsDenm__TypesAndValues::UtDenmInitialize& /*send_par*/)
{
}
......@@ -78,12 +78,12 @@ void UpperTesterPort::outgoing_send(const LibItsDenm__TypesAndValues::UtDenmTerm
}
void UpperTesterPort::outgoing_send(const LibItsCommon__TypesAndValues::UtChangePosition& /*send_par*/)
void UpperTesterPort::outgoing_send(const LibItsDenm__TypesAndValues::UtDenmChangePosition& /*send_par*/)
{
}
void UpperTesterPort::outgoing_send(const LibItsCommon__TypesAndValues::UtChangePseudonym& /*send_par*/)
void UpperTesterPort::outgoing_send(const LibItsDenm__TypesAndValues::UtChangePseudonym& /*send_par*/)
{
}
......
......@@ -24,7 +24,7 @@ protected:
void user_start();
void user_stop();
void outgoing_send(const LibItsCommon__TypesAndValues::UtInitialize& send_par);
void outgoing_send(const LibItsDenm__TypesAndValues::UtDenmInitialize& send_par);
void outgoing_send(const LibItsDenm__TypesAndValues::UtDenmTrigger& send_par);
......@@ -32,9 +32,9 @@ protected:
void outgoing_send(const LibItsDenm__TypesAndValues::UtDenmTermination& send_par);
void outgoing_send(const LibItsCommon__TypesAndValues::UtChangePosition& send_par);
void outgoing_send(const LibItsDenm__TypesAndValues::UtDenmChangePosition& send_par);
void outgoing_send(const LibItsCommon__TypesAndValues::UtChangePseudonym& send_par);
void outgoing_send(const LibItsDenm__TypesAndValues::UtChangePseudonym& send_par);
};
......
#include <TTCN3.hh>
#include "loggers.hh"
#include "registration.hh"
#include "GeoNetworkingLayer.hh"
//=============================================================================
namespace LibItsGeoNetworking__TestSystem {
AdapterControlPort::AdapterControlPort(const char *par_port_name)
: AdapterControlPort_BASE(par_port_name)
{
AdapterControlPort::AdapterControlPort(const char *par_port_name)
: AdapterControlPort_BASE(par_port_name), _params()
{
loggers::get_instance().log("AdapterControlPort::AdapterControlPort");
}
AdapterControlPort::~AdapterControlPort()
{
}
void AdapterControlPort::set_parameter(const char * parameter_name, const char * parameter_value)
{
loggers::get_instance().log("AdapterControlPort::set_parameter: %s=%s", parameter_name, parameter_value);
}
/*void AdapterControlPort::Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error) {}*/
}
void AdapterControlPort::Handle_Fd_Event_Error(int /*fd*/)
{
AdapterControlPort::~AdapterControlPort()
{
}
}
void AdapterControlPort::Handle_Fd_Event_Writable(int /*fd*/)
{
void AdapterControlPort::set_parameter(const char * /*parameter_name*/,
const char * /*parameter_value*/)
{
}
}
void AdapterControlPort::Handle_Fd_Event_Readable(int /*fd*/)
{
/*void AdapterControlPort::Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error) {}*/
}
void AdapterControlPort::Handle_Fd_Event_Error(int /*fd*/)
{
/*void AdapterControlPort::Handle_Timeout(double time_since_last_call) {}*/
}
void AdapterControlPort::user_map(const char * system_port)
{
loggers::get_instance().log(">>> AdapterControlPort::user_map: %s", system_port);
void AdapterControlPort::Handle_Fd_Event_Writable(int /*fd*/)
{
}
}
void AdapterControlPort::user_unmap(const char * system_port)
{
loggers::get_instance().log(">>> AdapterControlPort::user_unmap: %s", system_port);
void AdapterControlPort::Handle_Fd_Event_Readable(int /*fd*/)
{
}
}
void AdapterControlPort::user_start()
{
/*void AdapterControlPort::Handle_Timeout(double time_since_last_call) {}*/
}
void AdapterControlPort::user_map(const char * /*system_port*/)
{
void AdapterControlPort::user_stop()
{
}
}
void AdapterControlPort::user_unmap(const char * /*system_port*/)
{
void AdapterControlPort::outgoing_send(const LibItsGeoNetworking__TypesAndValues::AcGnPrimitive& send_par)
{
loggers::get_instance().log_msg(">>> AdapterControlPort::outgoing_send: ", send_par);
}
// Register this object for AdapterControlPort
GeoNetworkingLayer* p = registration<GeoNetworkingLayer>::get_instance().get_item(std::string("GN"));
if (p != NULL) {
loggers::get_instance().log("AdapterControlPort::outgoing_send: Got layer %p", p);
void AdapterControlPort::user_start()
{
}
void AdapterControlPort::user_stop()
{
// TODO Use AcCodec to encode into ???
/*TTCN_Buffer encoding_buffer;
send_par.encode(*send_par.get_descriptor(), encoding_buffer, TTCN_EncDec::CT_RAW);
loggers::get_instance().log_to_hexa("AdapterControlPort::outgoing_send: ", encoding_buffer);
OCTETSTRING os(encoding_buffer.get_len(), encoding_buffer.get_data());
OCTETSTRING result = p->trigger_ac_event(os, _params);*/
}
void AdapterControlPort::outgoing_send(const LibItsGeoNetworking__TypesAndValues::AcGnPrimitive& /*send_par*/)
{
}
LibItsGeoNetworking__TypesAndValues::AcGnResponse response;
if (send_par.ischosen(LibItsGeoNetworking__TypesAndValues::AcGnPrimitive::ALT_startBeaconing)) {
loggers::get_instance().log("AdapterControlPort::outgoing_send: Start beaconing");
p->start_beaconing();
response.failure() = LibItsGeoNetworking__TypesAndValues::AcGnResponseFailure(BOOLEAN(false));
} else if (send_par.ischosen(LibItsGeoNetworking__TypesAndValues::AcGnPrimitive::ALT_stopBeaconing)) {
loggers::get_instance().log("AdapterControlPort::outgoing_send: Stop beaconing");
p->stop_beaconing();
response.failure() = LibItsGeoNetworking__TypesAndValues::AcGnResponseFailure(BOOLEAN(false));
} else if (send_par.ischosen(LibItsGeoNetworking__TypesAndValues::AcGnPrimitive::ALT_getLongPosVector)) {
loggers::get_instance().log("AdapterControlPort::outgoing_send: Get LongPosVector");
const LibItsGeoNetworking__TypesAndValues::LongPosVector* lpv = p->get_lpv(send_par.getLongPosVector().gnAddress());
loggers::get_instance().log("AdapterControlPort::outgoing_send: Return value: %p", lpv);
if (lpv == nullptr) {
response.failure() = LibItsGeoNetworking__TypesAndValues::AcGnResponseFailure(BOOLEAN(false));
} else {
response.getLongPosVector() = *lpv;
}
} else {
response.failure() = LibItsGeoNetworking__TypesAndValues::AcGnResponseFailure(BOOLEAN(true));
}
// Send response
loggers::get_instance().log_msg("AdapterControlPort::outgoing_send: Send response: ", response);
incoming_message(response);
} else {
loggers::get_instance().error("AdapterControlPort::outgoing_send: %s not registered", "geoNetworkingPort");
}
}
void AdapterControlPort::outgoing_send(const LibItsIpv6OverGeoNetworking__TypesAndValues::AcGn6Primitive& /*send_par*/)
{
void AdapterControlPort::outgoing_send(const LibItsIpv6OverGeoNetworking__TypesAndValues::AcGn6Primitive& /*send_par*/)
{
}
}
void AdapterControlPort::outgoing_send(const LibItsCommon__TypesAndValues::AcGnssPrimitive& /*send_par*/)
{
void AdapterControlPort::outgoing_send(const LibItsCommon__TypesAndValues::AcGnssPrimitive& /*send_par*/)
{
}
}
void AdapterControlPort::outgoing_send(const LibItsCommon__TypesAndValues::AcSecPrimitive& /*send_par*/)
{
void AdapterControlPort::outgoing_send(const LibItsCommon__TypesAndValues::AcSecPrimitive& /*send_par*/)
{
}
}
} /* end of namespace */
//=============================================================================
#include "LibItsGeoNetworking_TestSystem.hh"
#include "Params.hh"
namespace LibItsGeoNetworking__TestSystem {
class AdapterControlPort : public AdapterControlPort_BASE {
Params _params;
public:
AdapterControlPort(const char *par_port_name = NULL);
~AdapterControlPort();
......
......@@ -15,7 +15,7 @@ namespace LibItsGeoNetworking__TestSystem {
GeoNetworkingPort::GeoNetworkingPort(const char *par_port_name)
: GeoNetworkingPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(NULL), _time_key("GeoNetworkingPort::outgoing_send") {
// Nothing to do
// Nothing to do
} // End of constructor
GeoNetworkingPort::~GeoNetworkingPort()
......@@ -59,7 +59,7 @@ namespace LibItsGeoNetworking__TestSystem {
// Build layer stack
Params::iterator it = _cfg_params.find(std::string("params"));
if (it != _cfg_params.end()) {
//loggers::get_instance().log("GeoNetworkingPort::user_map<%d>: %s", _child, it->second.c_str());
//loggers::get_instance().log("GeoNetworkingPort::user_map: %s", it->second.c_str());
// Setup parameters
Params::convert(_layer_params, it->second);
// Create layer
......@@ -68,6 +68,7 @@ namespace LibItsGeoNetworking__TestSystem {
loggers::get_instance().error("GeoNetworkingPort::user_map: Invalid stack configuration: %s", it->second.c_str());
}
static_cast<GeoNetworkingLayer *>(_layer)->addUpperPort(this);
} else {
loggers::get_instance().error("GeoNetworkingPort::user_map: No layers defined in configuration file");
}
......
......@@ -84,18 +84,22 @@ void UpperTesterPort::user_stop()
void UpperTesterPort::outgoing_send(const LibItsGeoNetworking__TypesAndValues::UtGnInitialize& send_par)
{
loggers::get_instance().log_msg(">>> UppertesterPort::outgoing_send: payload=", send_par);
loggers::get_instance().log_msg(">>> UppertesterPort::outgoing_send: ", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
static_cast<UpperTesterLayer *>(_layer)->sendMsg(send_par, _layer_params);
loggers::get_instance().set_stop_time(_time_key, duration);
}
void UpperTesterPort::outgoing_send(const LibItsCommon__TypesAndValues::UtChangePosition& /*send_par*/)
void UpperTesterPort::outgoing_send(const LibItsGeoNetworking__TypesAndValues::UtGnChangePosition& send_par)
{
loggers::get_instance().log_msg(">>> UppertesterPort::outgoing_send: ", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
static_cast<UpperTesterLayer *>(_layer)->sendMsg(send_par, _layer_params);
loggers::get_instance().set_stop_time(_time_key, duration);
}
void UpperTesterPort::outgoing_send(const LibItsGeoNetworking__TypesAndValues::UtGnTrigger& /*send_par*/)
......
......@@ -3,8 +3,6 @@
//=============================================================================
#include "LibItsGeoNetworking_TestSystem.hh"
#include "LibItsGeoNetworking_TypesAndValues.hh"
namespace LibItsGeoNetworking__TestSystem {
class UpperTesterPort : public UpperTesterPort_BASE {
......@@ -38,7 +36,7 @@ protected:
void outgoing_send(const LibItsGeoNetworking__TypesAndValues::UtGnInitialize& send_par);
void outgoing_send(const LibItsCommon__TypesAndValues::UtChangePosition& send_par);
void outgoing_send(const LibItsGeoNetworking__TypesAndValues::UtGnChangePosition& send_par);
void outgoing_send(const LibItsGeoNetworking__TypesAndValues::UtGnTrigger& send_par);
......
......@@ -7,6 +7,7 @@
#include "GeoNetworkingLayer.hh"
#include "GeoNetworkingTypes.hh"
#include "registration.hh"
#include "loggers.hh"
using namespace LibItsGeoNetworking__TypesAndValues;
......@@ -37,6 +38,10 @@ GeoNetworkingLayer::GeoNetworkingLayer(const std::string & p_type, const std::st
if (it == _params.cend()) {
_params.insert(std::pair<std::string, std::string>(std::string("mac_bc"), "FFFFFFFFFFFF"));
}
// Register this object for AdapterControlPort
loggers::get_instance().log("GeoNetworkingLayer::GeoNetworkingLayer: register %s/%p", p_type.c_str(), this);
registration<GeoNetworkingLayer>::get_instance().add_item(p_type, this);
// Prepare beaconing operation
fill_beacon(latitude, longitude, ll_address);
Params::const_iterator i = _params.find(Params::beaconing);
......@@ -167,6 +172,14 @@ void GeoNetworkingLayer::receiveData(OCTETSTRING& data, Params& params) {
toAllUpperPorts(ind, params);
}
OCTETSTRING GeoNetworkingLayer::trigger_ac_event(OCTETSTRING& data, Params& params)
{
loggers::get_instance().log_to_hexa(">>> GeoNetworkingLayer::trigger_ac_event: ", data);
return int2oct(0, 2);
} // End of trigger_ac_event method
void GeoNetworkingLayer::start_beaconing() {
loggers::get_instance().log(">>> GeoNetworkingLayer::start_beaconing");
......@@ -212,7 +225,7 @@ void GeoNetworkingLayer::start_beaconing() {
if (sigprocmask(SIG_UNBLOCK, &_mask, NULL) == -1) {
loggers::get_instance().error("GeoNetworkingLayer::start_beaconing: Sigprocmask failure: %d", errno);
}
}
} // End of start_beacon method
void GeoNetworkingLayer::stop_beaconing() {
loggers::get_instance().log(">>> GeoNetworkingLayer::stop_beaconing");
......@@ -226,7 +239,7 @@ void GeoNetworkingLayer::stop_beaconing() {
}
timer_delete(_timerid);
_timerid = 0;
}
} // End of stop_beacon method
void GeoNetworkingLayer::send_beacon() {
loggers::get_instance().log(">>> GeoNetworkingLayer::send_beacon");
......@@ -250,6 +263,17 @@ void GeoNetworkingLayer::send_beacon() {
//loggers::get_instance().log("<<< GeoNetworkingLayer::send_beacon");
} // End of send_beacon method
const LongPosVector* GeoNetworkingLayer::get_lpv(const GN__Address& p_gn_address)
{
loggers::get_instance().log_msg(">>> GeoNetworkingLayer::get_lpv", p_gn_address);
const LongPosVector* lpv = nullptr;
if (_location_table.has_entry(p_gn_address.mid())) {
lpv = _location_table.get_entry(p_gn_address.mid());
}
return lpv;
} // End of get_lpv
void GeoNetworkingLayer::fill_beacon(INTEGER& p_latitude, INTEGER& p_longitude, OCTETSTRING& p_ll_address)
{
_beacon = new GeoNetworkingPdu();
......@@ -310,8 +334,7 @@ void GeoNetworkingLayer::fill_beacon(INTEGER& p_latitude, INTEGER& p_longitude,
_beacon->gnPacket().packet().payload().set_to_omit();
_beacon->gnPacket().securedMsg().set_to_omit();
// loggers::get_instance().log_msg("GeoNetworkingLayer::GeoNetworkingLayer: beacon value: ", *p._beacon);
}
} // End of fill_beacon method
void GeoNetworkingLayer::timer_irq_sigalrm_handler(int p_signal, siginfo_t *p_signal_info, void *p_uc) {
//loggers::get_instance().log(">>> GeoNetworkingLayer::timer_irq_sigalrm_handler: Caught signal %d", p_signal);
......
......@@ -19,6 +19,8 @@ namespace LibItsGeoNetworking__TestSystem {
namespace LibItsGeoNetworking__TypesAndValues {
class GeoNetworkingPdu;
class LongPosVector;
class GN__Address;
}
class GeoNetworkingLayer : public TLayer<LibItsGeoNetworking__TestSystem::GeoNetworkingPort> {
......@@ -35,7 +37,9 @@ class GeoNetworkingLayer : public TLayer<LibItsGeoNetworking__TestSystem::GeoNet
struct sigaction _sa;
void fill_beacon(INTEGER& p_latitude, INTEGER& p_longitude, OCTETSTRING& p_ll_address);
static void timer_irq_sigalrm_handler(int p_signal, siginfo_t *p_signal_info, void *p_uc);
static void timer_irq_sigalrm_handler(int p_signal, siginfo_t *p_signal_info, void *p_uc);
const int _signal_id = SIGTERM;
public:
GeoNetworkingLayer() : TLayer<LibItsGeoNetworking__TestSystem::GeoNetworkingPort>(), _params(), _codec(), _beacon(NULL), _sendData(), _timerid{0}, _sev{0}, _its{0}, _freq_nanosecs(0), _mask{0}, _sa{0} { };
......@@ -46,11 +50,13 @@ public:
virtual void sendData(OCTETSTRING& data, Params& params);
virtual void receiveData(OCTETSTRING& data, Params& params);
virtual OCTETSTRING trigger_ac_event(OCTETSTRING& data, Params& params);
void start_beaconing();
void stop_beaconing();
void send_beacon();
const int _signal_id = SIGTERM;
const LibItsGeoNetworking__TypesAndValues::LongPosVector* get_lpv(const LibItsGeoNetworking__TypesAndValues::GN__Address& p_gn_address);
};
#endif
......@@ -6,13 +6,29 @@
using namespace LibItsGeoNetworking__TypesAndValues;
bool compare_octetstring::operator()(const OCTETSTRING& p_os1, const OCTETSTRING& p_os2) const
{
if (p_os1.lengthof() > p_os2.lengthof()) {
return false;
} else if (p_os1.lengthof() < p_os2.lengthof()) {
return true;
} else {
for (int i = 0; i < p_os1.lengthof(); i++) {
if (p_os1[i].get_octet() < p_os2[i].get_octet()) {
return true;
}
}
}
return false;
}
void LocationTable::add_entry(const LibItsGeoNetworking__TypesAndValues::LongPosVector& p_long_pos_vector) {
loggers::get_instance().log_msg(">>> LocationTable::add_entry:", p_long_pos_vector);
std::map<OCTETSTRING, std::shared_ptr<LibItsGeoNetworking__TypesAndValues::LongPosVector>>::const_iterator it = _entries_by_mids.find(p_long_pos_vector.gnAddr().mid());
if (it == _entries_by_mids.cend()) { // Not found
// Add it
loggers::get_instance().log("LocationTable::add_entry: Create new entry");
loggers::get_instance().log_to_hexa("LocationTable::add_entry: Create new entry: ", p_long_pos_vector.gnAddr().mid());
std::shared_ptr<LibItsGeoNetworking__TypesAndValues::LongPosVector> lpv(new LibItsGeoNetworking__TypesAndValues::LongPosVector(p_long_pos_vector));
_entries_by_mids.insert(std::pair<OCTETSTRING, std::shared_ptr<LibItsGeoNetworking__TypesAndValues::LongPosVector>>(p_long_pos_vector.gnAddr().mid(), lpv));
_entries_by_times.insert(std::pair<unsigned long, std::shared_ptr<LibItsGeoNetworking__TypesAndValues::LongPosVector>>(static_cast<unsigned long>(p_long_pos_vector.timestamp__().get_long_long_val()), lpv));
......@@ -21,14 +37,26 @@ void LocationTable::add_entry(const LibItsGeoNetworking__TypesAndValues::LongPos
}
} // End of add_entry method
const bool LocationTable::has_entry(const OCTETSTRING& p_mid) const
{
loggers::get_instance().log_to_hexa(">>> LocationTable::has_entry: ", p_mid);
std::map<OCTETSTRING, std::shared_ptr<LibItsGeoNetworking__TypesAndValues::LongPosVector>>::const_iterator it = _entries_by_mids.find(p_mid);
return (it != _entries_by_mids.cend());
}
const LibItsGeoNetworking__TypesAndValues::LongPosVector* LocationTable::get_entry(const OCTETSTRING & p_mid) const {
loggers::get_instance().log_to_hexa("LocationTable::get_entry: ", p_mid);
// Sanity check
if (_entries_by_times.empty() || (p_mid.lengthof() != 8)) {
if (_entries_by_times.empty() || (p_mid.lengthof() != 6)) {
loggers::get_instance().warning("LocationTable::get_entry: Wrong parameters");