Commit 633a23d0 authored by garciay's avatar garciay
Browse files

Add work-around for PKI AdanpterControlPort and UpperTesterPort due to...

Add work-around for PKI AdanpterControlPort and UpperTesterPort due to incomplete _BASE class declaration
parent 23f49acb
......@@ -9,7 +9,7 @@
#include "IVIM_ports/AdapterControlPort_IVIM.partC"
#include "MapemSpatem_ports/AdapterControlPort_MapemSpatem.partC"
#include "SremSsem_ports/AdapterControlPort_SremSsem.partC"
#include "Pki_ports/AdapterControlPort_Pki.partC"
//#include "Pki_ports/AdapterControlPort_Pki.partC"
//#include "V2G_ports/AdapterControlPort_V2G.partC"
#else //_NO_SOFTLINKS_
......@@ -20,7 +20,7 @@
#include "AdapterControlPort_MapemSpatem.partC"
#include "AdapterControlPort_SremSsem.partC"
#include "AdapterControlPort_GN.partC"
#include "AdapterControlPort_Pki.partC"
//#include "AdapterControlPort_Pki.partC"
/*
#include "AdapterControlPort_IVIM.partC"
#include "AdapterControlPort_MapemSpatem.partC"
......
......@@ -6,24 +6,24 @@
#ifdef _NO_SOFTLINKS_
/* to be used when built without generating softlinks to the working directory */
//#include "CALM_ports/AdapterControlPort_CALM.partH"
#include "Pki_ports/AdapterControlPort_Pki.partH"
#include "CAM_ports/AdapterControlPort_CAM.partH"
#include "DENM_ports/AdapterControlPort_DENM.partH"
#include "GN_ports/AdapterControlPort_GN.partH"
#include "IVIM_ports/AdapterControlPort_IVIM.partH"
#include "MapemSpatem_ports/AdapterControlPort_MapemSpatem.partH"
#include "SremSsem_ports/AdapterControlPort_SremSsem.partH"
//#include "Pki_ports/AdapterControlPort_Pki.partH"
//#include "V2G_ports/AdapterControlPort_V2G.partH"
#else //_NO_SOFTLINKS_
#include "AdapterControlPort_Pki.partH"
#include "AdapterControlPort_CAM.partH"
#include "AdapterControlPort_DENM.partH"
#include "AdapterControlPort_IVIM.partH"
#include "AdapterControlPort_MapemSpatem.partH"
#include "AdapterControlPort_SremSsem.partH"
#include "AdapterControlPort_GN.partH"
//#include "AdapterControlPort_Pki.partH"
/*
#include "AdapterControlPort_IVIM.partH"
#include "AdapterControlPort_MapemSpatem.partH"
......
#include <TTCN3.hh>
#include "LibItsPki_TestSystem.hh"
#include "loggers.hh"
#include "registration.hh"
#include "pki_layer.hh"
//=============================================================================
namespace LibItsPki__TestSystem {
AdapterControlPkiPort::AdapterControlPkiPort(const char *par_port_name)
: AdapterControlPkiPort_BASE(par_port_name), _params()
{
loggers::get_instance().log("AdapterControlPkiPort::AdapterControlPkiPort");
}
AdapterControlPkiPort::~AdapterControlPkiPort()
{
}
void AdapterControlPkiPort::set_parameter(const char * parameter_name, const char * parameter_value)
{
loggers::get_instance().log("AdapterControlPkiPort::set_parameter: %s=%s", parameter_name, parameter_value);
}
/*void AdapterControlPkiPort::Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error) {}*/
void AdapterControlPkiPort::Handle_Fd_Event_Error(int /*fd*/)
{
}
void AdapterControlPkiPort::Handle_Fd_Event_Writable(int /*fd*/)
{
}
void AdapterControlPkiPort::Handle_Fd_Event_Readable(int /*fd*/)
{
}
/*void AdapterControlPkiPort::Handle_Timeout(double time_since_last_call) {}*/
void AdapterControlPkiPort::user_map(const char * system_port)
{
loggers::get_instance().log(">>> AdapterControlPkiPort::user_map: %s", system_port);
}
void AdapterControlPkiPort::user_unmap(const char * system_port)
{
loggers::get_instance().log(">>> AdapterControlPkiPort::user_unmap: %s", system_port);
}
void AdapterControlPkiPort::user_start()
{
}
void AdapterControlPkiPort::user_stop()
{
}
void AdapterControlPkiPort::outgoing_send(const LibItsPki__TypesAndValues::AcPkiPrimitive& send_par)
{
loggers::get_instance().log_msg(">>> AdapterControlPkiPort::outgoing_send: ", send_par);
// Register this object for AdapterControlPkiPort
pki_layer* p = registration<pki_layer>::get_instance().get_item(std::string("PKI"));
if (p != NULL) {
loggers::get_instance().log("AdapterControlPkiPort::outgoing_send: Got PKI layer %p", p);
LibItsPki__TypesAndValues::AcPkiResponse response;
response.result() = BOOLEAN(false);
if (send_par.ischosen(LibItsPki__TypesAndValues::AcPkiPrimitive::ALT_acSetSecurityData)) {
loggers::get_instance().log("AdapterControlPkiPort::outgoing_send: AcSetSecurityData");
p->set_pki_keys(send_par.acSetSecurityData());
response.result() = BOOLEAN(true);
}
// Send response
loggers::get_instance().log_msg("AdapterControlPkiPort::outgoing_send: Send response: ", response);
incoming_message(response);
} else {
loggers::get_instance().error("AdapterControlPkiPort::outgoing_send: pkiPort not registered");
}
}
} /* end of namespace */
//=============================================================================
#include "LibItsPki_TestSystem.hh"
#include "params.hh"
namespace LibItsPki__TypesAndValues {
class AcPkiPrimitive;
}
namespace LibItsPki__TestSystem {
class AdapterControlPkiPort : public AdapterControlPkiPort_BASE {
params _params;
public:
AdapterControlPkiPort(const char *par_port_name = NULL);
~AdapterControlPkiPort();
void set_parameter(const char *parameter_name,
const char *parameter_value);
private:
/* void Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error); */
void Handle_Fd_Event_Error(int fd);
void Handle_Fd_Event_Writable(int fd);
void Handle_Fd_Event_Readable(int fd);
/* void Handle_Timeout(double time_since_last_call); */
protected:
void user_map(const char *system_port);
void user_unmap(const char *system_port);
void user_start();
void user_stop();
void outgoing_send(const LibItsPki__TypesAndValues::AcPkiPrimitive& send_par);
};
} /* end of namespace */
#include <TTCN3.hh>
#include "LibItsPki_TestSystem.hh"
#include "loggers.hh"
#include "uppertester_pki_layer_factory.hh"
#include "uppertester_pki_layer.hh"
//=============================================================================
namespace LibItsPki__TestSystem {
UpperTesterPkiPort::UpperTesterPkiPort(const char *par_port_name)
: UpperTesterPkiPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(NULL), _time_key("UpperTesterPkiPort_Pki::outgoing_send")
{
loggers::get_instance().log("UpperTesterPkiPort_Pki::UpperTesterPkiPort_Pki");
}
UpperTesterPkiPort::~UpperTesterPkiPort()
{
if (_layer != NULL) {
delete _layer;
}
}
void UpperTesterPkiPort::set_parameter(const char * parameter_name, const char * parameter_value)
{
loggers::get_instance().log("UpperTesterPkiPort_Pki::set_parameter: %s=%s", parameter_name, parameter_value);
_cfg_params.insert(std::pair<std::string, std::string>(std::string(parameter_name), std::string(parameter_value)));
_cfg_params.log();
}
/*void UpperTesterPkiPort::Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error) {}*/
void UpperTesterPkiPort::Handle_Fd_Event_Error(int /*fd*/)
{
}
void UpperTesterPkiPort::Handle_Fd_Event_Writable(int /*fd*/)
{
}
void UpperTesterPkiPort::Handle_Fd_Event_Readable(int /*fd*/)
{
}
/*void UpperTesterPkiPort::Handle_Timeout(double time_since_last_call) {}*/
void UpperTesterPkiPort::user_map(const char * system_port)
{
loggers::get_instance().log(">>> UpperTesterPkiPort_Pki::user_map: %s", system_port);
// Build layer stack
params::iterator it = _cfg_params.find(std::string("params"));
if (it != _cfg_params.end()) {
loggers::get_instance().log("UpperTesterPkiPort_Pki::user_map: %s", it->second.c_str());
_layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str());
if (static_cast<uppertester_pki_layer *>(_layer) == NULL) {
loggers::get_instance().error("UpperTesterPkiPort_Pki::user_map: Invalid stack configuration: %s", it->second.c_str());
}
static_cast<uppertester_pki_layer *>(_layer)->add_upper_port(this);
} else {
loggers::get_instance().error("UpperTesterPkiPort_Pki::user_map: No layers defined in configuration file");
}
}
void UpperTesterPkiPort::user_unmap(const char * system_port)
{
loggers::get_instance().log(">>> UpperTesterPkiPort_Pki::user_unmap: %s", system_port);
if (_layer != NULL) {
delete _layer;
_layer = NULL;
}
}
void UpperTesterPkiPort::user_start()
{
}
void UpperTesterPkiPort::user_stop()
{
}
void UpperTesterPkiPort::outgoing_send(const LibItsPki__TypesAndValues::UtPkiInitialize& send_par)
{
loggers::get_instance().log_msg(">>> UppertesterPort::outgoing_send: ", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
static_cast<uppertester_pki_layer *>(_layer)->sendMsg(send_par, _layer_params);
loggers::get_instance().set_stop_time(_time_key, duration);
}
void UpperTesterPkiPort::outgoing_send(const LibItsPki__TypesAndValues::UtPkiTrigger& send_par)
{
loggers::get_instance().log_msg(">>> UppertesterPort::outgoing_send: ", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
static_cast<uppertester_pki_layer *>(_layer)->sendMsg(send_par, _layer_params);
loggers::get_instance().set_stop_time(_time_key, duration);
}
void UpperTesterPkiPort::receiveMsg (const Base_Type& p_ind, const params& p_params) {
loggers::get_instance().log_msg(">>> UpperTesterPkiPort_Pki::receive_msg: ", p_ind);
// Sanity check
if (!p_ind.is_bound()) {
return;
}
if (std::string(p_ind.get_descriptor()->name).compare("@LibItsPki_TypesAndValues.UtPkiResults") == 0) { // TODO To be refined
incoming_message(static_cast<const LibItsPki__TypesAndValues::UtPkiResults&>(p_ind));
} else {
loggers::get_instance().warning("UpperTesterPkiPort_Pki::receive_msg: Message not processed: %s", p_ind.get_descriptor()->name);
}
}
} /* end of namespace */
//=============================================================================
#include "LibItsPki_TestSystem.hh"
#include "layer.hh"
#include "params.hh"
namespace LibItsPki__TestSystem {
class UpperTesterPkiPort : public UpperTesterPkiPort_BASE {
params _cfg_params;
params _layer_params;
layer* _layer;
std::string _time_key;
public:
UpperTesterPkiPort(const char *par_port_name = NULL);
~UpperTesterPkiPort();
void set_parameter(const char *parameter_name,
const char *parameter_value);
void receiveMsg (const Base_Type&, const params&);
private:
/* void Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error); */
void Handle_Fd_Event_Error(int fd);
void Handle_Fd_Event_Writable(int fd);
void Handle_Fd_Event_Readable(int fd);
/* void Handle_Timeout(double time_since_last_call); */
protected:
void user_map(const char *system_port);
void user_unmap(const char *system_port);
void user_start();
void user_stop();
void outgoing_send(const LibItsPki__TypesAndValues::UtPkiInitialize& send_par);
void outgoing_send(const LibItsPki__TypesAndValues::UtPkiTrigger& send_par);
};
} /* end of namespace */
......@@ -95,6 +95,25 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmRe
send_data(os, _params);
}
void ConfigRsuSimulatorLayer::sendMsg(const LibItsPki__TypesAndValues::UtPkiResults& send_par, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par);
TTCN_Buffer encoding_buffer;
if (send_par.ischosen(LibItsPki__TypesAndValues::UtPkiResults::ALT_utPkiInitializeResult)) {
encoding_buffer.put_c(0x01/*static_cast<const unsigned char>(uppertester_pki_codec::c_utPkiInitializeResult)*/);
encoding_buffer.put_c((unsigned char)static_cast<const boolean>(send_par.utPkiInitializeResult()));
} else if (send_par.ischosen(LibItsPki__TypesAndValues::UtPkiResults::ALT_utPkiTriggerResult)) {
encoding_buffer.put_c(0x11/*static_cast<const unsigned char>(uppertester_pki_codec::c_utPkiTriggerResult)*/);
encoding_buffer.put_c((unsigned char)static_cast<const boolean>(send_par.utPkiTriggerResult()));
} else {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtPkiResults variant");
return;
}
OCTETSTRING os(encoding_buffer.get_len(), encoding_buffer.get_data());
send_data(os, _params);
}
void ConfigRsuSimulatorLayer::send_data(OCTETSTRING& data, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::send_data: ", data);
......
......@@ -15,6 +15,7 @@
#include "uppertester_geonetworking_codec.hh"
#include "uppertester_cam_codec.hh"
#include "uppertester_denm_codec.hh"
#include "uppertester_pki_codec.hh"
namespace ItsRSUsSimulator__TestSystem {
class ConfigRsuSimulatorPort;
......@@ -36,6 +37,7 @@ public:
void sendMsg(const LibItsCam__TypesAndValues::UtCamResults& send_par, params& params);
void sendMsg(const LibItsCam__TypesAndValues::UtCamEventInd& send_par, params& params);
void sendMsg(const LibItsDenm__TypesAndValues::UtDenmResults& send_par, params& params);
void sendMsg(const LibItsPki__TypesAndValues::UtPkiResults& send_par, params& params);
virtual void send_data(OCTETSTRING& data, params& params);
virtual void receive_data(OCTETSTRING& data, params& params);
......
......@@ -142,6 +142,15 @@ namespace ItsRSUsSimulator__TestSystem {
loggers::get_instance().set_stop_time(_time_key, duration);
}
void ConfigRsuSimulatorPort::outgoing_send(const LibItsPki__TypesAndValues::UtPkiResults& send_par) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::outgoing_send: payload=", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
static_cast<ConfigRsuSimulatorLayer *>(_layer)->sendMsg(send_par, _layer_params);
loggers::get_instance().set_stop_time(_time_key, duration);
}
void ConfigRsuSimulatorPort::receiveMsg (const BOOLEAN& p_ind, const params& p_params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::receive_msg: ", p_ind);
// Sanity check
......@@ -202,5 +211,15 @@ namespace ItsRSUsSimulator__TestSystem {
incoming_message(p_ind);
}
void ConfigRsuSimulatorPort::receiveMsg (const LibItsPki__TypesAndValues::UtPkiTrigger& p_ind, const params& p_params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::receive_msg: ", p_ind);
// Sanity check
if (!p_ind.is_bound()) {
return;
}
incoming_message(p_ind);
}
} /* end of namespace */
......@@ -24,6 +24,8 @@ namespace ItsRSUsSimulator__TestSystem {
void receiveMsg (const LibItsCam__TypesAndValues::UtCamInitialize& p_ind, const params& p_params);
void receiveMsg (const LibItsCam__TypesAndValues::UtCamTrigger& p_ind, const params& p_params);
void receiveMsg (const LibItsDenm__TypesAndValues::UtDenmInitialize& p_ind, const params& p_params);
void receiveMsg (const LibItsPki__TypesAndValues::UtPkiInitialize& p_ind, const params& p_params);
void receiveMsg (const LibItsPki__TypesAndValues::UtPkiTrigger& p_ind, const params& p_params);
/*void send(const CfInitialize& send_par, const COMPONENT& destination_component);
void send(const CfInitialize& send_par);
......@@ -59,6 +61,7 @@ namespace ItsRSUsSimulator__TestSystem {
void outgoing_send(const LibItsCam__TypesAndValues::UtCamResults& send_par);
void outgoing_send(const LibItsCam__TypesAndValues::UtCamEventInd& send_par);
void outgoing_send(const LibItsDenm__TypesAndValues::UtDenmResults& send_par);
void outgoing_send(const LibItsPki__TypesAndValues::UtPkiResults& send_par);
}; // End of class ConfigRsuSimulatorPort
}
......@@ -9,7 +9,7 @@
#include "IVIM_ports/UpperTesterPort_IVIM.partC"
#include "MapemSpatem_ports/UpperTesterPort_MapemSpatem.partC"
#include "SremSsem_ports/UpperTesterPort_SremSsem.partC"
#include "Pki_ports/UpperTesterPort_Pki.partC"
//#include "Pki_ports/UpperTesterPort_Pki.partC"
//#include "V2G_ports/UpperTesterPort_V2G.partC"
#else //_NO_SOFTLINKS_
......@@ -21,7 +21,7 @@
#include "UpperTesterPort_MapemSpatem.partC"
#include "UpperTesterPort_SremSsem.partC"
#include "UpperTesterPort_GN.partC"
#include "UpperTesterPort_Pki.partC"
//#include "UpperTesterPort_Pki.partC"
/*
#include "UpperTesterPort_IVIM.partC"
//#include "UpperTesterPort_MapSpat.partC"
......
......@@ -6,7 +6,6 @@
//#include "TTCN_EncDec.hh"
#ifdef _NO_SOFTLINKS_
/* to be used when built without generating softlinks to the working directory */
#include "Pki_ports/UpperTesterPort_Pki.partH"
#include "BTP_ports/UpperTesterPort_BTP.partH"
#include "CAM_ports/UpperTesterPort_CAM.partH"
#include "DENM_ports/UpperTesterPort_DENM.partH"
......@@ -14,11 +13,11 @@
#include "IVIM_ports/UpperTesterPort_IVIM.partH"
#include "MapemSpatem_ports/UpperTesterPort_MapemSpatem.partH"
#include "SremSsem_ports/UpperTesterPort_SremSsem.partH"
//#include "Pki_ports/UpperTesterPort_Pki.partH"
//#include "V2G_ports/UpperTesterPort_V2G.partH"
#else //_NO_SOFTLINKS_
#include "UpperTesterPort_Pki.partH"
#include "UpperTesterPort_BTP.partH"
#include "UpperTesterPort_CAM.partH"
#include "UpperTesterPort_DENM.partH"
......@@ -26,6 +25,7 @@
#include "UpperTesterPort_MapemSpatem.partH"
#include "UpperTesterPort_SremSsem.partH"
#include "UpperTesterPort_GN.partH"
//#include "UpperTesterPort_Pki.partH"
/*
#include "UpperTesterPort_IVIM.partH"
//#include "UpperTesterPort_MapSpat.partH"
......
......@@ -6,7 +6,7 @@
#include "uppertester_types.hh"
#include "pki_codec.hh"
//#include "pki_codec.hh"
template <typename T_type> class OPTIONAL;
class TTCN_EncDec;
......@@ -19,8 +19,6 @@ int uppertester_pki_codec::encode (const Record_Type& msg, OCTETSTRING& data)
TTCN_Buffer encoding_buffer;
if (std::string(msg.get_descriptor()->name).compare("@LibItsPki_TypesAndValues.UtPkiInitialize") == 0) {
encoding_buffer.put_c(static_cast<const unsigned char>(uppertester_pki_codec::c_utPkiInitialize));
} else if (std::string(msg.get_descriptor()->name).compare("@LibItsPki_TypesAndValues.UtPkiChangePosition") == 0) {
encoding_buffer.put_c(static_cast<const unsigned char>(uppertester_pki_codec::c_utPkiChangePosition));
} else { // Error
data = OCTETSTRING(0, nullptr);
loggers::get_instance().warning("<<< uppertester_pki_codec::encode: Failed to encode UT message");
......@@ -40,70 +38,18 @@ int uppertester_pki_codec::encode (const LibItsPki__TypesAndValues::UtPkiTrigger
TTCN_Buffer encoding_buffer;
//const Record_Type *type;
const LibItsPki__TypesAndValues::UtPkiTrigger &u = static_cast<const LibItsPki__TypesAndValues::UtPkiTrigger &>(msg);
/*if (u.ischosen(LibItsPki__TypesAndValues::UtPkiTrigger::ALT_changeCurvature)) {
encoding_buffer.put_c(static_cast<const unsigned char>(uppertester_pki_codec::c_utPkiChangeCurvature));
encoding_buffer.put_string(int2oct(u.changeCurvature(), 2));
} else if (u.ischosen(LibItsPki__TypesAndValues::UtPkiTrigger::ALT_changeSpeed)) {
encoding_buffer.put_c(static_cast<const unsigned char>(uppertester_pki_codec::c_utPkiChangeSpeed));
encoding_buffer.put_string(int2oct(u.changeSpeed(), 2));
} else if (u.ischosen(LibItsPki__TypesAndValues::UtPkiTrigger::ALT_setAccelerationControlStatus)) {
encoding_buffer.put_c(static_cast<const unsigned char>(uppertester_pki_codec::c_utPkiSetAccelerationStatus));
// Convert into ASN.1 encoded format
unsigned char c = *static_cast<const unsigned char*>(u.setAccelerationControlStatus());
unsigned char r = 0x00;
for (int i = 0; i < 8; i++, c >>= 1) { // TODO Try to refine the reverse bit operation
r = (r << 1) | (c & 0x01);
} // End of 'for' statement
encoding_buffer.put_c(r);
//encoding_buffer.put_c(*static_cast<const unsigned char*>(u.setAccelerationControlStatus()));
} else if (u.ischosen(LibItsPki__TypesAndValues::UtPkiTrigger::ALT_setExteriorLightsStatus)) {
encoding_buffer.put_c(static_cast<const unsigned char>(uppertester_pki_codec::c_utPkiSetExteriorLightsStatus));
// Convert into ASN.1 encoded format
unsigned char c = *static_cast<const unsigned char*>(u.setExteriorLightsStatus());
unsigned char r = 0x00;
for (int i = 0; i < 8; i++, c >>= 1) { // TODO Try to refine the reverse bit operation
r = (r << 1) | (c & 0x01);
} // End of 'for' statement
encoding_buffer.put_c(r);
} else if (u.ischosen(LibItsPki__TypesAndValues::UtPkiTrigger::ALT_changeHeading)) {
encoding_buffer.put_c(static_cast<const unsigned char>(uppertester_pki_codec::c_utPkiChangeHeading));
encoding_buffer.put_string(int2oct(u.changeHeading(), 2));
} else if (u.ischosen(LibItsPki__TypesAndValues::UtPkiTrigger::ALT_setDriveDirection)) {
encoding_buffer.put_c(static_cast<const unsigned char>(uppertester_pki_codec::c_utPkiSetDriveDirection));
encoding_buffer.put_c((unsigned char)static_cast<const Enum_Type&>(u.setDriveDirection()).as_int());
} else if (u.ischosen(LibItsPki__TypesAndValues::UtPkiTrigger::ALT_changeYawRate)) {
encoding_buffer.put_c(static_cast<const unsigned char>(uppertester_pki_codec::c_utPkiChangeYawRate));
const short i = u.changeYawRate();
const unsigned char t[2] = { (unsigned char)((i & 0xff00) >> 8), (unsigned char)(i & 0x00ff) };
OCTETSTRING os(2, t);
encoding_buffer.put_string(os);
} else if (u.ischosen(LibItsPki__TypesAndValues::UtPkiTrigger::ALT_setStationType)) {
encoding_buffer.put_c(static_cast<const unsigned char>(uppertester_pki_codec::c_utPkiSetStationType));
encoding_buffer.put_string(int2oct(u.setStationType(), 1));
} else if (u.ischosen(LibItsPki__TypesAndValues::UtPkiTrigger::ALT_setVehicleRole)) {
encoding_buffer.put_c(static_cast<const unsigned char>(uppertester_pki_codec::c_utPkiSetVehicleRole));
encoding_buffer.put_c((unsigned char)static_cast<const Enum_Type&>(u.setVehicleRole()).as_int());
} else if (u.ischosen(LibItsPki__TypesAndValues::UtPkiTrigger::ALT_setEmbarkationStatus)) {
encoding_buffer.put_c(static_cast<const unsigned char>(uppertester_pki_codec::c_utPkiSetEmbarkationStatus));
encoding_buffer.put_c((u.setEmbarkationStatus() == true) ? 0xff : 0x00);
} else if (u.ischosen(LibItsPki__TypesAndValues::UtPkiTrigger::ALT_setDangerousGoods)) {
encoding_buffer.put_c(static_cast<const unsigned char>(uppertester_pki_codec::c_utPkiSetDangerousGoods));
encoding_buffer.put_c((unsigned char)static_cast<const Enum_Type&>(u.setDangerousGoods()).as_int());
} else if (u.ischosen(LibItsPki__TypesAndValues::UtPkiTrigger::ALT_setPtActivation)) {
encoding_buffer.put_c(static_cast<const unsigned char>(uppertester_pki_codec::c_utPkiSetPtActivation));
encoding_buffer.put_c(static_cast<const unsigned char>(u.setPtActivation().ptActivationType()));
const OCTETSTRING& os = u.setPtActivation().ptActivationData();
encoding_buffer.put_c(static_cast<const unsigned char>(os.lengthof()));
encoding_buffer.put_string(os);
} else if (u.ischosen(LibItsPki__TypesAndValues::UtPkiTrigger::ALT_setLightBarSirene)) {
encoding_buffer.put_c(static_cast<const unsigned char>(uppertester_pki_codec::c_utPkiSetLightBarSirene));
loggers::get_instance().log("uppertester_pki_codec::encode: BarSirene=0x%02x - 0x%02x", *static_cast<const unsigned char*>(u.setLightBarSirene()), *static_cast<const unsigned char*>(u.setLightBarSirene()) << 6);
encoding_buffer.put_c(*static_cast<const unsigned char*>(u.setLightBarSirene()) << 6);
if (u.ischosen(LibItsPki__TypesAndValues::UtPkiTrigger::ALT_triggerEnrolmentRequest)) {
encoding_buffer.put_c(static_cast<const unsigned char>(uppertester_pki_codec::c_utPkiTriggerEnrolmentRequest));
encoding_buffer.put_c(static_cast<const unsigned char>(u.triggerEnrolmentRequest().cannonicalId().lengthof())); // Length of the string
encoding_buffer.put_string(u.triggerEnrolmentRequest().cannonicalId());
encoding_buffer.put_os(u.triggerEnrolmentRequest().encAlgorithm()); // One byte
encoding_buffer.put_os(u.triggerEnrolmentRequest().privateKey()); // 32 bytes
encoding_buffer.put_os(u.triggerEnrolmentRequest().compressedPublickey()); //33 bytes
} else { // Error
data = OCTETSTRING(0, nullptr);
loggers::get_instance().warning("<<< uppertester_pki_codec::encode: Failed to encode UT message");
return -1;
}*/
}