IntermediateMergeCPSStandby

Intermediate merge (CPS standby) before to create branch for TTF T051/051/053

Merge request reports

Loading
+38 −1
Changes for ccsrc/Externals/LibItsCommon_externals.cc: 38 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -10,6 +10,8 @@
#define earthRadius 6378137.0L
#define rbis = ((double)(earthRadius * M_PI / 180))

#define epsilon ((double)0.000001)

namespace LibItsCommon__Functions {

  /**
@@ -121,11 +123,46 @@ namespace LibItsCommon__Functions {
      rlong2; //((double)p__refLongitude) + atan2(sin(angle)*sin(distance)*cos(ref_lat), cos(distance) - sin(ref_lat)*sin((double)p__latitude))*(180.0/M_PI);
  }

  /*       * @desc    External function to compute radius of a given circular area
  /*
   * @desc    External function to compute radius of a given circular area
   * @param   p_squareMeters  Square meters of an circular area
   * @return  Computed radius in meters
   fx_computeRadiusFromCircularArea(in float p_squareMeters) return float;
  */
  FLOAT fx__computeRadiusFromCircularArea(const FLOAT &p__squareMeters) { return FLOAT(sqrt(p__squareMeters / M_PI)); }

  // Verifiy 'euclidian distance (P1, P2) > minReferencePointPositonChangeThreshold'
  BOOLEAN fx__verify__euclidian__distance(const INTEGER& p__p1__lat, const INTEGER& p__p1__lon, const INTEGER& p__p2__lat, const INTEGER& p__p2__lon, const FLOAT& p__threshold, const INTEGER& p__comparison) {

    double v = sqrt(
                      (
                        (double)static_cast<const int>(p__p2__lat) * (double)static_cast<const int>(p__p2__lat) - (double)static_cast<const int>(p__p1__lat) * (double)static_cast<const int>(p__p1__lat)
                      ) + 
                      (
                        (double)static_cast<const int>(p__p2__lon) * (double)static_cast<const int>(p__p2__lon) - (double)static_cast<const int>(p__p1__lon) * (double)static_cast<const int>(p__p1__lon)
                      )
                    );

    if (p__comparison == 0) {
      return abs(v - (double)static_cast<const float>(p__threshold)) < epsilon;
    } else if (p__comparison == -1) {
      return ((double)static_cast<const float>(p__threshold) - v) < -epsilon;
    } else {
      return ((double)static_cast<const float>(p__threshold) - v) > epsilon;
    }
  }

