Commit e53ad219 authored by Yann Garcia's avatar Yann Garcia
Browse files

Rebuild AtsRSUsSimulator for full ITS release 2

parent 234e562e
Loading
Loading
Loading
Loading
+88 −22
Original line number Diff line number Diff line
@@ -650,14 +650,19 @@ int ConfigRsuSimulatorLayer::process_ut_denm_trigger(const OCTETSTRING &data, pa
    p += 3;
    // Situation
    trigger.situation().informationQuality() = oct2int(OCTETSTRING(1, p++));
    trigger.situation().eventType().causeCode()    = oct2int(OCTETSTRING(1, p++));
    trigger.situation().eventType().subCauseCode() = oct2int(OCTETSTRING(1, p++));
    ETSI__ITS__CDD::CauseCodeChoice causeCodeChoice;
    int cause = oct2int(OCTETSTRING(1, p++));
    set_cause_code_choice(cause, causeCodeChoice); // FIXME Check result
    trigger.situation().eventType().ccAndScc() = causeCodeChoice;
    int subCause = oct2int(OCTETSTRING(1, p++));
    trigger.situation().linkedCause().set_to_omit();
    trigger.situation().eventHistory().set_to_omit();
    trigger.situation().eventZone().set_to_omit();
    trigger.situation().linkedDenms().set_to_omit();
    trigger.situation().eventEnd().set_to_omit();
    // RelevanceDistance
    trigger.relevanceDistance() = oct2int(OCTETSTRING(1, p++));
    trigger.awarenessDistance() = oct2int(OCTETSTRING(1, p++));
    // RelevanceTrafficDirection
    trigger.relevanceTrafficDirection() = oct2int(OCTETSTRING(1, p++));
    trigger.trafficDirection() = oct2int(OCTETSTRING(1, p++));
    if ((flag & 0x04) == 0x04) {
      trigger.transmissionInterval() = OPTIONAL<INTEGER>(oct2int(OCTETSTRING(2, p)));
    } else {
@@ -725,27 +730,32 @@ int ConfigRsuSimulatorLayer::process_ut_denm_update(const OCTETSTRING &data, par
    if ((flag & 0x40) == 0x40) {
      DENM__PDU__Descriptions::SituationContainer &s = static_cast<DENM__PDU__Descriptions::SituationContainer &>(*update.get_opt_value());
      s.informationQuality()                         = oct2int(OCTETSTRING(1, p++));
      s.eventType().causeCode()                      = oct2int(OCTETSTRING(1, p++));
      s.eventType().subCauseCode()                   = oct2int(OCTETSTRING(1, p++));
      ETSI__ITS__CDD::CauseCodeChoice causeCodeChoice;
      int cause = oct2int(OCTETSTRING(1, p++));
      set_cause_code_choice(cause, causeCodeChoice); // FIXME Check result
      s.eventType().ccAndScc() = causeCodeChoice;
      int subCause = oct2int(OCTETSTRING(1, p++));
      s.linkedCause().set_to_omit();
      s.eventHistory().set_to_omit();
      s.eventZone().set_to_omit();
      s.linkedDenms().set_to_omit();
      s.eventEnd().set_to_omit();
      update.situation() = OPTIONAL<DENM__PDU__Descriptions::SituationContainer>(s);
    } else {
      update.situation().set_to_omit();
    }
    // Location
    update.location().set_to_omit();
    // RelevanceDistance
    // AwarenessDistance
    if ((flag & 0x20) == 0x20) {
      update.relevanceDistance() = oct2int(OCTETSTRING(1, p++));
      update.awarenessDistance() = oct2int(OCTETSTRING(1, p++));
    } else {
      update.relevanceDistance().set_to_omit();
      update.awarenessDistance().set_to_omit();
    }
    // RelevanceTrafficDirection
    // TrafficDirection
    if ((flag & 0x10) == 0x10) {
      update.relevanceTrafficDirection() = oct2int(OCTETSTRING(1, p++));
      update.trafficDirection() = oct2int(OCTETSTRING(1, p++));
    } else {
      update.relevanceTrafficDirection().set_to_omit();
      update.trafficDirection().set_to_omit();
    }
    if ((flag & 0x08) == 0x08) {
      update.transmissionInterval() = OPTIONAL<INTEGER>(oct2int(OCTETSTRING(2, p)));
@@ -1101,12 +1111,9 @@ int ConfigRsuSimulatorLayer::process_ut_ivim_trigger(const OCTETSTRING &data, pa
      trigger.driverAwarenesZoneIds().set_to_omit();
      p += 1;
    }
    if ((flag & 0x0080) == 0x0080) {
    if ((flag & 0x0080) == 0x0080) { // Assume length in one byte length
      CITSapplMgmtIDs::VarLengthNumber v;
      v.content()       = oct2int(OCTETSTRING(1, p));
      trigger.itsRrid() = OPTIONAL<CITSapplMgmtIDs::VarLengthNumber>(v);
    } else {
      trigger.itsRrid().set_to_omit();
    }
    p += 1;
    if ((flag & 0x0040) == 0x0040) {
@@ -1331,9 +1338,9 @@ int ConfigRsuSimulatorLayer::process_ut_rtcmem_trigger(const OCTETSTRING &data,
    // Decode msgCnt
    trigger.msgCnt() = *p++;
    // Decode rev
    trigger.rev() = DSRC::RTCM__Revision(static_cast<int>(*p++));
    trigger.rev() = ETSI__ITS__DSRC::RTCM__Revision(static_cast<int>(*p++));
    // Decode msgs
    DSRC::RTCMmessageList msgs;
    ETSI__ITS__DSRC::RTCMmessageList msgs;
    unsigned char         num_items = *p++; // Number of items
    msgs.set_size(num_items);
    for (unsigned char i = 0; i < num_items; i++) {
@@ -1391,7 +1398,7 @@ int ConfigRsuSimulatorLayer::process_ut_rtcmem_update(const OCTETSTRING &data, p
    loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_rtcmem_update: flag=%02x", flag);
    LibItsRtcmem__TypesAndValues::UtRtcmemUpdate update; // See ETSI TR 103 099 Cause C.10.2 GenerateRtcmemUpdate
    // Decode msgs
    DSRC::RTCMmessageList msgs;
    ETSI__ITS__DSRC::RTCMmessageList msgs;
    p += 1;                         // Skip COER flag
    unsigned char num_items = *p++; // Number of items
    msgs.set_size(num_items);
@@ -1457,4 +1464,63 @@ int ConfigRsuSimulatorLayer::process_ut_rtcmem_termination(const OCTETSTRING &da
  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);

  switch (p_cause) {
    case ETSI__ITS__CDD::CauseCodeChoice::ALT_trafficCondition1:
      p_causeCodeChoice.trafficCondition1() = ETSI__ITS__CDD::CauseCodeChoice::ALT_trafficCondition1;
      break;
    case ETSI__ITS__CDD::CauseCodeChoice::ALT_accident2:
      p_causeCodeChoice.accident2() = ETSI__ITS__CDD::CauseCodeChoice::ALT_trafficCondition1;
      break;
    case ETSI__ITS__CDD::CauseCodeChoice::ALT_roadworks3:
      p_causeCodeChoice.roadworks3() = ETSI__ITS__CDD::CauseCodeChoice::ALT_roadworks3;
      break;
    case ETSI__ITS__CDD::CauseCodeChoice::ALT_impassability5:
      p_causeCodeChoice.impassability5() = ETSI__ITS__CDD::CauseCodeChoice::ALT_trafficCondition1;
      break;
    case ETSI__ITS__CDD::CauseCodeChoice::ALT_adverseWeatherCondition__Adhesion6:
      p_causeCodeChoice.adverseWeatherCondition__Adhesion6() = ETSI__ITS__CDD::CauseCodeChoice::ALT_adverseWeatherCondition__Adhesion6;
      break;
    case ETSI__ITS__CDD::CauseCodeChoice::ALT_aquaplaning7:
      p_causeCodeChoice.aquaplaning7() = ETSI__ITS__CDD::CauseCodeChoice::ALT_aquaplaning7;
      break;
    case ETSI__ITS__CDD::CauseCodeChoice::ALT_hazardousLocation__SurfaceCondition9:
      p_causeCodeChoice.hazardousLocation__SurfaceCondition9() = ETSI__ITS__CDD::CauseCodeChoice::ALT_hazardousLocation__SurfaceCondition9;
      break;
    case ETSI__ITS__CDD::CauseCodeChoice::ALT_hazardousLocation__ObstacleOnTheRoad10:
      p_causeCodeChoice.hazardousLocation__ObstacleOnTheRoad10() = ETSI__ITS__CDD::CauseCodeChoice::ALT_hazardousLocation__ObstacleOnTheRoad10;
      break;
    case ETSI__ITS__CDD::CauseCodeChoice::ALT_hazardousLocation__AnimalOnTheRoad11:
      p_causeCodeChoice.hazardousLocation__AnimalOnTheRoad11() = ETSI__ITS__CDD::CauseCodeChoice::ALT_hazardousLocation__AnimalOnTheRoad11;
      break;
    case ETSI__ITS__CDD::CauseCodeChoice::ALT_humanPresenceOnTheRoad12:
      p_causeCodeChoice.humanPresenceOnTheRoad12() = ETSI__ITS__CDD::CauseCodeChoice::ALT_humanPresenceOnTheRoad12;
      break;
    //ALT_rescueAndRecoveryWorkInProgress15 = 16, ALT_reserved16 = 17, ALT_adverseWeatherCondition__ExtremeWeatherCondition17 = 18, ALT_adverseWeatherCondition__Visibility18 = 19, ALT_adverseWeatherCondition__Precipitation19 = 20, ALT_violence20 = 21, ALT_reserved21 = 22, ALT_reserved22 = 23, ALT_reserved23 = 24, ALT_reserved24 = 25, ALT_reserved25 = 26, ALT_slowVehicle26 = 27, ALT_dangerousEndOfQueue27 = 28, ALT_publicTransportVehicleApproaching28 = 29, ALT_reserved29 = 30, ALT_reserved30 = 31, ALT_reserved31 = 32, ALT_reserved32 = 33, ALT_reserved33 = 34, ALT_reserved34 = 35, ALT_reserved35 = 36, ALT_reserved36 = 37, ALT_reserved37 = 38, ALT_reserved38 = 39, ALT_reserved39 = 40, ALT_reserved40 = 41, ALT_reserved41 = 42, ALT_reserved42 = 43, ALT_reserved43 = 44, ALT_reserved44 = 45, ALT_reserved45 = 46, ALT_reserved46 = 47, ALT_reserved47 = 48, ALT_reserved48 = 49, ALT_reserved49 = 50, ALT_reserved50 = 51, ALT_reserved51 = 52, ALT_reserved52 = 53, ALT_reserved53 = 54, ALT_reserved54 = 55, ALT_reserved55 = 56, ALT_reserved56 = 57, ALT_reserved57 = 58, ALT_reserved58 = 59, ALT_reserved59 = 60, ALT_reserved60 = 61, ALT_reserved61 = 62, ALT_reserved62 = 63, ALT_reserved63 = 64, ALT_reserved64 = 65, ALT_reserved65 = 66, ALT_reserved66 = 67, ALT_reserved67 = 68, ALT_reserved68 = 69, ALT_reserved69 = 70, ALT_reserved70 = 71, ALT_reserved71 = 72, ALT_reserved72 = 73, ALT_reserved73 = 74, ALT_reserved74 = 75, ALT_reserved75 = 76, ALT_reserved76 = 77, ALT_reserved77 = 78, ALT_reserved78 = 79, ALT_reserved79 = 80, ALT_reserved80 = 81, ALT_reserved81 = 82, ALT_reserved82 = 83, ALT_reserved83 = 84, ALT_reserved84 = 85, ALT_reserved85 = 86, ALT_reserved86 = 87, ALT_reserved87 = 88, ALT_reserved88 = 89, ALT_reserved89 = 90, ALT_reserved90 = 91, ALT_vehicleBreakdown91 = 92, ALT_postCrash92 = 93, ALT_humanProblem93 = 94, ALT_stationaryVehicle94 = 95, ALT_emergencyVehicleApproaching95 = 96, ALT_hazardousLocation__DangerousCurve96 = 97, ALT_collisionRisk97 = 98, ALT_signalViolation98 = 99, ALT_dangerousSituation99 = 100, ALT_railwayLevelCrossing100 = 101, ALT_reserved101 = 102, ALT_reserved102 = 103, ALT_reserved103 = 104, ALT_reserved104 = 105, ALT_reserved105 = 106, ALT_reserved106 = 107, ALT_reserved107 = 108, ALT_reserved108 = 109, ALT_reserved109 = 110, ALT_reserved110 = 111, ALT_reserved111 = 112, ALT_reserved112 = 113, ALT_reserved113 = 114, ALT_reserved114 = 115, ALT_reserved115 = 116, ALT_reserved116 = 117, ALT_reserved117 = 118, ALT_reserved118 = 119, ALT_reserved119 = 120, ALT_reserved120 = 121, ALT_reserved121 = 122, ALT_reserved122 = 123, ALT_reserved123 = 124, ALT_reserved124 = 125, ALT_reserved125 = 126, ALT_reserved126 = 127, ALT_reserved127 = 128, ALT_reserved128 = 129
    case ETSI__ITS__CDD::CauseCodeChoice::ALT_wrongWayDriving14:
      p_causeCodeChoice.wrongWayDriving14() = ETSI__ITS__CDD::CauseCodeChoice::ALT_wrongWayDriving14;
      break;
    case ETSI__ITS__CDD::CauseCodeChoice::ALT_rescueAndRecoveryWorkInProgress15:
      p_causeCodeChoice.rescueAndRecoveryWorkInProgress15() = ETSI__ITS__CDD::CauseCodeChoice::ALT_rescueAndRecoveryWorkInProgress15;
      break;









    default:
      loggers::get_instance().error("ConfigRsuSimulatorLayer::set_cause_code_choice: Unsupported cause: %d", p_cause);
      return -1;
  } // End of 'switch' statement

  loggers::get_instance().log_msg("<<< ConfigRsuSimulatorLayer::set_cause_code_choice: ", p_causeCodeChoice);
  return 0;
}

ConfigRsuSimulatorLayerFactory ConfigRsuSimulatorLayerFactory::_f;
+5 −0
Original line number Diff line number Diff line
@@ -27,6 +27,10 @@ namespace ItsRSUsSimulator__TestSystem {
  class CfInitialize;
} // namespace ItsRSUsSimulator__TestSystem

namespace ETSI__ITS__CDD {
  class CauseCodeChoice;
} // namespace ETSI__ITS__CDD

class ConfigRsuSimulatorLayer : public t_layer<ItsRSUsSimulator__TestSystem::ConfigRsuSimulatorPort> {
  params                  _params;
  ConfigRsuSimulatorCodec _codec;
@@ -84,4 +88,5 @@ 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 set_cause_code_choice(const int p_cause, ETSI__ITS__CDD::CauseCodeChoice& p_causeCodeChoice);
}; // End of class ConfigRsuSimulatorLayer