Commit 599a9680 authored by Yann Garcia's avatar Yann Garcia
Browse files

Merge branch 'TTF0002' of https://forge.etsi.org/gitlab/ITS/ITS into TTF0002

parents bc8cbfdb 96b50c34
Loading
Loading
Loading
Loading

TTF0002_Linux.tpd

0 → 100644
+33472 −0

File added.

Preview size limit exceeded, changes collapsed.

+10 −0
Original line number Diff line number Diff line
@@ -112,6 +112,16 @@ namespace LibItsRtcmem__TestSystem {
    loggers::get_instance().set_stop_time(_time_key, duration);
  }

  void UpperTesterPort::outgoing_send(const LibItsRtcmem__TypesAndValues::UtRtcmemTermination& send_par)
  {
    loggers::get_instance().log_msg(">>> UppertesterPort::outgoing_send: ", send_par);
    
    float duration;
    loggers::get_instance().set_start_time(_time_key);
    static_cast<UpperTesterRtcmemLayer *>(_layer)->sendMsg(send_par, _layer_params);
    loggers::get_instance().set_stop_time(_time_key, duration);
  }

  void UpperTesterPort::receiveMsg (const Base_Type& p_ind, const params& p_params) {
    loggers::get_instance().log_msg(">>> UpperTesterPort_Rtcmem::receive_msg: ", p_ind);
    // Sanity check
+19 −17
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@ protected:

  void outgoing_send(const LibItsRtcmem__TypesAndValues::UtRtcmemUpdate& send_par);

  void outgoing_send(const LibItsRtcmem__TypesAndValues::UtRtcmemTermination& send_par);

};

} /* end of namespace */
+34 −11
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@ int UpperTesterRtcmemCodec::encode (const Record_Type& msg, OCTETSTRING& data)
    encoding_buffer.put_c(static_cast<const unsigned char>(UpperTesterRtcmemCodec::c_utRtcmemTrigger));
  } else if (std::string(msg.get_descriptor()->name).compare("@LibItsRtcmem_TypesAndValues.UtRtcmemUpdate") == 0) {
    encoding_buffer.put_c(static_cast<const unsigned char>(UpperTesterRtcmemCodec::c_utRtcmemUpdate));
  } else if (std::string(msg.get_descriptor()->name).compare("@LibItsRtcmem_TypesAndValues.UtRtcmemTermination") == 0) {
    encoding_buffer.put_c(static_cast<const unsigned char>(UpperTesterRtcmemCodec::c_utRtcmemTermination));
  } else { // Error
    data = OCTETSTRING(0, nullptr);
    loggers::get_instance().log("<<< UpperTesterRtcmemCodec::encode: Return -1");
@@ -77,19 +79,19 @@ int UpperTesterRtcmemCodec::decode (const OCTETSTRING& data, Record_Type& msg, p
  return 0;
}

std::unique_ptr<Base_Type> UpperTesterRtcmemCodec::decode (const OCTETSTRING& data, params* params) {

std::unique_ptr<Base_Type> UpperTesterRtcmemCodec::decode (const OCTETSTRING& data, params* params)
{
  std::unique_ptr<Base_Type> result;
  
  const unsigned char* ptr = static_cast<const unsigned char*>(data);
  if ((*ptr != UpperTesterRtcmemCodec::c_utRtcmemEventInd) && (*ptr != UpperTesterRtcmemCodec::c_utSsemEventInd)) {
  if (*ptr != UpperTesterRtcmemCodec::c_utRtcmemEventInd) {
    LibItsRtcmem__TypesAndValues::UtRtcmemResults res;
    decode(data, res, params);
    result.reset((Base_Type *)res.clone());
  } else if (*ptr == UpperTesterRtcmemCodec::c_utRtcmemEventInd) {
    LibItsRtcmem__TypesAndValues::UtRtcmemEventInd res;
    decode(data, res, params);
    result.reset((Base_Type *)res.clone());
  } else {
    LibItsRtcmem__TypesAndValues::UtRtcmemEventInd ind;
    decode(data, ind, params);
    result.reset((Base_Type *)ind.clone());
  }

  return result;
@@ -99,6 +101,18 @@ int UpperTesterRtcmemCodec::decode (const OCTETSTRING& data, LibItsRtcmem__Types
{
  loggers::get_instance().log_to_hexa(">>> UpperTesterRtcmemCodec::decode: decoding_buffer=", data);
  
  const unsigned char* ptr = static_cast<const unsigned char*>(data);
  if (*ptr == UpperTesterRtcmemCodec::c_utRtcmemInitializeResult) {
    msg.utRtcmemInitializeResult() = BOOLEAN(*(ptr + 1) == 0x01);
  } else if (*ptr == UpperTesterRtcmemCodec::c_utRtcmemTriggerResult) {
    msg.utRtcmemTriggerResult() = BOOLEAN(*ptr == 0x01);
  } else if (*ptr == UpperTesterRtcmemCodec::c_utRtcmemUpdateResult) {
    msg.utRtcmemUpdateResult() = BOOLEAN(*(ptr + 1) == 0x01);
  } else if (*ptr == UpperTesterRtcmemCodec::c_utRtcmemTerminationResult) {
    msg.utRtcmemTerminationResult() = BOOLEAN(*(ptr + 1) == 0x01);
  } else {
    TTCN_warning("UpperTesterRtcmemCodec::decode: Unsupported result");
  }

  loggers::get_instance().log_msg("<<< UpperTesterRtcmemCodec::decode", msg);
  return 0;
@@ -108,6 +122,15 @@ int UpperTesterRtcmemCodec::decode (const OCTETSTRING& data, LibItsRtcmem__Types
{
  loggers::get_instance().log_to_hexa(">>> UpperTesterRtcmemCodec::decode: decoding_buffer=", data);
  
  const unsigned char* ptr = static_cast<const unsigned char*>(data) + 1;
  OCTETSTRING os(2, ptr);
  ptr += 2;
  unsigned int length = oct2int(os);
  loggers::get_instance().log("UpperTesterRtcmemCodec::decode: RTCMEM message length=%d", length);
  os = OCTETSTRING(length, ptr);
  loggers::get_instance().log_to_hexa("UpperTesterRtcmemCodec::decode: RTCMEM message=", os);
  RtcmemCodec codec;
  codec.decode(os, msg.rtcmemMsg(), params);

  loggers::get_instance().log_msg("<<< UpperTesterRtcmemCodec::decode", msg);
  return 0;
+6 −5
Original line number Diff line number Diff line
@@ -23,12 +23,13 @@ class UpperTesterRtcmemCodec: public codec <
{
  const unsigned char c_utRtcmemInitialize = 0x00;
  const unsigned char c_utRtcmemInitializeResult = 0x01;
  const unsigned char c_utRtcmemTrigger = 0xCB;
  const unsigned char c_utRtcmemTriggerResult = 0xCC;
  const unsigned char c_utRtcmemUpdate = 0xCD;
  const unsigned char c_utRtcmemUpdateResult = 0xCE;
  const unsigned char c_utRtcmemTrigger = 0xC0;
  const unsigned char c_utRtcmemTriggerResult = 0xC1;
  const unsigned char c_utRtcmemUpdate = 0xC2;
  const unsigned char c_utRtcmemUpdateResult = 0xC3;
  const unsigned char c_utRtcmemTermination = 0xC4;
  const unsigned char c_utRtcmemTerminationResult = 0xC5;
  const unsigned char c_utRtcmemEventInd = 0xCF;
  const unsigned char c_utSsemEventInd = 0xC0;

  int encode_ (const Base_Type& type, const TTCN_Typedescriptor_t& field_descriptor, TTCN_Buffer& encoding_buffer);

Loading