  BOOLEAN fx__verify__delta(const INTEGER& p__v1, const INTEGER& p__v2, const FLOAT& p__threshold, const INTEGER& p__comparison) {

    double v = (double)static_cast<const int>(p__v2) - (double)static_cast<const int>(p__v1);

    if (p__comparison == 0) {
      return abs(v - (double)static_cast<const float>(p__threshold)) < epsilon;
    } else if (p__comparison == -1) {
      return ((double)static_cast<const float>(p__threshold) - v) < -epsilon;
    } else {
      return ((double)static_cast<const float>(p__threshold) - v) > epsilon;
    }
  }

} // namespace LibItsCommon__Functions
+9
Changes for ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.cc: 9 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -71,6 +71,15 @@ namespace LibItsCps__TestSystem {
    loggers::get_instance().set_stop_time(_time_key, duration);
  }

  void UpperTesterPort::outgoing_send(const LibItsCps__TypesAndValues::UtCpmTrigger &send_par) {
    loggers::get_instance().log_msg(">>> UpperTesterPort_Cps::outgoing_send: ", send_par);

    float duration;
    loggers::get_instance().set_start_time(_time_key);
    static_cast<uppertester_cps_layer*>(_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_Cps::receive_msg: ", p_ind);
    // Sanity check
+2
Changes for ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.hh: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@

//=============================================================================
#include "LibItsCps_TestSystem.hh"

namespace LibItsCps__TestSystem {

  class UpperTesterPort : public UpperTesterPort_BASE {
@@ -37,6 +38,7 @@ namespace LibItsCps__TestSystem {
    void user_stop();

    void outgoing_send(const LibItsCps__TypesAndValues::UtCpmInitialize &send_par);
    void outgoing_send(const LibItsCps__TypesAndValues::UtCpmTrigger &send_par);
  };

} // namespace LibItsCps__TestSystem
+99 −10
Changes for ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc: 99 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -450,6 +450,9 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsVru__TypesAndValues::UtVamResu
  if (send_par.ischosen(LibItsVru__TypesAndValues::UtVamResults::ALT_utVamInitializeResult)) {
    encoding_buffer.put_c(static_cast<const uint8_t>(uppertester_vru_codec::c_utVamInitializeResult));
    encoding_buffer.put_c((uint8_t)static_cast<const boolean>(send_par.utVamInitializeResult()));
  } else if (send_par.ischosen(LibItsVru__TypesAndValues::UtVamResults::ALT_utVamTriggerResult)) {
    encoding_buffer.put_c(static_cast<const uint8_t>(uppertester_vru_codec::c_utVamTriggerResult));
    encoding_buffer.put_c((uint8_t)static_cast<const boolean>(send_par.utVamTriggerResult()));
  } else {
    loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtVamResults variant");
    return;
@@ -529,6 +532,10 @@ void ConfigRsuSimulatorLayer::receive_data(OCTETSTRING &data, params &params) {
  } else if ((id == uppertester_pki_codec::c_utPkiTriggerEnrolmentRequest) ||
             (id == uppertester_pki_codec::c_utPkiTriggerAuthorizationRequest)) { // Receive an UtPkiTrigger
    process_ut_pki_trigger(data, params);
  } else if (id == uppertester_vru_codec::c_utVamTrigger) { // Receive an UtMbrTrigger
    process_ut_vam_trigger(data, params);
  } else if (id == uppertester_cps_codec::c_utCpmTrigger) { // Receive an UtMbrTrigger
    process_ut_cpm_trigger(data, params);
  } else if (id == uppertester_mbr_codec::c_utMbrTrigger) { // Receive an UtMbrTrigger
    process_ut_mbr_trigger(data, params);
  } else {
@@ -590,6 +597,16 @@ int ConfigRsuSimulatorLayer::process_utinitialize_data(const OCTETSTRING &data,
    LibItsMbr__TypesAndValues::UtMbrInitialize p(hashedId);
    // Pass it to the ports if any
    to_all_upper_ports(p, params);
  } else if (_params[std::string("ut")].compare("vam") == 0) {
    OCTETSTRING                                      hashedId(data.lengthof() - 1, 1 + static_cast<const uint8_t *>(data));
    LibItsVru__TypesAndValues::UtVamInitialize p(hashedId);
    // Pass it to the ports if any
    to_all_upper_ports(p, params);
  } else if (_params[std::string("ut")].compare("cpm") == 0) {
    OCTETSTRING                                      hashedId(data.lengthof() - 1, 1 + static_cast<const uint8_t *>(data));
    LibItsCps__TypesAndValues::UtCpmInitialize p(hashedId);
    // Pass it to the ports if any
    to_all_upper_ports(p, params);
  } else {
    loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_utinitialize_data: Unsupported protocol");
    return -1;
@@ -824,7 +841,7 @@ int ConfigRsuSimulatorLayer::process_ut_denm_update(const OCTETSTRING &data, par
    p += 3;
    // Situation
    if ((flag & 0x40) == 0x40) {
      DENM__PDU__Descriptions::SituationContainer &s = static_cast<DENM__PDU__Descriptions::SituationContainer &>(*update.get_opt_value());
      DENM__PDU__Descriptions::SituationContainer s;
      s.informationQuality()                         = oct2int(OCTETSTRING(1, p++));
      ETSI__ITS__CDD::CauseCodeChoice causeCodeChoice;
      int cause = oct2int(OCTETSTRING(1, p++));
@@ -1582,6 +1599,81 @@ int ConfigRsuSimulatorLayer::process_ut_rtcmem_termination(const OCTETSTRING &da
  return 0;
}

int ConfigRsuSimulatorLayer::process_ut_vam_trigger(const OCTETSTRING &data, params &params) {
  loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::process_ut_vam_trigger", data);

  params::const_iterator it = _params.find("ut");
  if (it == _params.cend()) {
    loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_vam_trigger: CF layer's ut parameter is missing");
    return -1;
  }

  if (_params[std::string("ut")].compare("vam") == 0) {
    uint8_t *p      = (uint8_t *)static_cast<const uint8_t *>(data);
    uint8_t  msg_id = *p++;
    loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_vam_trigger: msg_id=%02x", msg_id);
    uint8_t flag = *p++;
    loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_vam_trigger: flag=%02x", flag);
    LibItsVru__TypesAndValues::UtVamTrigger trigger;
    // Decode msgs
    if ((flag & 0x80) == 0x80) {
      trigger.setVruProfile() = *p;
    }
    if ((flag & 0x40) == 0x40) {
      trigger.leaveClusterWithCause() = *p;
    }
    if ((flag & 0x20) == 0x20) {
      trigger.setVbsState() = *p;
    }
    loggers::get_instance().log_msg("ConfigRsuSimulatorLayer::process_ut_vam_trigger: ", trigger);

    // Pass it to the ports if any
    to_all_upper_ports(trigger, params);
  } else {
    loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_vam_trigger: Unsupported protocol");
    return -1;
  }

  return 0;
}

int ConfigRsuSimulatorLayer::process_ut_cpm_trigger(const OCTETSTRING &data, params &params) {
  loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::process_ut_cpm_trigger", data);

  params::const_iterator it = _params.find("ut");
  if (it == _params.cend()) {
    loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_cpm_trigger: CF layer's ut parameter is missing");
    return -1;
  }

  if (_params[std::string("ut")].compare("cpm") == 0) {
    uint8_t *p      = (uint8_t *)static_cast<const uint8_t *>(data);
    uint8_t  msg_id = *p++;
    loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_cpm_trigger: msg_id=%02x", msg_id);
    uint8_t flag = *p++;
    loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_cpm_trigger: flag=%02x", flag);
    LibItsCps__TypesAndValues::UtCpmTrigger trigger;
    // Decode msgs
    if ((flag & 0x80) == 0x80) {
      trigger.setVehicleRole() = *p;
    }
    // if ((flag & 0x40) == 0x40) {
    //   trigger.leaveClusterWithCause() = *p;
    // }
    loggers::get_instance().log_msg("ConfigRsuSimulatorLayer::process_ut_cpm_trigger: ", trigger);

    // Pass it to the ports if any
    to_all_upper_ports(trigger, params);
  } else {
    loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_cpm_trigger: Unsupported protocol");
    return -1;
  }

  return 0;
}



int ConfigRsuSimulatorLayer::set_cause_code_choice(const int p_cause, ETSI__ITS__CDD::CauseCodeChoice& p_causeCodeChoice) {
  loggers::get_instance().log(">>> ConfigRsuSimulatorLayer::set_cause_code_choice: %d", p_cause);

@@ -1620,18 +1712,15 @@ int ConfigRsuSimulatorLayer::set_cause_code_choice(const int p_cause, ETSI__ITS_
    case ETSI__ITS__CDD::CauseCodeChoice::ALT_wrongWayDriving14:
      p_causeCodeChoice.wrongWayDriving14() = ETSI__ITS__CDD::CauseCodeChoice::ALT_wrongWayDriving14;
      break;
    case ETSI__ITS__CDD::CauseCodeChoice::ALT_slowVehicle26:
      p_causeCodeChoice.slowVehicle26() = ETSI__ITS__CDD::CauseCodeChoice::ALT_slowVehicle26;
      break;
    case ETSI__ITS__CDD::CauseCodeChoice::ALT_rescueAndRecoveryWorkInProgress15:
      p_causeCodeChoice.rescueAndRecoveryWorkInProgress15() = ETSI__ITS__CDD::CauseCodeChoice::ALT_rescueAndRecoveryWorkInProgress15;
      break;









    case ETSI__ITS__CDD::CauseCodeChoice::ALT_vehicleBreakdown91:
      p_causeCodeChoice.vehicleBreakdown91() = ETSI__ITS__CDD::CauseCodeChoice::ALT_vehicleBreakdown91;
      break;
    default:
      loggers::get_instance().error("ConfigRsuSimulatorLayer::set_cause_code_choice: Unsupported cause: %d", p_cause);
      return -1;
+3
Changes for ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -96,5 +96,8 @@ private:
  int process_ut_rtcmem_trigger(const OCTETSTRING &data, params &params);
  int process_ut_rtcmem_update(const OCTETSTRING &data, params &params);
  int process_ut_rtcmem_termination(const OCTETSTRING &data, params &params);
  int process_ut_vam_trigger(const OCTETSTRING &data, params &params);
  int process_ut_cpm_trigger(const OCTETSTRING &data, params &params);

  int set_cause_code_choice(const int p_cause, ETSI__ITS__CDD::CauseCodeChoice& p_causeCodeChoice);
}; // End of class ConfigRsuSimulatorLayer
Loading
Loading