Commit b975074a authored by garciay's avatar garciay
Browse files

Layers ongoing

parent 016a834b
......@@ -54,7 +54,10 @@ namespace LibItsCam__EncdecDeclarations {
OCTETSTRING is = bit2oct(b);
// Calculate the size of the lower layers information
int s = (LibItsGeoNetworking__TestSystem::GeoNetworkingInd_macDestinationAddress_raw_.fieldlength + LibItsGeoNetworking__TestSystem::GeoNetworkingInd_its__aid_raw_.fieldlength) / 8;
int s = (
LibItsGeoNetworking__TestSystem::GeoNetworkingInd_macDestinationAddress_raw_.fieldlength +
LibItsGeoNetworking__TestSystem::GeoNetworkingInd_its__aid_raw_.fieldlength
) / 8;
if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast<const unsigned char *>(is)), cam) == -1) {
loggers::get_instance().warning("fx__dec__CamInd: -1 result code was returned");
return -1;
......
......@@ -14,6 +14,9 @@ namespace LibItsGeoNetworking__EncdecDeclarations {
{
loggers::get_instance().log_msg(">>> fx__enc__GeoNetworkingReq: ", p_geoNetworkingReq);
float duration;
std::string tag("fx__enc__GeoNetworkingReq");
loggers::get_instance().set_start_time(tag);
GeoNetworkingCodec codec;
OCTETSTRING os;
if (codec.encode(p_geoNetworkingReq.msgOut(), os) == -1) {
......@@ -29,6 +32,7 @@ namespace LibItsGeoNetworking__EncdecDeclarations {
p_geoNetworkingReq.get_at(i)->encode(*p_geoNetworkingReq.fld_descr(i), encoding_buffer, TTCN_EncDec::CT_RAW);
}
} // End of 'for' statement
loggers::get_instance().set_stop_time(tag, duration);
return oct2bit(OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()));
}
......@@ -47,7 +51,10 @@ namespace LibItsGeoNetworking__EncdecDeclarations {
OCTETSTRING is = bit2oct(b);
// Calculate the size of the lower layers information
int s = (LibItsGeoNetworking__TestSystem::GeoNetworkingInd_macDestinationAddress_raw_.fieldlength + LibItsGeoNetworking__TestSystem::GeoNetworkingInd_its__aid_raw_.fieldlength) / 8;
int s = (
LibItsGeoNetworking__TestSystem::GeoNetworkingInd_macDestinationAddress_raw_.fieldlength +
LibItsGeoNetworking__TestSystem::GeoNetworkingInd_its__aid_raw_.fieldlength
) / 8;
if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast<const unsigned char *>(is)), pdu) == -1) {
loggers::get_instance().warning("fx__dec__GeoNetworkingReq: -1 result code was returned");
return -1;
......@@ -55,6 +62,7 @@ namespace LibItsGeoNetworking__EncdecDeclarations {
p.msgOut() = pdu;
TTCN_Buffer decoding_buffer(OCTETSTRING(is.lengthof() - s, static_cast<const unsigned char *>(is) + is.lengthof() - s));
for (int i = 1; i < p.get_count(); i++) {
loggers::get_instance().log("fx__dec__GeoNetworkingReq: processing %s/%s/%s", p.fld_name(i), p.fld_descr(i)->name, p.get_at(i)->get_descriptor()->name);
p.get_at(i)->decode(*p.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW);
} // End of 'for' statement
......@@ -99,12 +107,20 @@ namespace LibItsGeoNetworking__EncdecDeclarations {
{
loggers::get_instance().log(">>> fx__dec__GeoNetworkingInd");
float duration;
std::string tag("fx__dec__GeoNetworkingInd");
loggers::get_instance().set_start_time(tag);
GeoNetworkingCodec codec;
LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu pdu;
OCTETSTRING is = bit2oct(b);
// Calculate the size of the lower layers information
int s = (LibItsGeoNetworking__TestSystem::GeoNetworkingInd_macDestinationAddress_raw_.fieldlength + LibItsGeoNetworking__TestSystem::GeoNetworkingInd_ssp_raw_.fieldlength + LibItsGeoNetworking__TestSystem::GeoNetworkingInd_its__aid_raw_.fieldlength) / 8;
int s = (
LibItsGeoNetworking__TestSystem::GeoNetworkingInd_macDestinationAddress_raw_.fieldlength +
LibItsGeoNetworking__TestSystem::GeoNetworkingInd_ssp_raw_.fieldlength +
LibItsGeoNetworking__TestSystem::GeoNetworkingInd_its__aid_raw_.fieldlength
) / 8;
if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast<const unsigned char *>(is)), pdu) == -1) {
loggers::get_instance().warning("fx__dec__GeoNetworkingInd: -1 result code was returned");
return -1;
......@@ -146,6 +162,7 @@ namespace LibItsGeoNetworking__EncdecDeclarations {
p_geoNetworkingInd.get_at(i)->decode(*p_geoNetworkingInd.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW);
}
} // End of 'for' statement
loggers::get_instance().set_stop_time(tag, duration);
loggers::get_instance().log_msg("<<< fx__dec__GeoNetworkingInd: ", p_geoNetworkingInd);
return 0;
......
......@@ -22,7 +22,6 @@ namespace LibItsBtp__TestSystem {
if (_layer != NULL) {
delete _layer;
}
}
void BtpPort::set_parameter(const char * parameter_name, const char * parameter_value) {
......@@ -50,7 +49,7 @@ namespace LibItsBtp__TestSystem {
void BtpPort::user_map(const char * system_port) {
loggers::get_instance().log(">>> BtpPort::user_map: %s", system_port);
// Build layer stack
std::map<std::string, std::string>::iterator it = _cfg_params.find(std::string("params"));
Params::iterator it = _cfg_params.find(std::string("params"));
if (it != _cfg_params.end()) {
loggers::get_instance().log("BtpPort::user_map: %s", it->second.c_str());
_layer = LayerStackBuilder::GetInstance()->createLayerStack(it->second.c_str());
......
......@@ -54,7 +54,7 @@ namespace LibItsCam__TestSystem {
{
loggers::get_instance().log(">>> CamPort::user_map: %s", system_port);
// Build layer stack
std::map<std::string, std::string>::iterator it = _cfg_params.find(std::string("params"));
Params::iterator it = _cfg_params.find(std::string("params"));
if (it != _cfg_params.end()) {
loggers::get_instance().log("CamPort::user_map: %s", it->second.c_str());
_layer = LayerStackBuilder::GetInstance()->createLayerStack(it->second.c_str());
......
......@@ -56,7 +56,7 @@ namespace LibItsGeoNetworking__TestSystem {
{
loggers::get_instance().log(">>> GeoNetworkingPort::user_map: %s", system_port);
// Build layer stack
std::map<std::string, std::string>::iterator it = _cfg_params.find(std::string("params"));
Params::iterator it = _cfg_params.find(std::string("params"));
if (it != _cfg_params.end()) {
//loggers::get_instance().log("GeoNetworkingPort::user_map: %s", it->second.c_str());
_layer = LayerStackBuilder::GetInstance()->createLayerStack(it->second.c_str());
......
......@@ -22,20 +22,18 @@ class BTPCodec: public Codec <
LibItsBtp__TypesAndValues::BtpPacket,
LibItsBtp__TypesAndValues::BtpPacket>
{
Params* _param;
int encode_ (const Base_Type& type, const TTCN_Typedescriptor_t& field_descriptor, TTCN_Buffer& encoding_buffer);
int decode_ (Base_Type& type, const TTCN_Typedescriptor_t& field_descriptor, TTCN_Buffer& decoding_buffer);
public:
enum BtpType { btpA, btpB };
BTPCodec() : Codec<LibItsBtp__TypesAndValues::BtpPacket, LibItsBtp__TypesAndValues::BtpPacket>(), _param(NULL) { _type = BTPCodec::btpA; loggers::get_instance().log("BTPCodec::BTPCodec(D) :%d ", _type); };
BTPCodec() : Codec<LibItsBtp__TypesAndValues::BtpPacket, LibItsBtp__TypesAndValues::BtpPacket>() { _type = BTPCodec::btpA; loggers::get_instance().log("BTPCodec::BTPCodec(D) :%d ", _type); };
virtual ~BTPCodec() { loggers::get_instance().log("BTPCodec::~BTPCodec"); };
void set_btp_type(const BTPCodec::BtpType p_BtpType);
virtual int encode (const LibItsBtp__TypesAndValues::BtpPacket&, OCTETSTRING& data);
virtual int decode (const OCTETSTRING& data, LibItsBtp__TypesAndValues::BtpPacket&, Params* param = NULL);
virtual int decode (const OCTETSTRING& data, LibItsBtp__TypesAndValues::BtpPacket&, Params* params = NULL);
private:
BtpType _type;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment