Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

No files matched your search

+131
View File
@@ -0,0 +1,131 @@
#
# $Id$
# $HeadURL$
# $Author$
#
#
# --- Executable svcHighLevelArchitecture (svcHLA) -------------------------------------------------
#
SET(xml_FILE hla_service.xml)
SET(SRCS_exe
aes_handler.cpp
aes_handler.h
dds_handler.cpp
dds_handler.h
main.cpp
main_handler.cpp
main_handler.h
ngs_connector.cpp
ngs_connector.h
ngs_handler.cpp
ngs_handler.h
# ngs_connector_dis.cpp
# ngs_connector_dis.h
ppm_handler.cpp
ppm_handler.h
damage_model.cpp
damage_model.h
socketreader.cpp
socketreader.h
web_socket_handler.cpp
web_socket_handler.h
rpr/rpr_global.h
rpr/rpr_ia_munitiondetonation.cpp
rpr/rpr_ia_munitiondetonation.h
rpr/rpr_ia_weaponfire.cpp
rpr/rpr_ia_weaponfire.h
rpr/rpr_ia_engagementreply.cpp
rpr/rpr_ia_engagementreply.h
rpr/rpr_ia_eventreport.cpp
rpr/rpr_ia_eventreport.h
rpr/rpr_ia_actionrequest.cpp
rpr/rpr_ia_actionrequest.h
rpr/rpr_ia_data.cpp
rpr/rpr_ia_data.h
rpr/rpr_observer_object_cb.h
rpr/rpr_observer_object_instance_cb.h
rpr/rpr_observer_embeddedsystem_object_cb.h
rpr/rpr_observer_embeddedsystem_object_instance_cb.h
rpr/rpr_observer_designator_cb_notifier.h
rpr/rpr_observer_designator_object_cb.h
rpr/rpr_observer_designator_object_instance_cb.h
rpr/rpr_observer_baseentity_object_cb.h
rpr/rpr_observer_baseentity_object_instance_cb.h
rpr/rpr_observer_physicalentity_object_cb.h
rpr/rpr_observer_physicalentity_object_instance_cb.h
rpr/rpr_observer_platform_object_cb.h
rpr/rpr_observer_platform_object_instance_cb.h
rpr/rpr_observer_aircraft_object_cb.h
rpr/rpr_observer_aircraft_object_instance_cb.h
rpr/rpr_observer_longbow_apache_cb_notifier.h
rpr/rpr_observer_longbow_apache_object_cb.h
rpr/rpr_observer_longbow_apache_object_instance_cb.h
rpr/rpr_observer_groundvehicle_cb_notifier.h
rpr/rpr_observer_groundvehicle_object_cb.h
rpr/rpr_observer_groundvehicle_object_instance_cb.h
rpr/rpr_observer_lifeform_object_cb.h
rpr/rpr_observer_lifeform_object_instance_cb.h
rpr/rpr_observer_human_cb_notifier.h
rpr/rpr_observer_human_object_cb.h
rpr/rpr_observer_human_object_instance_cb.h
)
# Due to debug output for EntityTypeStruct
SET_SOURCE_FILES_PROPERTIES(ngs_connector.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE)
# make sure xml file is properly installed
CODEGEN_HANDLE_SVC_XML(SRCS_exe ${xml_FILE})
NGL_ADD_EXECUTABLE(HLA svcHighLevelArchitecture ${SRCS_exe})
NGL_TARGET_LINK_LIBRARIES(svcHighLevelArchitecture
ddsconnector
LtsCommandLineParser
LtsCoordTrans
nglcoreapplication
NGLLogger
nglsettings
Qt5::Core
Qt5::Network
Qt5::WebSockets
svcAesClient
svcCoreClient
svcExmClient
svcPdmClient
svcPpmClient
svcTabServer
svcTabClient
ngltools
LtsUtilsDds
NGS::NGS
HlaCommon
tabTelegrams
)
NGL_ADD_SVC_ICON({SRCS_exe})
NGL_INSTALL_TARGET(svcHighLevelArchitecture)
NGL_INSTALL(HLA FILES
log4cxx_hla.props
swconf.cfg
DESTINATION bin)
NGL_INSTALL(HLA FILES
RPRFOM20d17E_guez.xml
DESTINATION bin RENAME RPRFOM20d17E.xml)
NGL_INSTALL(HLA FILES
lts-cc.hla.conf
DESTINATION . RENAME lts-cc.hla.conf.distrib)
NGL_ADD_TARGET_LINK(svcHighLevelArchitecture pHLA)
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,59 @@
ObjectClass: GuezAircraft: Aircraft // Guez Specific Aircraft
Attribute: TacticalStatus: TacticalStatusStruct // The VBG/VBA/TotalStatus
ObjectClass: GuezGroundVehicle: GroundVehicle // Guez Specific GroundVehicle
Attribute: TacticalStatus: TacticalStatusStruct // The VBG/VBA/TotalStatus
ObjectClass: GuezHuman: Human // Guez Specific Human Lifeform
Attribute: TacticalStatus: TacticalStatusStruct // The VBG/VBA/TotalStatus
ObjectClass: GuezObserverController: Human // Guez Specific Observer / Controller
ObjectClass: GuezChemicalAgentArea: OtherArealObject // Guez Chemical Agent Area
Attribute: AreaEffectSimulationName: OMT13string // name of the AreaEffectSimulation
Attribute: ActivationTime: ClockTimeStruct // GPS ActivationTime
Attribute: Duration: Unsignedinteger32BE // Duration in seconds. 0=unlimited, 1-240 minutes, resolution: 1 minute
Attribute: DetonationLocation: WorldLocationStruct // Optional: Location of the impact of the chemical agent
Attribute: Radius: HLAfloat64BE // Optional: The radius of the chemical area
Attribute: ChemicalAgentType: ChemicalAgentTypeEnum8 // The chemical agent used
Attribute: IsPermanentAgent: HLAboolean // true for a permanent agent, false for a non permanent agent
ObjectClass: GuezFireSupport: OtherArealObject // Guez Fire Support
Attribute: AreaEffectSimulationName: OMT13string // name of the AreaEffectSimulation
Attribute: ActivationTime: ClockTimeStruct // GPS ActivationTime
Attribute: Duration: Unsignedinteger32BE // Duration in seconds. 0=unlimited, 1-1800 seconds
Attribute: Rounds: Unsignedinteger32BE // 1-1000
Attribute: MunitionType: EntityTypeStruct // The munition type used
Attribute: FirePositions: ArrayOfWorldLocationStructDynamicHLAlengthlessVarArray // Positions of the single impacts
Attribute: FireState: ArrayOfHLAoctetN_slsh_AperfectalwaysN_slsh_ADynamicHLApaddingTo32Array // BitArray of the single impacts, whether an impact already occured or not.
ObjectClass: GuezFireSupportSingleShot: OtherPointObject // Guez Fire Support Single Shot
Attribute: AreaEffectSimulationName: OMT13string // name of the AreaEffectSimulation
Attribute: ActivationTime: ClockTimeStruct // GPS ActivationTime
Attribute: DetonationLocation: WorldLocationStruct // Optional: The planned location of the impact. Note: A MunitionDetonation must be sent nevertheless
Attribute: Radius: HLAfloat64BE // The radius of the affected area
Attribute: MunitionType: EntityTypeStruct // The munition type used
ObjectClass: GuezMineField: OtherArealObject // Guez Mine Field
Attribute: AreaEffectSimulationName: OMT13string // name of the AreaEffectSimulation
Attribute: ActivationTime: ClockTimeStruct // GPS ActivationTime
Attribute: Duration: Unsignedinteger32BE // Duration in seconds. 0=unlimited, 1-240 minutes, resolution: 1 minute
Attribute: MineType: EntityTypeStruct //
Attribute: MineCount: Unsignedinteger32BE //
Attribute: MinePositions: ArrayOfWorldLocationStructDynamicHLAlengthlessVarArray //
Attribute: MineState: ArrayOfHLAoctetN_slsh_AperfectalwaysN_slsh_ADynamicHLApaddingTo32Array // BitArray of the single mines, whether mine is already triggered or not.
Attribute: Width: Unsignedinteger32BE // Width of the minefield (segment)
Attribute: Length: Unsignedinteger32BE // Length of the minefield (segment)
ObjectClass: GuezMineFieldBreach: OtherArealObject // Guez Mine Field Breach
Attribute: AreaEffectSimulationName: OMT13string // name of the AreaEffectSimulation
Attribute: ActivationTime: ClockTimeStruct // GPS ActivationTime
ObjectClass: GuezNuclearAgentArea: OtherArealObject // Guez Mine Field Breach
Attribute: AreaEffectSimulationName: OMT13string // name of the AreaEffectSimulation
Attribute: ActivationTime: ClockTimeStruct // GPS ActivationTime
Attribute: Duration: Unsignedinteger32BE // Duration in 10 minutes, 0=unlimited, up to 1000 -> 10000 minutes
Attribute: DetonationLocation: WorldLocationStruct // Optional: Location of the impact of a nuclear ammunition
Attribute: Radius: HLAfloat64BE // The radius of the affected area
+18
View File
@@ -0,0 +1,18 @@
DynamicArray: ErrorStructVariableArray : ErrorStruct [] : HLAvariableArray //
FixedRecord: TacticalStatusStruct // TacticalStatus
Field: TacticalStatus: TacticalStatusEnum8 // current tactical status
Field: VulnerabilityKind: Unsignedinteger32BE // index of ADAG
Field: TotalStatus: TotalStatusEnum32 // detailed status of all vulnerabilities that occured
FixedRecord: BiteResultStruct //
Field: DeviceOkay: CanDeviceEnum32 // Bits that are set identify working devices
Field: BatteryWarning: BatteryWarningEnum32 // Bit set to identify devices with low battery
Field: ErrorCodes: ErrorStructVariableArray // Array of Error Codes (0-21)
FixedRecord: ErrorStruct //
Field: DeviceId: Unsignedinteger16BE // Device Id on CAN Bus
Field: SubDeviceId: Unsignedinteger16BE // Subdevice Id within the device
Field: UniqueSubdeviceId: Unsignedinteger32BE // Unique Subdevice Id
Field: ErrorId: Unsignedinteger32BE // Specific Error Id of the Device / Subdevice Combination
+87
View File
@@ -0,0 +1,87 @@
Enumeration: ActivateHelmetObservationEnum8: HLAoctet
Enumerator: NoChange: 0 //
Enumerator: WithoutHelmetWithoutVest: 1 //
Enumerator: HelmetWithoutVest: 2 // (unused)
Enumerator: HelmetAndVest: 3 //
Enumeration: CanDeviceEnum32: Unsignedinteger32BE // Aka BiteStatusCANBusEnum32, ActualConfigurationEnum32, different from Doc
Enumerator: TNE: 1 //
Enumerator: AGDUS: 2 //
Enumerator: ABE: 4 //
Enumerator: SpecialSensorFIR: 8 //
Enumerator: SpecialSensorMV: 16 //
Enumerator: SpecialSensorStd: 32 //
Enumerator: MhgrSensor: 64 //
Enumerator: AbcOverpressureSensor: 128 //
Enumerator: AbcFlowDetector: 256 //
Enumerator: WeaponEffect: 512 //
Enumerator: SRT: 1024 //
Enumerator: DMF: 2048 //
Enumerator: IedSensor: 4096 //
Enumerator: IedControlDevice: 8192 //
Enumeration: BatteryWarningEnum32: Unsignedinteger32BE
Enumerator: BatteryWarningTNE: 1 //
Enumerator: BatteryWarningAbcFilter: 16 //
Enumerator: BatteryWarningWeapon: 32 //
Enumerator: BatteryWarningHelmet: 64 //
Enumeration: ResetPlayerEnum8: HLAoctet
Enumerator: NoChange: 0 //
Enumerator: AfterExercisePause: 1 // (unused)
Enumerator: CombatReadyWithoutReammunition: 2 //
Enumerator: CombatReadyWithReammunition: 3 //
Enumeration: BiteReportTypeEnum8: HLAoctet
Enumerator: CurrentStatus: 0 //
Enumerator: StatusAfterSelftest: 1 //
Enumeration: RegistrationTypeEnum8: HLAoctet
Enumerator: NoChange: 0 //
Enumerator: NewRegistration: 1 //
Enumerator: ReRegistration: 2 //
Enumeration: TacticalStatusEnum8 : HLAoctet
Enumerator: CombatReady: 0 //
Enumerator: LightHit: 1 //
Enumerator: MediumHit: 2 //
Enumerator: HeavyHit: 3 //
Enumerator: Immobilized: 4 //
Enumerator: ImmobilizedVisible: 5 //
Enumerator: WeaponKill: 6 //
Enumerator: WeaponKillVisible: 7 //
Enumerator: TotalKill: 8 //
Enumerator: TemporaryFailure: 9 //
Enumerator: NearMiss: 10 //
Enumerator: HitWithoutEffect: 11 //
Enumeration: ChemicalAgentTypeEnum8: HLAoctet
Enumerator: Other: 0 //
Enumerator: SLost: 1 //
Enumerator: Sarin: 2 //
Enumerator: VX: 3 //
Enumeration: TotalStatusEnum32 : Unsignedinteger32BE
Enumerator: CombatReady: 1 //
Enumerator: LightHit: 2 //
Enumerator: MediumHit: 4 //
Enumerator: HeavyHit: 8 //
Enumerator: Immobilized: 16 //
Enumerator: ImmobilizedVisible: 32 //
Enumerator: WeaponKill: 64 //
Enumerator: WeaponKillVisible: 128 //
Enumerator: TotalKill: 256 //
Enumerator: TemporaryFailure: 512 //
Enumerator: NearMiss: 1024 //
Enumerator: HitWithoutEffect: 2048 //
Enumerator: AContamination: 16384 //
Enumerator: CContamination: 65536 //
Enumerator: Manipulation: 131072 //
Enumeration: OriginatorTypeEnum16: Unsignedinteger16BE
Enumerator: Unknown: 0 //
Enumerator: Participant: 1 //
Enumerator: AreaEffectSimulation: 2 //
Enumerator: ObserverController: 3 //
Enumerator: ExerciseControl: 4 //
@@ -0,0 +1,28 @@
InteractionClass: GuezBiteReport: HLAinteractionRoot //
Parameter: EntityIdentifier: EntityIdentifierStruct //
Parameter: ReportTime: ClockTimeStruct // GPS Time of the report
Parameter: RegistrationType: RegistrationTypeEnum8 // Type of RegistrationType
Parameter: BiteResult: BiteResultStruct // List of available CAN devices
Parameter: ConfigurationComparisonResult: HLAboolean //
Parameter: DiscoveredDevices: CanDeviceEnum32 //
InteractionClass: GuezExconEngagement: HLAinteractionRoot //
Parameter: EntityIdentifier: EntityIdentifierStruct //
Parameter: EngagementTime: ClockTimeStruct // GPS Time of the engagement
Parameter: TacticalStatus: TacticalStatusStruct // The new status of the player
InteractionClass: GuezInit: HLAinteractionRoot //
Parameter: EntityIdentifier: EntityIdentifierStruct //
Parameter: ResetPlayer: ResetPlayerEnum8 // Reset a player to a specific status
Parameter: ActivateHelmetObservation: ActivateHelmetObservationEnum8 // If player wears helmet/vest or not
InteractionClass: GuezRequestBiteReport: HLAinteractionRoot //
Parameter: EntityIdentifier: EntityIdentifierStruct //
Parameter: BiteReportType: BiteReportTypeEnum8 // The type of the BiteReportType
InteractionClass: GuezHit: HLAinteractionRoot //
Parameter: TargetIdentifier: EntityIdentifierStruct //
Parameter: TargetLocation: WorldLocationStruct //
Parameter: OriginatorIdentifier: EntityIdentifierStruct //
Parameter: OriginatorType: OriginatorTypeEnum16 //
Parameter: Munition: EntityTypeStruct //
+6
View File
@@ -0,0 +1,6 @@
#!/bin/sh
cp /opt/NGS/NGSPublic/env/*.xsd .
/opt/NGS/NGSPublic/exe/fombuild -append RPRFOM20d17E.xml RPRFOM20d17E_guez.xml SUGEClasses.fom SUGEInteractions.fom SUGEData.fom SUGEEnum.fom
sed -i -f sed.txt RPRFOM20d17E_guez.xml
rm *.xsd
mv RPRFOM20d17E_guez.xml ..
+5
View File
@@ -0,0 +1,5 @@
s#[ ]*$##g
s# xmlns=""##g
/<dimensions>NA<\/dimensions>/d
s#\(units notes=.*\)>NA</units>#\1/>#g
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+80
View File
@@ -0,0 +1,80 @@
/**
* Send AES data to NGS
* $Id$
* $HeadURL$
* $Author$
* Created by Hannes Baeuerle, SLSE, 2017-05-08
*/
#include "aes_handler.h"
#include "ngs_handler.h"
#include <Common/participantposition.h>
#include <AreaEffectSimulation/aes_enums.hpp>
#include <AreaEffectSimulation/aes_translation.h>
#include <LtsUtilsCore/dds_bitarray.h>
#include <LtsCoordTrans/lts_coord_trans.h>
#include <EntityTypeStruct.h>
#include <QTimer>
#include <QDateTime>
using namespace AreaEffectSimulation;
namespace HighLevelArchitecture
{
AesHandler::AesHandler(NgsHandler *ngsHandler)
: m_ngsHandler(ngsHandler)
, m_dtcAes(nullptr)
, m_ftcAes(nullptr)
, m_dtcPpm(nullptr)
, m_requestHelper(new LtsUtils::RequestHelper(this))
, m_logger(getLogger("AesHandler"))
{
}
int64_t AesHandler::externalId(int aesItemId) const
{
AesItem aesItem;
if (!m_dtcAes->aesItemFromId(aesItemId, aesItem))
return 0;
return aesItem.externalId();
}
bool AesHandler::init()
{
connect(m_ngsHandler->ngsConnector().get(), &NgsConnector::airSupportImpact,
this, &AesHandler::onAirSupportImpact);
m_dtcAes = AreaEffectSimulation::Interface::Dtc::create(m_ngsHandler->ddsHandler()->ddsConnector());
m_ftcAes = AreaEffectSimulation::Interface::Ftc::create(m_ngsHandler->ddsHandler()->ddsConnector());
m_ftcAes->enableAirSupportImpactModify();
m_dtcPpm = ParticipantManagement::Interface::Dtc::create(m_ngsHandler->ddsHandler()->ddsConnector());
return true;
}
void AesHandler::onAirSupportImpactModifyReply(const Core::FunctionReplyObject &reply)
{
m_requestHelper->requestReply(reply);
}
void AesHandler::onAirSupportImpact(AirSupportImpactModifyRequest asi, int equipmentNumber)
{
asi.participantId(m_dtcPpm->participantIdByEquipmentNumber(equipmentNumber));
if (!asi.externalId().is_set())
return;
m_requestHelper->startSingleRequest([this, asi]()
{
return m_ftcAes->airSupportImpactModifyRequest(asi, this);
});
}
} // namespace HighLevelArchitecture
+55
View File
@@ -0,0 +1,55 @@
/**
* Send AES data to NGS
* $Id$
* $HeadURL$
* $Author$
* Created by Hannes Baeuerle, SLSE, 2017-05-08
*/
#pragma once
#include <QObject>
#include <AreaEffectSimulation/aes_dtc.h>
#include <AreaEffectSimulation/aes_ftc.h>
#include <ParticipantManagement/ppm_dtc.h>
#include <LtsUtilsGuiDds/request_helper.h>
#include <Common/logger.h>
//#include "typestruct.h"
namespace HighLevelArchitecture
{
class NgsHandler;
struct ParticipantPosition;
class AesHandler : public QObject
, protected AreaEffectSimulation::Interface::Ftc::AirSupportImpactModifyReplyHandler
{
Q_OBJECT
public:
explicit AesHandler(NgsHandler *ngsHandler);
int64_t externalId(int aesItemId) const;
bool init();
void onAirSupportImpactModifyReply(const Core::FunctionReplyObject &reply);
private Q_SLOTS:
void onAirSupportImpact(AreaEffectSimulation::AirSupportImpactModifyRequest asi, int equipmentNumber);
private:
NgsHandler *m_ngsHandler;
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_dtcAes;
std::shared_ptr<AreaEffectSimulation::Interface::Ftc> m_ftcAes;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtcPpm;
QMap<int, ProjectDataManagement::ChargeType> m_chargeTypes;
QMap<int, void*> m_pendingRequests;
LtsUtils::RequestHelper *m_requestHelper;
NGL::INGLLogger &m_logger;
};
} // namespace HighLevelArchitecture
+191
View File
@@ -0,0 +1,191 @@
/**
* @RDE_HEADER@
* Damage state transaformation from/to HLA <-> Excon, see ICD, 4.4.3.5.6 - Damage Model
* $Id$
* $HeadURL$
* $Author$
*/
#include "damage_model.h"
#include <QTimer>
#include <QDateTime>
namespace HighLevelArchitecture
{
// ICD, 4.4.3.5.6 - Damage Model
// es sind dort nich alle definiert, die Reihenfolge ist DamageState - FirePower - Immobilized
DamageModel::DamageModel(const IdentifierStruct &is,
const ProjectDataManagement::VulnerabilityState &state)
: m_is(is)
{
initTimer();
setVulnerabilityState(state, QDateTime::currentMSecsSinceEpoch());
}
DamageModel::DamageModel(const ProjectDataManagement::VulnerabilityState &state)
{
setVulnerabilityState(state, QDateTime::currentMSecsSinceEpoch());
}
ProjectDataManagement::VulnerabilityState DamageModel::vulnerabilityStateFromDamageStatus(const rpr2::DamageStatusEnum32::ET &status)
{
ProjectDataManagement::VulnerabilityState vs;
switch(status)
{
case rpr2::DamageStatusEnum32::NoDamage:
vs = ProjectDataManagement::VulnerabilityState_def::CombatReady;
break;
case rpr2::DamageStatusEnum32::SlightDamage:
vs = ProjectDataManagement::VulnerabilityState_def::LightDamage;
break;
case rpr2::DamageStatusEnum32::ModerateDamage:
vs = ProjectDataManagement::VulnerabilityState_def::HeavyDamage;
break;
case rpr2::DamageStatusEnum32::Destroyed:
vs = ProjectDataManagement::VulnerabilityState_def::CatastrophicKill;
break;
}
return vs;
}
DamageModel::DamageModel(const IdentifierStruct &is, const rpr2::DamageStatusEnum32::ET &status)
: m_is(is)
{
ProjectDataManagement::VulnerabilityState vs = vulnerabilityStateFromDamageStatus(status);
setVulnerabilityState(vs, QDateTime::currentMSecsSinceEpoch());
}
rpr2::DamageStatusEnum32::ET DamageModel::damageState(qint64 simTimeMSec) const
{
int idx = indexForTime(simTimeMSec);
if (idx < 0)
return rpr2::DamageStatusEnum32::NoDamage;
// Todo: Correct?!?
switch (m_vulnerabilityStates.at(idx).vulnerabilityState.underlying())
{
case ProjectDataManagement::VulnerabilityState_def::CombatReady:
return rpr2::DamageStatusEnum32::NoDamage;
case ProjectDataManagement::VulnerabilityState_def::LightDamage:
return rpr2::DamageStatusEnum32::SlightDamage;
case ProjectDataManagement::VulnerabilityState_def::MediumDamage:
case ProjectDataManagement::VulnerabilityState_def::HeavyDamage:
case ProjectDataManagement::VulnerabilityState_def::MobilityKill:
case ProjectDataManagement::VulnerabilityState_def::VisibleMobilityKill:
case ProjectDataManagement::VulnerabilityState_def::WeaponSystemDamage:
case ProjectDataManagement::VulnerabilityState_def::VisibleWeaponSystemDamage:
return rpr2::DamageStatusEnum32::ModerateDamage;
case ProjectDataManagement::VulnerabilityState_def::CatastrophicKill:
return rpr2::DamageStatusEnum32::Destroyed;
case ProjectDataManagement::VulnerabilityState_def::TemporarySeverance:
case ProjectDataManagement::VulnerabilityState_def::NearMiss:
case ProjectDataManagement::VulnerabilityState_def::HitWithNoEffect:
return rpr2::DamageStatusEnum32::NoDamage;
case ProjectDataManagement::VulnerabilityState_def::VulnerabilityBitsChanged:
case ProjectDataManagement::VulnerabilityState_def::Reserved:
return rpr2::DamageStatusEnum32::NoDamage;
case ProjectDataManagement::VulnerabilityState_def::NContamination:
case ProjectDataManagement::VulnerabilityState_def::BContamination:
case ProjectDataManagement::VulnerabilityState_def::CContamination:
return rpr2::DamageStatusEnum32::SlightDamage;
case ProjectDataManagement::VulnerabilityState_def::NotReady:
return rpr2::DamageStatusEnum32::NoDamage;
}
return rpr2::DamageStatusEnum32::NoDamage;
}
bool DamageModel::immobilized(qint64 simTimeMSec) const
{
int idx = indexForTime(simTimeMSec);
if (idx < 0)
return false;
if (m_vulnerabilityStates.at(idx).vulnerabilityState == ProjectDataManagement::VulnerabilityState_def::MobilityKill ||
m_vulnerabilityStates.at(idx).vulnerabilityState == ProjectDataManagement::VulnerabilityState_def::VisibleMobilityKill ||
m_vulnerabilityStates.at(idx).vulnerabilityState == ProjectDataManagement::VulnerabilityState_def::CatastrophicKill)
return true;
return false;
}
bool DamageModel::firePowerDisabled(qint64 simTimeMSec) const
{
int idx = indexForTime(simTimeMSec);
if (idx < 0)
return false;
if (m_vulnerabilityStates.at(idx).vulnerabilityState == ProjectDataManagement::VulnerabilityState_def::WeaponSystemDamage ||
m_vulnerabilityStates.at(idx).vulnerabilityState == ProjectDataManagement::VulnerabilityState_def::VisibleWeaponSystemDamage ||
m_vulnerabilityStates.at(idx).vulnerabilityState == ProjectDataManagement::VulnerabilityState_def::CatastrophicKill)
return true;
return false;
}
void DamageModel::setVulnerabilityState(const ProjectDataManagement::VulnerabilityState &state, qint64 simTimeMSec)
{
const int idx = indexForTime(simTimeMSec);
if (idx > 0 && m_vulnerabilityStates.at(idx).timeStamp == simTimeMSec)
{
// already there...
if (state == m_vulnerabilityStates.at(idx).vulnerabilityState)
return;
m_vulnerabilityStates[idx].vulnerabilityState = state;
}
else
{
VulnerabilityStateStructWithTimeStamp vssTs;
vssTs.vulnerabilityState = state;
vssTs.timeStamp = simTimeMSec;
m_vulnerabilityStates.insert(idx + 1, std::move(vssTs)); // idx = -1 -> oldest, will become index 0
}
while (m_vulnerabilityStates.size() > 10)
m_vulnerabilityStates.pop_front();
}
void DamageModel::setDamageState(const rpr2::DamageStatusEnum32::ET state, qint64 simTimeMSec)
{
ProjectDataManagement::VulnerabilityState vs = vulnerabilityStateFromDamageStatus(state);
setVulnerabilityState(vs, simTimeMSec);
}
ProjectDataManagement::VulnerabilityState DamageModel::vulnerabilityState(qint64 simTimeMSec) const
{
int idx = indexForTime(simTimeMSec);
if (idx < 0)
return ProjectDataManagement::VulnerabilityState_def::CombatReady;
return m_vulnerabilityStates.at(idx).vulnerabilityState;
}
int DamageModel::indexForTime(qint64 simTimeMSec) const
{
const int s = m_vulnerabilityStates.size();
if (simTimeMSec < 0 && s != 0) // = use current
return s - 1;
for (int i = s - 1; i >= 0; --i)
{
const auto &tss = m_vulnerabilityStates.at(i);
if (tss.timeStamp <= simTimeMSec)
return i;
}
return -1;
}
void DamageModel::initTimer()
{
delete m_timer;
m_timer = new QTimer(this);
m_timer->setSingleShot(true);
m_timer->start(s_waitInterval);
connect(m_timer, &QTimer::timeout,
this, [this]()
{
emit damageStateChanged();
m_timer->deleteLater();
m_timer = nullptr;
});
}
} // namespace HighLevelArchitecture
+70
View File
@@ -0,0 +1,70 @@
/**
* @RDE_HEADER@
* Damage state transaformation from/to HLA <-> Excon, see ICD, 4.4.3.5.6 - Damage Model
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <Common/identifierstruct.h>
#include <QObject>
#include <QVector>
#include <EntityIdentifierStruct.h>
#include <DamageStatusEnum32.h>
#include <ProjectDataManagement/pdm_enums.hpp>
class QTimer;
namespace HighLevelArchitecture
{
class DamageModel : public QObject
{
Q_OBJECT
public:
explicit DamageModel(const IdentifierStruct &is,
const ProjectDataManagement::VulnerabilityState &state);
explicit DamageModel(const ProjectDataManagement::VulnerabilityState &state);
explicit DamageModel(const IdentifierStruct &is, const rpr2::DamageStatusEnum32::ET &status);
explicit DamageModel(const IdentifierStruct &is)
: DamageModel(is, ProjectDataManagement::VulnerabilityState_def::CombatReady)
{}
const IdentifierStruct &identifierStruct() const { return m_is; }
rpr2::DamageStatusEnum32::ET damageState(qint64 simTimeMSec) const;
ProjectDataManagement::VulnerabilityState vulnerabilityState(qint64 simTimeMSec) const;
// Todo: Both really public?
void setVulnerabilityState(const ProjectDataManagement::VulnerabilityState &state, qint64 simTimeMSec);
void setDamageState(const rpr2::DamageStatusEnum32::ET state, qint64 simTimeMSec);
bool immobilized(qint64 simTimeMSec) const;
bool firePowerDisabled(qint64 simTimeMSec) const;
Q_SIGNALS:
void damageStateChanged();
void playerManipulationChanged(int eqNo, bool playerIsManipulated, qint64 simTimeMSecs);
private:
int indexForTime(qint64 simTimeMSec) const;
void initTimer();
private:
IdentifierStruct m_is;
QTimer *m_timer = nullptr;
struct VulnerabilityStateStructWithTimeStamp
{
ProjectDataManagement::VulnerabilityState vulnerabilityState;
qint64 timeStamp = 0;
};
QVector<VulnerabilityStateStructWithTimeStamp> m_vulnerabilityStates;
static const int s_waitInterval = 100; // 100 ms
static ProjectDataManagement::VulnerabilityState vulnerabilityStateFromDamageStatus(const rpr2::DamageStatusEnum32::ET &status);
};
} // namespace HighLevelArchitecture
+65
View File
@@ -0,0 +1,65 @@
/**
* DdsHandler for HighLevelArchitecture
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2017-04-07
*/
#include "dds_handler.h"
#include <DDS/Core/pacemaker.h>
#include <DDS/DTS/generic_dts_impl.h>
namespace HighLevelArchitecture
{
DdsHandler::DdsHandler(int domainId, int exerciseId)
: m_ddsConnector(new DDSConnector::DdsConnector(domainId, IDL::PartitionType::Exercise, exerciseId))
, m_exerciseHasHlaConnection(false)
, m_logger(getLogger("DdsHandler"))
{
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
}
DdsHandler::~DdsHandler()
{
m_dtcExm = nullptr;
m_pacemaker = nullptr;
m_ddsConnector = nullptr;
}
bool DdsHandler::init(const QStringList &qosFileList)
{
if (!m_ddsConnector->init(qosFileList))
{
ERROR_LOG(m_logger) << "Error initializing dds connections - aborting";
return false;
}
// default initialize Publisher and Subscriber
m_ddsConnector->initPublisherSubscriber();
m_pacemaker = std::make_shared<Core::Pacemaker>(m_ddsConnector);
m_dtcExm = ExerciseManagement::Interface::Dtc::create(m_ddsConnector);
connect(m_dtcExm.get(), &ExerciseManagement::Interface::Dtc::exerciseChanged,
this, &DdsHandler::onExerciseChanged);
m_dtcExm->enableExercise();
return true;
}
void DdsHandler::onExerciseChanged(const ExerciseManagement::Exercise &ex, DataModification modType)
{
if (modType == DataModification::eRemoved)
return;
if (ex.id() != m_ddsConnector->getPartitionId())
return;
if (m_exerciseHasHlaConnection == ex.hasHlaInterface())
return;
m_exerciseHasHlaConnection = ex.hasHlaInterface();
emit exerciseHlaStateChanged(m_exerciseHasHlaConnection);
}
} // namespace HighLevelArchitecture
+49
View File
@@ -0,0 +1,49 @@
/**
* DdsHandler for HighLevelArchitecture
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2017-04-07
*/
#pragma once
#include <DDS/DDSConnector/dds_connector.h>
#include <DDS/Core/core_dts_types.h>
#include <ExerciseManagement/exm_dtc.h>
#include <QObject>
#include <Common/logger.h>
namespace Core
{
class Pacemaker;
}
namespace HighLevelArchitecture
{
class DdsHandler : public QObject
{
Q_OBJECT
public:
DdsHandler(int domainId, int exerciseId);
~DdsHandler();
bool init(const QStringList &qosFileList = QStringList());
std::shared_ptr<Core::Pacemaker> pacemaker() const { return m_pacemaker; }
std::shared_ptr<DDSConnector::DdsConnector> ddsConnector() const { return m_ddsConnector; }
bool exerciseHasHlaConnection() const { return m_exerciseHasHlaConnection; }
Q_SIGNALS:
void exerciseHlaStateChanged(bool bHlaEnabled);
private:
void onExerciseChanged(const ExerciseManagement::Exercise &ex, DataModification modType);
private:
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
std::shared_ptr<Core::Pacemaker> m_pacemaker;
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_dtcExm;
bool m_exerciseHasHlaConnection;
NGL::INGLLogger &m_logger;
};
} // namespace HighLevelArchitecture
+21
View File
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<service namespace="HighLevelArchitecture" procNames="HighLevelArchitecture" abbreviation="HLA" exerciseDependency="Exercise" groups="ExercisePreparation,ExerciseExecution,ExercisePaused,ExerciseAfterActionReview">
<rcs>
<Id Id="$Id: ea_export_script.txt 28914 2016-08-23 12:08:05Z ehrlicher $"/>
<HeadURL HeadURL="$HeadURL: svn://slssvn/TDS/branches/product/devel/trunk/Lts/Common/CodeGen/ea_export_script.txt $"/>
<Author Author="$Author: ehrlicher $"/>
</rcs>
<tables/>
<dbServiceStructs/>
<topicTypes>
<topicType name="dummyStruct">
<column name="id" idlType="long"/>
</topicType>
</topicTypes>
<functionTopics/>
<enumerations>
<enumeration name="dummyEnum">
<attribute key="unknown" value=""/>
</enumeration>
</enumerations>
</service>
+125
View File
@@ -0,0 +1,125 @@
log4j.reset=true
log4j.rootLogger=WARN, file
# Service: HLA
###########################################################
#log4j.logger.SocketReader=DEBUG
#log4j.logger.HLA=DEBUG
#log4j.logger.HLA.main=DEBUG
#log4j.logger.HLA.MainHandler=DEBUG
#log4j.logger.HLA.NgsConnector=DEBUG
#log4j.logger.HLA.NgsHandler=WARN
#log4j.logger.HLA.PpmHandler=DEBUG
#log4j.logger.HLA.NgsConnector.Inbound=DEBUG
#log4j.logger.HLA.NgsConnector.Inbound.Player=DEBUG
#log4j.logger.HLA.NgsConnector.Inbound.Player.Status=DEBUG
#log4j.logger.HLA.NgsConnector.Inbound.Player.Position=WARN
#log4j.logger.HLA.NgsConnector.Inbound.Object=DEBUG
#log4j.logger.HLA.NgsConnector.Inbound.MunitionDetonation=DEBUG
#log4j.logger.HLA.NgsConnector.Inbound.WeaponFire=DEBUG
#log4j.logger.HLA.NgsConnector.Inbound.LaserDesignation=DEBUG
#log4j.logger.HLA.NgsConnector.Inbound.EmbeddedSystem=DEBUG
#log4j.logger.HLA.NgsConnector.Inbound.SensorField=DEBUG
#log4j.logger.HLA.NgsConnector.Inbound.EngagementReply=DEBUG
#log4j.logger.HLA.NgsConnector.Inbound.EventReport=DEBUG
#log4j.logger.HLA.NgsConnector.Outbound=DEBUG
#log4j.logger.HLA.NgsConnector.Outbound.Startup=DEBUG
#log4j.logger.HLA.NgsConnector.Outbound.Player=DEBUG
#log4j.logger.HLA.NgsConnector.Outbound.Player.Status=DEBUG
#log4j.logger.HLA.NgsConnector.Outbound.Player.Position=DEBUG
#log4j.logger.HLA.NgsConnector.Outbound.MunitionDetonation=DEBUG
#log4j.logger.HLA.NgsConnector.Outbound.WeaponFire=DEBUG
#log4j.logger.HLA.Callbacks=DEBUG
#log4j.logger.HLA.Callbacks.Interaction=DEBUG
#log4j.logger.HLA.Callbacks.Interaction.Data=DEBUG
#log4j.logger.HLA.Callbacks.Interaction.EnagagementReply=DEBUG
#log4j.logger.HLA.Callbacks.Interaction.EventReport=DEBUG
#log4j.logger.HLA.Callbacks.Interaction.MunitionDetonation=DEBUG
#log4j.logger.HLA.Callbacks.Interaction.WeaponFire=DEBUG
#log4j.logger.HLA.Callbacks.Object=DEBUG
#log4j.logger.HLA.Callbacks.Object.Aircraft=DEBUG
#log4j.logger.HLA.Callbacks.Object.BaseEntity=DEBUG
#log4j.logger.HLA.Callbacks.Object.Designator=DEBUG
#log4j.logger.HLA.Callbacks.Object.EmbeddedSystem=DEBUG
#log4j.logger.HLA.Callbacks.Object.GroundVehicle=DEBUG
#log4j.logger.HLA.Callbacks.Object.Human=DEBUG
#log4j.logger.HLA.Callbacks.Object.Lifeform=DEBUG
#log4j.logger.HLA.Callbacks.Object.LongBowApache=DEBUG
#log4j.logger.HLA.Callbacks.Object.Object=DEBUG
#log4j.logger.HLA.Callbacks.Object.PhysicalEntity=DEBUG
#log4j.logger.HLA.Callbacks.Object.Platform=DEBUG
# File
###########################################################
log4j.appender.file=Lts::RollingFileAppender
log4j.appender.file.MaxFileSize=1MB
log4j.appender.file.MaxBackupIndex=9
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d %-5p %c |#| %m (%.50F:%L) %n
# Appnd_Console
###########################################################
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern= %d %p %c %c{1} - %m (%-.30F:%L) %n
# Appnd_Syslog
###########################################################
log4j.appender.syslog=org.apache.log4j.SyslogAppender
log4j.appender.syslog.Threshold=ERROR
log4j.appender.syslog.SysLogHost=localhost
log4j.appender.syslog.Facility=LOCAL7
log4j.appender.syslog.layout=org.apache.log4j.PatternLayout
log4j.appender.syslog.layout.ConversionPattern= %-4r %-5p %c %x - %m
log4j.appender.syslog.LevelRangeFilter.AcceptOnMatch=true
log4j.appender.syslog.LevelRangeFilter.LevelMin=INFO
log4j.appender.syslog.LevelRangeFilter.LevelMax=FATAL
###########################################################
###########################################################
###########################################################
# 1) Available Levels in LOG4CXX Version 0.10.0:
# TRACE,
# DEBUG,
# INFO,
# WARN,
# ERROR
# FATAL
#
# d = date/time
# p = priority (Level)
# c = category/channel
# m = message
# F = file
# L = line
# n = platform dependent line separator character or characters.
# ....
#
# Examples for console:
# a)
# %d %p %c #%m# (%.50F:%L)%n
# date/time
# priority
# category/channel
# #message#
# (Maximal 50Character des Filename von rechts:Line)
# line separator
#
# b)
# %d (%.15F:%L) %-5p %c |#| %m%n
# date/time
# (Maximal 15Character des Filename von rechts:Line)
# priority, Right pad with spaces if the priority name is less than 5 characters long.
# category/channel
# message
# line separator
#
# Examples for files:
+12
View File
@@ -0,0 +1,12 @@
[hla]
FederationName=22
Protocol=HLA
SocketReaders/1/Port=1234
SocketReaders/1/Hostname=eccorts02
SocketReaders/1/Port=15
SocketReaders/size=1
SiteId=201
ApplicationId=100
webSocketListenPort=12347
PlayerIdIDT=32001
PlayerIdExcon=32002
+53
View File
@@ -0,0 +1,53 @@
/**
* @RDE_HEADER@
* main for HLA
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2017-04-07
*/
#include <nglapplication/nglcoreapplication.h>
#include <LtsCommandLineParser/LtsCommandLineParser.h>
#include <memory>
#include "main_handler.h"
#include <Common/logger.h>
#include <Common/settings.h>
#include <NGSApplicationBase.h>
// Corba specific stuff
class myCorbaSpecificStuff final : public NGSApplicationBase
{
public:
using NGSApplicationBase::NGSApplicationBase;
int run() override { return 1; }
};
int main(int argc, char **argv)
{
NGLCoreApplication app(argc, argv);
int iRet = -1;
LtsCommandLineParser::LtsCommandLineParser options;
if (!options.init())
return iRet;
app.createLogger("HLA", options.exerciseId());
myCorbaSpecificStuff corba(argc, argv);
HighLevelArchitecture::Settings::setIniFile(options.iniFile());
//qputenv("MAKLMGRD_LICENSE_FILE", HighLevelArchitecture::Settings::hlaLicenseServer());
{
std::unique_ptr<HighLevelArchitecture::MainHandler> mainHandler(new HighLevelArchitecture::MainHandler);
if (mainHandler->init(options.domainId(), options.exerciseId()))
{
STARTUP_LOG(app.baseLogger());
iRet = app.exec();
SHUTDOWN_LOG(app.baseLogger());
}
}
return iRet;
}
+118
View File
@@ -0,0 +1,118 @@
/**
* MainHandler for HighLevelArchitecture
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2017-04-07
*/
#include "main_handler.h"
#include <Common/logger.h>
#include "ngs_handler.h"
#include "web_socket_handler.h"
#include <Common/settings.h>
#include <QCoreApplication>
#include <QTimer>
#include <DDS/Core/pacemaker.h>
namespace HighLevelArchitecture
{
MainHandler::MainHandler(QObject *parent)
: QObject(parent)
, m_exerciseId(0)
, m_logger(getLogger("MainHandler"))
{}
MainHandler::~MainHandler()
{
m_ngsHandler = nullptr;
m_ddsHandler = nullptr;
}
bool MainHandler::init(int domainId, int exerciseId)
{
m_exerciseId = exerciseId;
// initialize DDS
m_ddsHandler = std::make_shared<DdsHandler>(domainId, exerciseId);
if (!m_ddsHandler->init())
{
ERROR_LOG(m_logger) << "Could not init DDS handler";
return false;
}
connect(m_ddsHandler.get(), &DdsHandler::exerciseHlaStateChanged,
this, &MainHandler::onExerciseHlaStateChanged);
onExerciseHlaStateChanged(m_ddsHandler->exerciseHasHlaConnection());
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::Running);
return true;
}
bool MainHandler::isConnectedToHla() const
{
return m_ngsHandler && m_ngsHandler->isConnectedToHla();
}
void MainHandler::onExerciseHlaStateChanged(bool bHlaEnabled)
{
NOTICE_LOG(m_logger) << "HLA State Changed: HLA is now " << (bHlaEnabled ? "EN" : "DIS") << "ABLED in this exercise";
if (bHlaEnabled)
{
if (m_ngsHandler && m_wsHandler)
return;
if (!m_wsHandler)
{
m_wsHandler = std::make_shared<WebSocketHandler>(m_exerciseId, this);
if (!m_wsHandler->init(Settings::webSocketListenPort()))
{
m_wsHandler = nullptr;
return;
}
}
if (!m_ngsHandler)
{
m_ngsHandler = std::make_shared<NgsHandler>();
if (!m_ngsHandler->init(m_ddsHandler))
{
m_ngsHandler = nullptr;
NOTICE_LOG(m_logger) << "Could not init ngs - stopping application";
QCoreApplication::quit();
return;
}
}
connect(m_ngsHandler.get(), &NgsHandler::externalEquipmentNumberAdded,
m_wsHandler.get(), &WebSocketHandler::onExternalEquipmentNumberAdded);
connect(m_ngsHandler.get(), &NgsHandler::externalEquipmentNumberRemoved,
m_wsHandler.get(), &WebSocketHandler::onExternalEquipmentNumberRemoved);
connect(m_wsHandler.get(), &WebSocketHandler::initRequest,
m_ngsHandler.get(), &NgsHandler::participantInitRequest);
connect(m_wsHandler.get(), &WebSocketHandler::vulnerabilityStateRequest,
m_ngsHandler.get(), &NgsHandler::participantVulnerabilityStateRequest);
connect(m_wsHandler.get(), &WebSocketHandler::cesHitInformationRequest,
m_ngsHandler.get(), &NgsHandler::participantCesHitInformationRequest);
NOTICE_LOG(m_logger) << "onExerciseHlaStateChanged - created new ngsHandler";
m_wsHandler->sendHlaConnectionState();
}
else
{
if (m_ngsHandler)
NOTICE_LOG(m_logger) << "onExerciseHlaStateChanged - deleting ngsHandler";
m_ngsHandler = nullptr;
if (m_wsHandler)
{
m_wsHandler->sendHlaConnectionState();
auto copy = m_wsHandler;
QTimer::singleShot(2000, this, [copy]
{
copy->deleteLater();
});
}
m_wsHandler = nullptr;
}
}
} // namespace HighLevelArchitecture
+40
View File
@@ -0,0 +1,40 @@
/**
* MainHandler for HighLevelArchitecture
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2017-04-07
*/
#pragma once
#include <QObject>
#include <memory>
#include "dds_handler.h"
#include <Common/logger.h>
namespace HighLevelArchitecture
{
class NgsHandler;
class WebSocketHandler;
class MainHandler : public QObject
{
Q_OBJECT
public:
explicit MainHandler(QObject *parent = nullptr);
~MainHandler();
bool init(int domainId, int exerciseId);
bool isConnectedToHla() const;
std::shared_ptr<NgsHandler> ngsHandler() const { return m_ngsHandler; }
private Q_SLOTS:
void onExerciseHlaStateChanged(bool bHlaEnabled);
private:
std::shared_ptr<DdsHandler> m_ddsHandler;
std::shared_ptr<NgsHandler> m_ngsHandler;
std::shared_ptr<WebSocketHandler> m_wsHandler;
int m_exerciseId;
LOGGER_T m_logger;
};
} // namespace HighLevelArchitecture
@@ -0,0 +1,14 @@
[Unit]
Description=Start/Stop MAK RTI for TDS
After=network.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/opt/NGS/makRti4.5-conf/ctc_mak_rti_systemd start
ExecStop=/opt/NGS/makRti4.5-conf/ctc_mak_rti_systemd stop
ExecReload=/opt/NGS/makRti4.5-conf/ctc_mak_rti_systemd restart
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,37 @@
#!/bin/sh
. /etc/rc.status
# Reset status of this service
rc_reset
bin_dir=/opt/NGS/makRti4.5/bin/
conf_dir=/opt/NGS/makRti4.5-conf/
case "$1" in
start)
export RTI_ASSISTANT_DISABLE=1
${bin_dir}/rtiexec -R ${conf_dir}/rid.mtl &
# ${bin_dir}/rtiForwarder -R ${conf_dir}/rid.mtl -t 192.168.133.147 -T 4001 -A 229.7.7.7 -P 4000 -N 192.168.133.147 -M -D 5050 &
${bin_dir}/rtiForwarder -R ${conf_dir}/rid.mtl -t 192.168.99.100 -T 4001 -A 229.7.7.7 -P 4000 -N 192.168.99.100 -M -D 5050 &
;;
stop)
ps -ef | grep rtiForwarder | awk '$0 !~ /grep/ {system("kill "$2)}'
ps -ef | grep rtiexec | awk '$0 !~ /grep/ {system("kill "$2)}'
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
# Remember status and be quiet
rc_status
;;
*)
echo "Usage: $0 {start|stop|restart|}"
exit 1
;;
esac
rc_exit
+161
View File
@@ -0,0 +1,161 @@
;; RID File generated with MAK RTI version: 4.5 HLA 1.3
;; Compiler: GNU C++ version 4.8.5 20150623 (Red Hat 4.8.5-11)
(setqb RTI_IOPeriod 0.1)
(setqb RTI_addressDelay 1)
(setqb RTI_autoProvideDelay -1)
(setqb RTI_discoveryMsgBundlingDelay 0)
(setqb RTI_execMcastDiscoveryDelay 1)
(setqb RTI_federateHeartbeatInterval 10)
(setqb RTI_federateTimeoutInterval 25)
(setqb RTI_flushTimeoutInterval 3)
(setqb RTI_forwardingDelay 3)
(setqb RTI_lrcMcastDiscoveryDelay 3)
(setqb RTI_peerForwarderReconnectDelay 3)
(setqb RTI_receiveTolerance 0)
(setqb RTI_responseInterval 3)
(setqb RTI_sharedMemoryMgrMaxWait 0)
(setqb RTI_tickWaitPeriod 0)
(setqb RTI_transmitDelay 0)
(setqb RTI_transmitRate 0)
(setqb RTI_IOQueueIndicator 0)
(setqb RTI_allProvideUpdateRequestsDelayed 0)
(setqb RTI_attributeRelevanceAdvisorySwitch 0)
(setqb RTI_attributeScopeAdvisorySwitch 0)
(setqb RTI_autoProvideSwitch 0)
(setqb RTI_automaticNameReserveEnabled 0)
(setqb RTI_bestEffortSendRetries 50)
(setqb RTI_bestEffortSendRetryWaitUsec 50)
(setqb RTI_catchFedAmbExceptions 1)
(setqb RTI_checkFlag 0)
(setqb RTI_configureConnectionWithRid 1)
(setqb RTI_conveyOnlyAvailableDimensions 0)
(setqb RTI_conveyProducingFederateSwitch 1)
(setqb RTI_conveyRegionDesignatorSwitch 0)
(setqb RTI_crcCheckFedFile 0)
(setqb RTI_dataDistMgmt 1)
(setqb RTI_ddmFixedGrid 0)
(setqb RTI_delaySubscriptionEvaluationSwitch 0)
(setqb RTI_deleteOrphans 1)
(setqb RTI_detachNotifyLevelFromStdOut 2)
(setqb RTI_disableUnlicensedForTwo 0)
(setqb RTI_distributeFedFile 1)
(setqb RTI_distributeFedFileAsynchronously 0)
(setqb RTI_distributedForwarderPort 5000)
(setqb RTI_distributedUdpForwarderMode 0)
(setqb RTI_dualTransmitFirstInteractionRegions 0)
(setqb RTI_dumpFed 0)
(setqb RTI_dumpRid 1)
(setqb RTI_enableBestEffortSendRetry 1)
(setqb RTI_enableCheckVersion 1)
(setqb RTI_enableFederateHeartbeat 0)
(setqb RTI_enableFedexMsgRouting 1)
(setqb RTI_enableFomBackwardsCompatibility 0)
(setqb RTI_enableHlaObjectNamePrefix 0)
(setqb RTI_enableLRCNetworkStatisticsMonitoring 1)
(setqb RTI_enableMessageThrottling 0)
(setqb RTI_enableNameReservation 1)
(setqb RTI_enableNetworkTesting 1)
(setqb RTI_enablePacketBundling 1)
(setqb RTI_enableSaveRestoreWhenUsingRtiexec 1)
(setqb RTI_enableSharedMemoryExecEventLog 0)
(setqb RTI_enableTcpCompression 0)
(setqb RTI_enableTcpSmartForwarding 0)
(setqb RTI_enableUdpCompression 0)
(setqb RTI_enableUdpSmartForwarding 0)
(setqb RTI_enableUpdateRateReduction 0)
(setqb RTI_enableWarningsForDisabledServices 1)
(setqb RTI_exceptionReportingSwitch 0)
(setqb RTI_extend13and1516interop 1)
(setqb RTI_federateReconnectPause 5)
(setqb RTI_fomDataTransportTypeControl 0)
(setqb RTI_fomModuleMerging 1)
(setqb RTI_fomModuleSorting 1)
(setqb RTI_forceFullCompliance 0)
(setqb RTI_forceUnlicensedForTwo 0)
(setqb RTI_fullFedFileDistribution 0)
(setqb RTI_interactionRelevanceAdvisorySwitch 1)
(setqb RTI_internalMsgReliableWhenUsingRtiexec 1)
(setqb RTI_internalMsgSmartForwardingWhenUsingRtiexec 1)
(setqb RTI_lrcMinidumperLevel 0)
(setqb RTI_maxForwarderQueue -1)
(setqb RTI_maxIOCount 50000)
(setqb RTI_maxIOQueue 500000)
(setqb RTI_maxNumFederates 511)
(setqb RTI_maxUdpPacketSize 15000)
(setqb RTI_mcastDiscoveryEnabled 0)
(setqb RTI_mcastDiscoveryPort 6001)
(setqb RTI_mcastDiscoveryTries 3)
(setqb RTI_mcastTtl 2)
(setqb RTI_momEvokeCallbackObserverEnabled 0)
(setqb RTI_momExceptionLogging 0)
(setqb RTI_momFederateUpdateInterval 0)
(setqb RTI_momServiceAvailable 0)
(setqb RTI_momVerboseLevel 0)
(setqb RTI_nextEventRequestAndRetractServiceEnabled 1)
(setqb RTI_notifyLevel 4)
(setqb RTI_objectClassRelevanceAdvisorySwitch 1)
(setqb RTI_packetBundlingSize 1400)
(setqb RTI_peerForwarderReconnectNumberOfTries 3)
(setqb RTI_preferLocalFomModules 0)
(setqb RTI_preferRidToFedSwitchTable 1)
(setqb RTI_processUnknownUpdatesForDiscovery 1)
(setqb RTI_processingModel 1)
(setqb RTI_reconnectEnabled 0)
(setqb RTI_resignResponseEnabled 0)
(setqb RTI_reuseLogFile 0)
(setqb RTI_reuseReleasedObjectHandles 0)
(setqb RTI_ridConsistencyChecking 0)
(setqb RTI_routeToAllByDefault 0)
(setqb RTI_rtiExecPerformsLicensing 0)
(setqb RTI_rtiExecReconnectPause 4)
(setqb RTI_saveRestoreTimeout 120)
(setqb RTI_saveTransientMessages 0)
(setqb RTI_sendDiscoveredClass 1)
(setqb RTI_serviceReportingSwitch 0)
(setqb RTI_sharedMemoryMode 0)
(setqb RTI_sharedMemoryQueueLength 1000)
(setqb RTI_singleCallbackPerTick 0)
(setqb RTI_smartForwardingLevel 0)
(setqb RTI_socketReceiveBufferSize 2000000)
(setqb RTI_socketSendBufferSize 2000000)
(setqb RTI_strictFomChecking 1)
(setqb RTI_strictHLA1516eAttributeOwnershipUnavailableCallback 1)
(setqb RTI_strictNameReservation 0)
(setqb RTI_tcpBufferSize 500000)
(setqb RTI_tcpCompressionLevel 1)
(setqb RTI_tcpNoDelay 1)
(setqb RTI_tcpPort 4001)
(setqb RTI_testConnectionThreshold 0)
(setqb RTI_throwExceptionCallNotAllowedFromWithinCallback 0)
(setqb RTI_throwExceptionForDisabledService 1)
(setqb RTI_throwExceptionOnConcurrentAccess 0)
(setqb RTI_tickFavorsNetwork 1)
(setqb RTI_timeMgmt 1)
(setqb RTI_udpCompressionLevel 1)
(setqb RTI_udpPort 4000)
(setqb RTI_use32BitsForValueSize 0)
(setqb RTI_useBusyWaitForTickMinMax 0)
(setqb RTI_useRandomNumberForFedHandle 0)
(setqb RTI_useRtiExec 1)
(setqb RTI_waitIOPeriodForBundling 0)
(setqb RTI_ddmFixedGridFilename "")
(setqb RTI_defaultFedFile "")
(setqb RTI_defaultTimeImplementation "")
(setqb RTI_destAddrString "229.7.7.7")
(setqb RTI_forwarderRoutesFile "/opt/NGS/makRti4.5-conf/routes.mtl")
(setqb RTI_implicitDdmParamsFile "")
(setqb RTI_logFileDirectory "/shd/CTC/LOG")
(setqb RTI_logFileName "makRti.log")
(setqb RTI_maxChannelAddr "UseDefaultChannelAddr")
(setqb RTI_mcastDiscoveryAddrString "229.7.7.8")
(setqb RTI_minChannelAddr "UseDefaultChannelAddr")
(setqb RTI_momModuleExtensionFileName "")
(setqb RTI_networkInterfaceAddr "10.7.144.65")
(setqb RTI_rtiExecLogFileName "rtiExec.log")
(setqb RTI_rtiForwarderLogFileName "rtiForwarder.log")
(setqb RTI_saveRestoreDirectory ".")
(setqb RTI_sharedMemExecLogFileName "")
(setqb RTI_sharedMemoryName "DtRtiSharedMessages")
(setqb RTI_tcpForwarderAddr "10.7.144.65")
(setqb RTI_tcpNetworkInterfaceAddr "10.7.144.65")
@@ -0,0 +1,4 @@
;; Always use eth0 net!
(RTI_addForwarder "10.7.144.65" "10.7.144.65" 5000)
(RTI_addForwarder "192.168.99.100" "10.7.144.65" 5050)
File diff suppressed because it is too large. Load diff
+304
View File
@@ -0,0 +1,304 @@
/**
* Connect to ngs / hla and provide the basic interface
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2017-04-07
*/
#pragma once
#include <Common/participantposition.h>
#include <QObject>
#include <QPointF>
#include <QMap>
#include <QSet>
#include <QTransform>
#include <WorldLocationStruct.h>
#include <EntityTypeStruct.h>
#include <ProjectDataManagement/pdm_enums.hpp>
#include <IObserver.h>
#include <IPlayerBaseEntityObjInstance.h>
#include <IObserverObjectInstance.h>
#include <IObserverEmbeddedSystemObjInstance.h>
#include <ForceIdentifierEnum8.h>
#include <DamageStatusEnum32.h>
#include <DesignatorCodeEnum16.h>
#include <DetonationResultCodeEnum8.h>
#include <SensorFieldEnum32.h>
#include <ClockTimeStruct.h>
#include <ArrayOfWorldLocationStructDynamicHLAlengthlessVarArray.h>
#include <ArrayOfHLAoctetN_slsh_AperfectalwaysN_slsh_ADynamicHLApaddingTo32Array.h>
#include <Core/core.hpp>
// For LaserDesignation
#include <TrainingAreaBase/tab.hpp>
namespace ngs
{
class ISimulatedWorldAdmin;
class IFederationMaster;
}
namespace rpr2
{
class IPlayerSOM;
class MarkingStruct;
class IPlayerPhysicalEntityObjInstance;
class IPlayerEnvironmentObjectObjInstance;
class OMT13string;
class EventIdentifierStruct;
class IObserverEngagementReplyIntInstance;
class IObserverEventReportIntInstance;
class IObserverMunitionDetonationIntInstance;
class IObserverWeaponFireIntInstance;
class IObserverDesignatorObjInstance;
}
namespace NGL
{
class INGLLogger;
}
namespace AreaEffectSimulation {
class AirSupportImpactModifyRequest;
}
namespace TrainingAreaBase
{
class EquipmentGearEvent;
class EquipmentGearChargeState;
class EquipmentGearAssignment;
class EquipmentState;
class SendCesHitInformation;
class SpecialSensorData;
}
namespace ParticipantManagement
{
class ParticipantGearEvent;
class StateInformation;
}
namespace LtsCoordTrans
{
struct UtmCoordinate;
}
class ObserverHumanCBNotifier;
class ObserverGroundVehicleCBNotifier;
class ObserverLongBowApacheCBNotifier;
class ObserverDesignatorCBNotifier;
class ObserverObjectCB;
class ObserverBaseEntityObjectCB;
class ObserverPhysicalEntityObjectCB;
class ObserverPlatformObjectCB;
class ObserverGroundVehicleObjectCB;
class ObserverLifeformObjectCB;
class ObserverHumanObjectCB;
class ObserverAircraftObjectCB;
class ObserverLongBowApacheObjectCB;
class ObserverEmbeddedSystemObjectCB;
class ObserverDesignatorObjectCB;
class ObserverEngagementReplyCBNotifier;
class ObserverEventReportCBNotifier;
class ObserverMunitionDetonationCBNotifier;
class ObserverWeaponFireCBNotifier;
class QTimer;
struct GuezHitStruct
{
qint32 targetId = 0;
qint64 sampleTime = 0;
ProjectDataManagement::VulnerabilityState vulnerabilityState = ProjectDataManagement::VulnerabilityState_def::get_default();
qint32 vulnerabilityKind = 0;
qint32 vulnerabilityBits = 0;
Core::GeoPosition position = Core::GeoPosition(0, 0, 0);
qint32 originatorId = 0;
ProjectDataManagement::StateChangeOriginator originatorType = ProjectDataManagement::StateChangeOriginator_def::get_default();
QString originatorChargeTypeEtsString;
};
namespace HighLevelArchitecture
{
class NgsHandler;
class PlayerCallback;
class DamageModel;
class IdentifierStruct;
class TypeStruct;
struct ParticipantInformation;
class NgsConnector : public QObject
{
Q_OBJECT
void connectObserverObjectSignals(ObserverObjectCB *entity);
void connectObserverBaseEntityObjectSignals(ObserverBaseEntityObjectCB *entity);
void connectObserverPhysicalEntityObjectSignals(ObserverPhysicalEntityObjectCB *entity);
void connectObserverPlatformObjectSignals(ObserverPlatformObjectCB *entity);
void connectObserverGroundVehicleObjectSignals(ObserverGroundVehicleObjectCB *entity);
void connectObserverLifeformObjectSignals(ObserverLifeformObjectCB *entity);
void connectObserverHumanObjectSignals(ObserverHumanObjectCB *entity);
void connectObserverAircraftObjectSignals(ObserverAircraftObjectCB *entity);
void connectObserverLongBowApacheObjectSignals(ObserverLongBowApacheObjectCB *entity);
void connectObserverEmbeddedSystemObjectSignals(ObserverEmbeddedSystemObjectCB *entity);
void connectObserverDesignatorObjectSignals(ObserverDesignatorObjectCB *entity);
void addObserverObjectInstance(const ngs::IObserverObjectInstance &obj);
void removeObserverObjectInstance(const ngs::IObserverObjectInstance &obj);
void ensureDamageModelExists(const IdentifierStruct &is);
bool addBaseEntity(rpr2::IPlayerBaseEntityObjInstance *playerInstance, const ParticipantInformation &participantData);
bool addPhysicalEntity(rpr2::IPlayerPhysicalEntityObjInstance *playerInstance, const ParticipantInformation &playerData);
static rpr2::MarkingStruct toMarkingStruct(const QString &designator);
static rpr2::ClockTimeStruct getClockTimeStruct(qint64 msecsSinceEpoch);
static qint64 getMSecsSinceEpoch(const rpr2::ClockTimeStruct &cts);
rpr2::EntityTypeStruct getEtsCharge(int chargeType) const;
template<typename T>
static rpr2::ArrayOfWorldLocationStructDynamicHLAlengthlessVarArray positionArray(const T &data);
static inline QTransform fromRotation(double rot) { return QTransform().rotate(rot); }
static QPolygonF utmToGeogrphic(const QPolygonF &polyUtm, const LtsCoordTrans::UtmCoordinate &base);
rpr2::EventIdentifierStruct getEventIdentifierStruct();
bool setVulnerabilityState(int eqNo, const ParticipantManagement::StateInformation &state);
static ProjectDataManagement::VulnerabilityState getVulnerabilityStateFromState(const ParticipantManagement::StateInformation &state);
int getEquipmentNoByRTIObjectId(const std::string &sender) const;
static ngs::SimTime getSimTime(qint64 msecsSinceEpoch = 0);
static ngs::SimTime getSimTime(const QDateTime &dateTime);
IdentifierStruct getIdentifierStructByEquipmentNo(const int eqId) const;
rpr2::OMT13string getObjectIdentifierByEquipmentNo(const int eqId) const;
TrainingAreaBase::LaserDesignation getLaserDesignation(const IdentifierStruct &is, const rpr2::IObserverDesignatorObjInstance *instance, qint64 simTimeMSecs) const;
public:
NgsConnector(const QString &fedName, NgsHandler *ngsHandler);
~NgsConnector();
bool initialize(ngs::IObserver::ProtocolType protocol, const QString &playerName, const QString &appDirPath);
void uninitialize();
bool canPublishData() const { return m_bCanPublishData; }
bool addHuman(const ParticipantInformation &participantData, const ProjectDataManagement::VulnerabilityState &state);
bool addGroundVehicle(const ParticipantInformation &participantData, const ProjectDataManagement::VulnerabilityState &state);
bool addLongBowApache(const ParticipantInformation &participantData, const ProjectDataManagement::VulnerabilityState &state);
bool removeBaseEntity(int eqNo);
bool setParticipantName(int eqNo, const QString &designator);
bool setParticipantHit(int eqNo, const ParticipantManagement::StateInformation &state,
const ParticipantPosition &partPos, int chargeType,
ProjectDataManagement::StateChangeOriginator originatorType, int originatorEqNo = 0);
bool setWorldLocation(int eqNo, const ParticipantPosition &pos);
void sendMunitionDetonation(int targetEqId,
ProjectDataManagement::ChargeType ct,
int sourceEqId,
rpr2::DetonationResultCodeEnum8::ET drc,
qint64 timestamp);
void sendParticipantInitRequest(int eqNo, bool resetManipulation, bool resetVulnerabilityState, bool restockCharges, qint64 simTimeMSecs);
bool sendData(int eqNo, const QByteArray &data, int requestIdentifier);
protected slots:
void go();
void onFirstTickFinished();
signals:
void spatialChanged(int eqId, const ParticipantPosition &pos, qint64 simTimeMSecs);
void markingChanged(int eqId, const QString &marking, qint64 simTimeMSecs);
void virtualParticipantDeleted(int eqId);
void virtualEmbeddedSystemDeleted(int eqIdHost);
void firstTickFinished();
void airSupportImpact(AreaEffectSimulation::AirSupportImpactModifyRequest &asi, int equipmentNumber);
void weaponFire(const TrainingAreaBase::EquipmentGearEvent &event);
void gearAssignment(const TrainingAreaBase::EquipmentGearAssignment &event);
void gearChargeState(const TrainingAreaBase::EquipmentGearChargeState &event);
void exconEngagement(int eqNo, const ProjectDataManagement::VulnerabilityState &state);
void equipmentState(const TrainingAreaBase::EquipmentState &event);
void sensorChanged(const TrainingAreaBase::SpecialSensorData &event);
void cesHitInformation(const TrainingAreaBase::SendCesHitInformation &event);
void eventCountOverflow();
void laserDesignation(const TrainingAreaBase::LaserDesignation &event);
protected:
void subscribeAtNgs();
void unsubscribeFromNgs();
int m_enitityNumberCounter;
int m_eventCount;
NgsHandler *m_ngsHandler;
const QString m_fedName;
ngs::ISimulatedWorldAdmin *m_swadmin;
ngs::IFederationMaster *m_master;
rpr2::IPlayerSOM *m_somPlayer;
PlayerCallback *m_playerCallback;
// Callbacks:
ObserverHumanCBNotifier *m_humanCallback;
ObserverGroundVehicleCBNotifier *m_groundVehicleCallback;
ObserverLongBowApacheCBNotifier *m_longBowApacheCallback;
ObserverDesignatorCBNotifier *m_designatorCallback;
ObserverEngagementReplyCBNotifier *m_iaEngagementReplyCallback;
ObserverEventReportCBNotifier *m_iaEventReportCallback;
ObserverMunitionDetonationCBNotifier *m_iaMunitionDetonationCallback;
ObserverWeaponFireCBNotifier *m_iaWeaponFireCallback;
QMap<int, rpr2::IPlayerBaseEntityObjInstance *> m_playerMap; // Key: EqNo // All Players, WE handle
QMap<int, const ngs::IObserverObjectInstance *> m_observerBaseEntityInstances; // Key: EqNo // All of THEIR Base Entities on the bus.
QMap<int, const ngs::IObserverObjectInstance *> m_observerEmbeddedSystemInstances; // Key: EqNo // All of THEIR Players on the bus.
QMap<int, ParticipantPosition> m_observerPositions; // Key: EqNo
QMap<int, DamageModel *> m_damageModelMap; // Key: EqNo
QSet<const ngs::IObserverObjectInstance *> m_newBaseEntitesWithoutParticipantIdSetIdSet;
QSet<const ngs::IObserverObjectInstance *> m_newEmbeddedSystemsWithoutParticipantIdSet;
bool m_bInitialized;
bool m_bCanPublishData;
QTimer *m_timer; // Todo: Start with 1 ms occurs! Needed?
NGL::INGLLogger &m_logger;
static quint16 s_ownSiteId;
static quint16 s_ownApplicationId;
static const int STATUS_WAIT_INTERVAL = 500; // Wartezeit auf Statusänderung
static const int ACTIVATION_LEAD_TIME = 5000; // Vorlaufzeit beim Aktivieren von Wirkfeldern.
private slots:
void onBaseEntityEntityIdentifierChanged(const rpr2::EntityIdentifierStruct &eis, const rpr2::IObserverBaseEntityObjInstance *obj, qint64 simTimeMSecs);
void onEmbeddedSystemEntityIdentifierChanged(const rpr2::EntityIdentifierStruct &eis, const rpr2::IObserverEmbeddedSystemObjInstance *obj, qint64 simTimeMSecs);
bool onSpatialChanged(const rpr2::EntityIdentifierStruct &eis, const rpr2::WorldLocationStruct &wl, qint64 simTimeMSecs);
void onEntityTypeChanged(const rpr2::EntityIdentifierStruct &eis, const rpr2::EntityTypeStruct &ets, qint64 simTimeMSecs);
bool onMarkingChanged(const rpr2::EntityIdentifierStruct &eis, const rpr2::MarkingStruct &marking, qint64 simTimeMSecs);
bool onForceIdentifierChanged(const rpr2::EntityIdentifierStruct &eis, rpr2::ForceIdentifierEnum8::ET identifier, qint64 simTimeMSecs);
bool onDamageStateChanged(const rpr2::EntityIdentifierStruct &eis, rpr2::DamageStatusEnum32::ET status, qint64 simTimeMSecs);
bool onSensorChanged(const rpr2::EntityIdentifierStruct &eis, rpr2::SensorFieldEnum32::ET value, qint64 simTimeMSecs);
bool onDesignatorCodeChanged(const rpr2::EntityIdentifierStruct &eis, rpr2::DesignatorCodeEnum16::ET value, qint64 simTimeMSecs);
bool onDesignatorOutputPowerChanged(const rpr2::EntityIdentifierStruct &eis, ngs::FLOAT32 value, qint64 simTimeMSecs);
bool onDesignatorSpotLocationChanged(const rpr2::EntityIdentifierStruct &eis, const rpr2::WorldLocationStruct &value, qint64 simTimeMSecs);
void onNewEngagementReply(const rpr2::IObserverEngagementReplyIntInstance &interaction);
void onNewEventReport(const rpr2::IObserverEventReportIntInstance &interaction);
void onNewMunitionDetonation(const rpr2::IObserverMunitionDetonationIntInstance &interaction);
void onNewWeaponFire(const rpr2::IObserverWeaponFireIntInstance &interaction);
};
} // namespace
@@ -0,0 +1,263 @@
/**
* @RDE_HEADER@
* NGSConnector class for using DIS protocol
* $Id$
* $HeadURL$
* $Author$
* Created by Hannes Baeuerle, SLSE, 2016-01-28
*/
#include "ngs_connector_dis.h"
#include <IPlayerSOM.h>
#include <IncompleteDISPDUError.h>
// ngs player interfaces
#include <IPlayerHumanObjInstance.h>
#include <IPlayerPhysicalEntityObjInstance.h>
#include <IPlayerAggregateEntityObjInstance.h>
#include <IPlayerGroundVehicleObjInstance.h>
#include <IPlayerAggregateEntityObjInstance.h>
#include <IPlayerHumanObjClass.h>
#include <IPlayerGroundVehicleObjClass.h>
#include <IPlayerAggregateEntityObjClass.h>
#include <SpatialStruct.h>
#include <DimensionStruct.h>
#include <RTIObjectIdStruct.h>
#include <RTIObjectIdArrayStruct.h>
#include <MarkingStruct.h>
#include <WeaponStateEnum32.h>
#include <StanceCodeEnum32.h>
#include <CamouflageEnum32.h>
#include <ForceIdentifierEnum8.h>
#include <TrailingEffectsCodeEnum32.h>
#include <HatchStateEnum32.h>
#include <AggregateStateEnum8.h>
#include <FormationEnum32.h>
#include <ArrayOfArticulatedParameterStructDynamicHLAunpaddedLengthlessVarArray.h>
#include <ArrayOfPropulsionSystemDataStructDynamicHLAlengthlessVarArray.h>
#include <ArrayOfVectoringNozzleSystemDataStructDynamicHLAlengthlessVarArray.h>
#include <ArrayOfSilentAggregateStructDynamicHLAlengthlessVarArray.h>
#include <ArrayOfSilentEntityStructDynamicHLAlengthlessVarArray.h>
#include <ArrayOfVariableDatumStructDynamicHLAlengthlessVarArray.h>
#include <Common/logger.h>
namespace HighLevelArchitecture
{
NgsConnectorDis::NgsConnectorDis(const QString &fedName, MainHandler *mainHandler)
: NgsConnector(fedName, mainHandler)
{}
//bool NgsConnectorDis::addAggregateEntity(const ParticipantInformation &playerData,
// const dds::core::vector<int32_t> &children)
//{
// ERROR_LOG(m_logger) << "AggregateEntities (Unit typeclass) not yet supported with DIS.";
// // TODO: Has to be implemented!
// Q_UNUSED(playerData)
// Q_UNUSED(children)
// return false;
//}
bool NgsConnectorDis::addGroundVehicle(const ParticipantInformation &playerData,
const rpr2::TacticalStatusStruct &state)
{
if (m_participantMap.contains(playerData.id))
return false;
DEBUG_LOG(m_logger) << "addGroundVehicle("
<< playerData.id << ", "
<< playerData.partyId << ", "
<< playerData.entityTypeString << ", "
<< state.TacticalStatus << ")";
rpr2::IPlayerGroundVehicleObjClass &player = m_somPlayer->getPlayerGroundVehicleObjClass();
rpr2::IPlayerGroundVehicleObjInstance *playerInstance = &player.newGroundVehicleObjInstance();
if (!addBaseEntityAttributes(playerInstance, playerData))
return false;
addPhysicalEntityAttributes(playerInstance, playerData, state);
addPlatformEntityAttributes(playerInstance);
m_participantMap.insert(playerData.id, playerInstance);
playerInstance->publish();
return true;
}
bool NgsConnectorDis::addHuman(const ParticipantInformation &playerData,
const rpr2::TacticalStatusStruct &state)
{
if (m_participantMap.contains(playerData.id))
return false;
DEBUG_LOG(m_logger) << "addHuman("
<< playerData.id << ", "
<< playerData.partyId << ", "
<< playerData.entityTypeString << ", "
<< state.TacticalStatus << ")";
rpr2::IPlayerHumanObjClass &player = m_somPlayer->getPlayerHumanObjClass();
rpr2::IPlayerHumanObjInstance *playerInstance = &player.newHumanObjInstance();
if (!addBaseEntityAttributes(playerInstance, playerData))
return false;
addPhysicalEntityAttributes(playerInstance, playerData, state);
addLifeFormEntityAttributes(playerInstance);
m_participantMap.insert(playerData.id, playerInstance);
playerInstance->publish();
return true;
}
bool NgsConnectorDis::addAircraft(const ParticipantInformation &playerData,
const rpr2::TacticalStatusStruct &state)
{
ERROR_LOG(m_logger) << "Aircrafts not yet supported with DIS.";
// TODO: Has to be implemented!
Q_UNUSED(playerData)
Q_UNUSED(state)
return false;
}
//bool NgsConnectorDis::addVessel(const ParticipantInformation &playerData,
// const rpr2::TacticalStatusStruct &state)
//{
// ERROR_LOG(m_logger) << "Vessels not yet supported with DIS.";
// // TODO: Has to be implemented!
// Q_UNUSED(playerData)
// Q_UNUSED(state)
// return false;
//}
bool NgsConnectorDis::addBaseEntityAttributes(rpr2::IPlayerBaseEntityObjInstance *playerInstance,
const ParticipantInformation &partData)
{
IdentifierStruct is = IdentifierStruct::fromInt(partData.externalId);
if (!is.isOwnElement())
{
playerInstance->deleteObjectInstance();
return false;
}
playerInstance->setEntityIdentifier(is.toEIS());
setParticipantPartyId(*playerInstance, partData.id, partData.partyId);
//set world location
rpr2::SpatialStruct ss;
ss.DeadReckoningAlgorithm__A__Alternatives.discriminant(rpr2::DeadReckoningAlgorithmEnum8::Static);
ss.DeadReckoningAlgorithm__A__Alternatives.SpatialStatic().WorldLocation = partData.position.toWorldLocation();
ss.DeadReckoningAlgorithm__A__Alternatives.SpatialStatic().Orientation.Phi = -2.504036;
ss.DeadReckoningAlgorithm__A__Alternatives.SpatialStatic().Orientation.Psi = 1.865257;
ss.DeadReckoningAlgorithm__A__Alternatives.SpatialStatic().Orientation.Theta = -0.103978;
ss.DeadReckoningAlgorithm__A__Alternatives.SpatialStatic().IsFrozen = false;
playerInstance->setSpatial(ss);
rpr2::IPlayerBaseEntityObjInstance *parent = m_participantMap.value(partData.parentId);
rpr2::IPlayerAggregateEntityObjInstance *parentAggregate = dynamic_cast<rpr2::IPlayerAggregateEntityObjInstance *>(parent);
if (parentAggregate)
{
bool bChildFound = false;
rpr2::RTIObjectIdStruct childObjectId;
childObjectId.ID = rpr2::OMT13string(playerInstance->getObjectName());
rpr2::RTIObjectIdArrayStruct children = parentAggregate->getEntityIdentifiers();
for (unsigned int i = 0; i < children.NumberOfObjectIDs__A__ID.size(); ++i)
{
if (children.NumberOfObjectIDs__A__ID[i] == childObjectId)
{
bChildFound = true;
break;
}
}
if (!bChildFound)
{
addOneItemToArray(children.NumberOfObjectIDs__A__ID, childObjectId);
parentAggregate->setEntityIdentifiers(children);
parentAggregate->publish();
}
}
return true;
}
void NgsConnectorDis::addPhysicalEntityAttributes(rpr2::IPlayerPhysicalEntityObjInstance *playerInstance,
const ParticipantInformation &partData,
const rpr2::TacticalStatusStruct &state)
{
DamageModel dm(rpr2::EntityIdentifierStruct(), state);
playerInstance->setDamageState(dm.damageState());
playerInstance->setImmobilized(dm.immobilized());
playerInstance->setFirePowerDisabled(dm.firePowerDisabled());
rpr2::MarkingStruct ms;
fillMarkingStruct(ms, partData.partyId, partData.id);
playerInstance->setMarking(ms);
rpr2::ForceIdentifierEnum8::ET forceId = partyIdToForceIdentifier(partData.partyId);
playerInstance->setForceIdentifier(forceId);
playerInstance->setAcousticSignatureIndex(0);
playerInstance->setAlternateEntityType(rpr2::EntityTypeStruct());
playerInstance->setArticulatedParametersArray(rpr2::ArrayOfArticulatedParameterStructDynamicHLAunpaddedLengthlessVarArray());
playerInstance->setCamouflageType(rpr2::CamouflageEnum32::UniformPaintScheme);
playerInstance->setEngineSmokeOn(false);
playerInstance->setFlamesPresent(false);
playerInstance->setForceIdentifier(rpr2::ForceIdentifierEnum8::Other);
playerInstance->setHasAmmunitionSupplyCap(false);
playerInstance->setHasFuelSupplyCap(false);
playerInstance->setHasRecoveryCap(false);
playerInstance->setHasRepairCap(false);
playerInstance->setInfraredSignatureIndex(0);
playerInstance->setIsConcealed(false);
playerInstance->setLiveEntityMeasuredSpeed(0);
playerInstance->setPowerPlantOn(false);
playerInstance->setPropulsionSystemsData(rpr2::ArrayOfPropulsionSystemDataStructDynamicHLAlengthlessVarArray());
playerInstance->setRadarCrossSectionSignatureIndex(0);
playerInstance->setSmokePlumePresent(false);
playerInstance->setTentDeployed(false);
playerInstance->setTrailingEffectsCode(rpr2::TrailingEffectsCodeEnum32::NoTrail);
playerInstance->setVectoringNozzleSystemData(rpr2::ArrayOfVectoringNozzleSystemDataStructDynamicHLAlengthlessVarArray());
}
void NgsConnectorDis::addLifeFormEntityAttributes(rpr2::IPlayerLifeformObjInstance *playerInstance)
{
playerInstance->setComplianceState(rpr2::ComplianceStateEnum32::Other);
playerInstance->setFlashLightsOn(false);
playerInstance->setPrimaryWeaponState(rpr2::WeaponStateEnum32::Stowed);
playerInstance->setSecondaryWeaponState(rpr2::WeaponStateEnum32::Stowed);
playerInstance->setStanceCode(rpr2::StanceCodeEnum32::UprightStandingStill);
}
void NgsConnectorDis::addPlatformEntityAttributes(rpr2::IPlayerPlatformObjInstance *playerInstance)
{
playerInstance->setAfterburnerOn(false);
playerInstance->setAntiCollisionLightsOn(false);
playerInstance->setBlackOutBrakeLightsOn(false);
playerInstance->setBlackOutLightsOn(false);
playerInstance->setBrakeLightsOn(false);
playerInstance->setFormationLightsOn(false);
playerInstance->setHatchState(rpr2::HatchStateEnum32::NotApplicable);
playerInstance->setHeadLightsOn(false);
playerInstance->setInteriorLightsOn(false);
playerInstance->setLandingLightsOn(false);
playerInstance->setLauncherRaised(false);
playerInstance->setNavigationLightsOn(false);
playerInstance->setRampDeployed(false);
playerInstance->setRunningLightsOn(false);
playerInstance->setSpotLightsOn(false);
playerInstance->setTailLightsOn(false);
}
} // namespace HighLevelArchitecture
@@ -0,0 +1,52 @@
/**
* @RDE_HEADER@
* NGSConnector class for using DIS protocol
* $Id$
* $HeadURL$
* $Author$
* Created by Hannes Baeuerle, SLSE, 2016-01-28
*/
#pragma once
#include "ngsconnector_new.h"
namespace rpr2
{
class IPlayerLifeformObjInstance;
class IPlayerPlatformObjInstance;
// Todo: Remove later:
class TacticalStatusStruct;
class IPlayerBaseEntityObjInstance;
class IPlayerPhysicalEntityObjInstance;
}
namespace HighLevelArchitecture
{
class NgsConnectorDis : public NgsConnector
{
Q_OBJECT
public:
NgsConnectorDis(const QString &fedName, MainHandler *mainHandler);
// bool addAggregateEntity(const ParticipantInformation &playerData,
// const dds::core::vector<int32_t> &children) override;
bool addHuman(const ParticipantInformation &participantData,
const rpr2::TacticalStatusStruct &state) ; //override;
bool addGroundVehicle(const ParticipantInformation &participantData,
const rpr2::TacticalStatusStruct &state) ; // override;
bool addAircraft(const ParticipantInformation &participantData,
const rpr2::TacticalStatusStruct &state) ; // override;
// bool addVessel(const ParticipantInformation &participantData,
// const rpr2::TacticalStatusStruct &state) override;
private:
bool addBaseEntityAttributes(rpr2::IPlayerBaseEntityObjInstance *playerInstance,
const ParticipantInformation &partData);
void addPhysicalEntityAttributes(rpr2::IPlayerPhysicalEntityObjInstance *playerInstance,
const ParticipantInformation &partData,
const rpr2::TacticalStatusStruct &state);
void addLifeFormEntityAttributes(rpr2::IPlayerLifeformObjInstance *playerInstance);
void addPlatformEntityAttributes(rpr2::IPlayerPlatformObjInstance *playerInstance);
};
} // namespace HighLevelArchitecture
+118
View File
@@ -0,0 +1,118 @@
/**
* NgsHandler for HighLevelArchitecture
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2017-04-07
*/
#include "ngs_handler.h"
#include <Common/logger.h>
#include "ngs_connector.h"
#include "socketreader.h"
#include <Common/settings.h>
#include <QCoreApplication>
#include <QHostInfo>
namespace HighLevelArchitecture
{
NgsHandler::NgsHandler(QObject *parent)
: QObject(parent)
, m_ddsHandler(nullptr)
, m_logger(getLogger("NgsHandler"))
{}
NgsHandler::~NgsHandler()
{
m_ppmHandler = nullptr;
m_aesHandler = nullptr;
m_ngsConnector = nullptr;
m_ddsHandler = nullptr;
}
bool NgsHandler::init(const std::shared_ptr<DdsHandler> &ddsHandler)
{
// initialize DDS
m_ddsHandler = ddsHandler;
QMap<ngs::IObserver::ProtocolType, QString> protToStr;
protToStr.insert(ngs::IObserver::ProtocolType::DIS, QStringLiteral("DIS"));
protToStr.insert(ngs::IObserver::ProtocolType::HLA, QStringLiteral("HLA"));
protToStr.insert(ngs::IObserver::ProtocolType::CORBANOTIFY, QStringLiteral("CORBA"));
ngs::IObserver::ProtocolType protocol = Settings::hlaProtocol();
INFO_LOG(m_logger) << "Protocol = " << protToStr.value(protocol, QStringLiteral("UNKNOWN"));
m_ngsConnector = /* (protocol == ngs::IObserver::ProtocolType::DIS) ?
std::make_shared<NgsConnectorDis>(Settings::federationName(), this) : */
std::make_shared<NgsConnector>(Settings::federationName(), this);
connect(m_ngsConnector.get(), &NgsConnector::firstTickFinished,
this, &NgsHandler::onFirstTickFinished, Qt::UniqueConnection);
return m_ngsConnector->initialize(protocol, QHostInfo::localHostName().toUpper(), QCoreApplication::applicationDirPath());
}
bool NgsHandler::isConnectedToHla() const
{
return m_ngsConnector && m_ngsConnector->canPublishData();
}
void NgsHandler::onFirstTickFinished()
{
m_ppmHandler = std::make_shared<PpmHandler>(this);
m_aesHandler = std::make_shared<AesHandler>(this);
if (!m_ppmHandler->init())
ERROR_LOG(m_logger) << "Could not init ppm handler - not able to publish participants to HLA";
if (!m_aesHandler->init())
ERROR_LOG(m_logger) << "Could not init ppm handler - not able to publish area effect simulations to HLA";
connect(m_ppmHandler.get(), &PpmHandler::externalEquipmentNumberAdded,
this, &NgsHandler::externalEquipmentNumberAdded);
connect(m_ppmHandler.get(), &PpmHandler::externalEquipmentNumberRemoved,
this, &NgsHandler::externalEquipmentNumberRemoved);
connect(this, &NgsHandler::participantInitRequest, m_ppmHandler.get(), &PpmHandler::participantInitRequest);
connect(this, &NgsHandler::participantVulnerabilityStateRequest, m_ppmHandler.get(), &PpmHandler::participantVulnerabilityStateRequest);
connect(this, &NgsHandler::participantCesHitInformationRequest, m_ppmHandler.get(), &PpmHandler::participantCesHitInformationRequest);
initSocketReaders();
}
void NgsHandler::initSocketReaders()
{
if (!m_socketReaders.isEmpty())
deInitSocketReaders();
for (const Settings::SocketData& sd : Settings::socketDataList())
{
SocketReader *sr = new SocketReader();
if ( sr->init(sd.hostname, sd.port, sd.hlaRequestIdentifier) )
{
sr->start();
connect(sr, &SocketReader::newData, this, &NgsHandler::onNewSocketReaderData);
m_socketReaders.append(sr);
INFO_LOG(m_logger) << "SocketReader with ID " << sd.hlaRequestIdentifier << " connected";
}
else
{
ERROR_LOG(m_logger) << "Could not initialize SocketReader " << sd.hlaRequestIdentifier;
}
}
}
void NgsHandler::deInitSocketReaders()
{
for (SocketReader *sr : qAsConst(m_socketReaders))
sr->stopThread(); // calls deleteLater(), therefore we can
m_socketReaders.clear(); // drop the pointers here
}
void NgsHandler::onNewSocketReaderData(const QByteArray &data, int hlaRequestIdentifier)
{
// Todo: Statically sending to to IDT now. Map this by Reader-Instance and RequestIdentifier later?
m_ngsConnector->sendData(Settings::hlaPlayerIdIDT(), data, hlaRequestIdentifier);
}
} // namespace HighLevelArchitecture
+67
View File
@@ -0,0 +1,67 @@
/**
* MainHandler for HighLevelArchitecture
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2017-04-07
*/
#pragma once
#include <QObject>
#include <memory>
#include "dds_handler.h"
#include "ppm_handler.h"
#include "aes_handler.h"
#include "ngs_handler.h"
#include <Common/logger.h>
#include <TrainingAreaBase/training_area_telegrams.h>
namespace HighLevelArchitecture
{
class SocketReader;
class NgsHandler : public QObject
{
Q_OBJECT
public:
explicit NgsHandler(QObject *parent = nullptr);
~NgsHandler();
bool init(const std::shared_ptr<DdsHandler> &ddsHandler);
std::shared_ptr<DdsHandler> ddsHandler() const { return m_ddsHandler; }
std::shared_ptr<NgsConnector> ngsConnector() const { return m_ngsConnector; }
std::shared_ptr<PpmHandler> ppmHandler() const { return m_ppmHandler; }
std::shared_ptr<AesHandler> aesHandler() const { return m_aesHandler; }
bool isConnectedToHla() const;
Q_SIGNALS:
// HLA -> TAB
void externalEquipmentNumberAdded(int equipNo);
void externalEquipmentNumberRemoved(int equipNo);
// TAB -> HLA
void participantInitRequest(const TrainingAreaBase::TetraIcd::Init &request);
void participantVulnerabilityStateRequest(const TrainingAreaBase::TetraIcd::DemandVulnerabilityStateChange &request);
void participantCesHitInformationRequest(const TrainingAreaBase::TetraIcd::CesHitInformation &request);
private slots:
void onFirstTickFinished();
// SocketReader -> HLA
void onNewSocketReaderData(const QByteArray &data, int hlaRequestIdentifier);
private:
void initSocketReaders();
void deInitSocketReaders();
std::shared_ptr<DdsHandler> m_ddsHandler;
std::shared_ptr<PpmHandler> m_ppmHandler;
std::shared_ptr<AesHandler> m_aesHandler;
std::shared_ptr<NgsConnector> m_ngsConnector;
QList<SocketReader *> m_socketReaders;
LOGGER_T m_logger;
};
} // namespace HighLevelArchitecture
File diff suppressed because it is too large. Load diff
+147
View File
@@ -0,0 +1,147 @@
/**
* Send Participant data to NGS
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2017-04-07
*/
#pragma once
#include <QObject>
#include <QSet>
#include <ParticipantManagement/ppm_dtc.h>
#include <ParticipantManagement/ppm_ftc.h>
#include <ProjectDataManagement/pdm_dtc.h>
#include <AreaEffectSimulation/aes_dtc.h>
#include <Proxies/TrainingAreaBase/tab_dts.h>
#include <Proxies/TrainingAreaBase/tab_dtc.h>
#include <Proxies/TrainingAreaBase/tab_ftc.h>
#include <DetonationResultCodeEnum8.h>
#include <TrainingAreaBase/training_area_telegrams.h>
#include "ngs_connector.h"
#include <Common/logger.h>
namespace LtsUtils {
class RequestHelper;
}
namespace HighLevelArchitecture
{
class NgsHandler;
class PpmHandler : public QObject
, protected ParticipantManagement::Interface::Ftc::ModifyParticipantDataReplyHandler
, protected TrainingAreaBase::Interface::Ftc::DemandVulnerabilityStateChangeReplyHandler
, protected TrainingAreaBase::Interface::Ftc::DemandInitReplyHandler
, protected TrainingAreaBase::Interface::Ftc::SendCesHitInformationReplyHandler
{
Q_OBJECT
public:
explicit PpmHandler(NgsHandler *ngsHandler);
~PpmHandler();
bool init();
ParticipantManagement::Role roleForPartyId(int partyId);
ProjectDataManagement::ChargeType chargeTypeFromId(int chargeTypeId);
ProjectDataManagement::ChargeType chargeTypeFromDisEntity(const std::string &disEntity);
ProjectDataManagement::ChargeType chargeTypeFromDisEntity(const QString &disEntity) { return chargeTypeFromDisEntity(disEntity.toStdString()); }
ProjectDataManagement::ChargeType chargeTypeFromTasCodeDirect(int32_t tasCode);
int gearTypeIdFromChargeTypeId(int chargeTypeId);
int partyIdFromForceIdentifier(rpr2::ForceIdentifierEnum8::ET fi);
rpr2::ForceIdentifierEnum8::ET forceIdentifierFromPartyId(int partyId);
void onModifyParticipantDataReply(const Core::FunctionReplyObject &replyObject) override final;
void onDemandInitReply(const Core::FunctionReplyObject &reply) override final;
void onDemandVulnerabilityStateChangeReply(const Core::FunctionReplyObject &reply) override final;
void onSendCesHitInformationReply(const Core::FunctionReplyObject &reply) override final;
QMap<int, int> externalEquipmentNumbers() const { return m_externalEquipmentNumbers; }
Q_SIGNALS:
void externalEquipmentNumberAdded(int equipNo);
void externalEquipmentNumberRemoved(int equipNo);
private Q_SLOTS:
void onTypeChanged(const ParticipantManagement::Type &data, DataModification modType);
void onDynamicParticipantDataChanged(const ParticipantManagement::DynamicParticipantData &data, DataModification modType);
void onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType);
void onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &data, DataModification modType);
void onPartyChanged(const ParticipantManagement::Party &data, DataModification modType);
void onChargeTypeChanged(const ProjectDataManagement::ChargeType &data, DataModification modType);
void onSpatialChanged(int eqId, const ParticipantPosition &pos, qint64 simTimeMSecs);
bool onMarkingChanged(int eqId, const QString &marking, qint64 simTimeMSecs);
void onParticipantHit(const GuezHitStruct &hitStruct);
void onParticipantInit(int eqNo, bool resetManipulation, bool resupplyAmmo, bool resetVulnerabilityState);
void onParticipantCesHit(const TrainingAreaBase::SendCesHitInformation &request);
bool onExconEngagement(int eqNo, const ProjectDataManagement::VulnerabilityState &state);
void onWeaponFire(const TrainingAreaBase::EquipmentGearEvent &event);
void onGearChargeState(const TrainingAreaBase::EquipmentGearChargeState &event);
void onGearAssignment(const TrainingAreaBase::EquipmentGearAssignment &event);
void onEquipmentState(const TrainingAreaBase::EquipmentState &event);
void onSensorDataChanged(const TrainingAreaBase::SpecialSensorData &event);
void onLaserDesignation(const TrainingAreaBase::LaserDesignation &request);
void startPublishToNgs();
public slots:
void participantInitRequest(const TrainingAreaBase::TetraIcd::Init &request);
void participantVulnerabilityStateRequest(const TrainingAreaBase::TetraIcd::DemandVulnerabilityStateChange &request);
void participantCesHitInformationRequest(const TrainingAreaBase::TetraIcd::CesHitInformation &request);
private:
void createParticipant(const ParticipantManagement::Participant &participant);
bool createHuman(const ParticipantManagement::Participant &participant);
bool createGroundVehicle(const ParticipantManagement::Participant &participant);
bool createAircraft(const ParticipantManagement::Participant &participant);
bool createObserverController(const ParticipantManagement::Participant &participant);
bool removeParticipant(const ParticipantManagement::Participant &participant);
ParticipantManagement::StateInformation currentParticipantStateInformation(int participantId) const;
static ParticipantManagement::StateInformation currentParticipantStateInformation(const ParticipantManagement::DynamicParticipantData &data);
dds::core::vector<ParticipantManagement::GearInformation> currentParticipantGearInformation(int participantId) const;
dds::core::vector<ParticipantManagement::ManipulationInformation> currentParticipantManipulationInformation(int participantId) const;
ProjectDataManagement::VulnerabilityState currentVulnerabilityState(int participantId) const;
ParticipantPosition getParticipantPosition(int participantId) const;
int getEquipmentNo(int participantId) const;
int getParticipantIdByExternalId(int externalId) const;
rpr2::ForceIdentifierEnum8::ET getRprForceIdentifierFromPpmForceIdentifier(const ParticipantManagement::HlaForceIdentifierEnum &ppmForceIdentifier) const;
ParticipantManagement::Type getParticipantType(int typeId);
TypeStruct getTypestruct(int typeId);
static rpr2::DetonationResultCodeEnum8::ET rpr2DetonationResultFromVulnerabilityState(TrainingAreaBase::TetraIcd::VulnerabilityState vulnerabilityState);
static rpr2::DetonationResultCodeEnum8::ET rpr2DetonationResultFromPercentage(int percentage);
private:
NgsHandler *m_ngsHandler;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtcPpm;
std::shared_ptr<ParticipantManagement::Interface::Ftc> m_ftcPpm;
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_dtcPdm;
std::shared_ptr<TrainingAreaBase::Interface::Dts> m_dtsTab;
std::shared_ptr<TrainingAreaBase::Interface::Ftc> m_ftcTab;
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_dtcAes;
QMap<int, ParticipantManagement::Type> m_types; // By typeId
QMap<int, ParticipantManagement::DynamicParticipantData> m_dynPartData; // By participantId
QMap<int, ParticipantManagement::Participant> m_partData; // By participantId
QMap<int, int> m_externalEquipmentNumbers; // participantId, equipmentNumber
QMap<int, ParticipantManagement::ParticipantPosition> m_partPosData; // By participantId -- Positions for own Players
QMap<int, ParticipantManagement::Party> m_partyData; // By partyId
QMap<int, TrainingAreaBase::EquipmentPosition> m_observerPositions; // By equipmentNo -- Only foreign entities
QMap<int, int> m_isMountedOn; // By equipmentNo of mounted participant. Value = Host
QSet<int> m_createdParticipantIds;
LtsUtils::RequestHelper *m_requestHelper;
QMap<int, ProjectDataManagement::ChargeType> m_chargeTypes;
QMap<qint32, ProjectDataManagement::GearTypeChargeType> m_gearTypeChargeTypes;
NGL::INGLLogger &m_logger;
};
} // namespace HighLevelArchitecture
+24
View File
@@ -0,0 +1,24 @@
// $Revision$
// $Date$
// $Id$
#pragma once
#include <DamageStatusEnum32.h>
#include <EntityTypeStruct.h>
#include <QtCore/QMetaType>
#include <QtCore/QHash>
Q_DECLARE_METATYPE(rpr2::DamageStatusEnum32::ET)
namespace rpr2
{
inline uint qHash(const rpr2::EntityTypeStruct &ets)
{
// da es genau 64 belegte Bits sind, geht es so am einfachsten
const quint64 *val = reinterpret_cast<const quint64 *>(&ets);
return ::qHash(*val);
}
}
@@ -0,0 +1,32 @@
/**
* Handle WeaponFire Events
* $Id$
* $HeadURL$
* $Author$
*/
#include "rpr_ia_actionrequest.h"
// rpr2 data types
#include <EventIdentifierStruct.h>
#include <EntityTypeStruct.h>
/*
* ObserverActionRequestCBNotifier
*/
ObserverActionRequestCBNotifier::ObserverActionRequestCBNotifier()
: rpr2::IObserverActionRequestIntClassCB()
, m_logger(HighLevelArchitecture::getLogger("Callbacks.Interaction.ActionRequest"))
{}
void ObserverActionRequestCBNotifier::newActionRequestIntInstance(const rpr2::IObserverActionRequestIntInstance &interaction)
{
emit newActionRequest(interaction);
}
void ObserverActionRequestCBNotifier::deleteInterface()
{
DEBUG_LOG(m_logger) << "Delete Interface";
//rpr2::IObserverActionRequestIntClassCB::deleteInterface();
}
@@ -0,0 +1,39 @@
/**
* Handle EventReport Events
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "rpr_global.h"
#include <IObserverActionRequestIntClassCB.h>
#include <IObserverActionRequestIntInstance.h>
#include <QObject>
#include <Common/logger.h>
/**
* The notifier for new action requests
*/
class ObserverActionRequestCBNotifier : public QObject, public rpr2::IObserverActionRequestIntClassCB
{
Q_OBJECT
public:
ObserverActionRequestCBNotifier();
void newActionRequestIntInstance(const rpr2::IObserverActionRequestIntInstance &interaction) override;
void deleteInterface() override;
protected:
NGL::INGLLogger &m_logger;
signals:
// Action requests only come in, when ICE wants to reset/resurrect our players. This is not implemented.
void newActionRequest(const rpr2::IObserverActionRequestIntInstance &interaction);
};
@@ -0,0 +1,32 @@
/**
* Handle WeaponFire Events
* $Id$
* $HeadURL$
* $Author$
*/
#include "rpr_ia_data.h"
// rpr2 data types
#include <EventIdentifierStruct.h>
#include <EntityTypeStruct.h>
/*
* ObserverDataCBNotifier
*/
ObserverDataCBNotifier::ObserverDataCBNotifier()
: rpr2::IObserverDataIntClassCB()
, m_logger(HighLevelArchitecture::getLogger("Callbacks.Interaction.Data"))
{}
void ObserverDataCBNotifier::newDataIntInstance(const rpr2::IObserverDataIntInstance &interaction)
{
emit newData(interaction);
}
void ObserverDataCBNotifier::deleteInterface()
{
DEBUG_LOG(m_logger) << "Delete Interface";
//rpr2::IObserverDataIntClassCB::deleteInterface();
}
+39
View File
@@ -0,0 +1,39 @@
/**
* Handle Data Events
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "rpr_global.h"
#include <IObserverDataIntClassCB.h>
#include <IObserverDataIntInstance.h>
#include <QObject>
#include <Common/logger.h>
/**
* The notifier for new action requests
*/
class ObserverDataCBNotifier : public QObject, public rpr2::IObserverDataIntClassCB
{
Q_OBJECT
public:
ObserverDataCBNotifier();
void newDataIntInstance(const rpr2::IObserverDataIntInstance &interaction) override;
void deleteInterface() override;
protected:
NGL::INGLLogger &m_logger;
signals:
// This is only emitted, when ICE sends data to us. This is not the case ever.
void newData(const rpr2::IObserverDataIntInstance &interaction);
};
@@ -0,0 +1,33 @@
/**
* Handle WeaponFire Events
* $Id$
* $HeadURL$
* $Author$
*/
#include "rpr_ia_engagementreply.h"
// rpr2 data types
#include <EventIdentifierStruct.h>
#include <EntityTypeStruct.h>
#include <WorldLocationStruct.h>
/*
* ObserverWeaponFireCBNotifier
*/
ObserverEngagementReplyCBNotifier::ObserverEngagementReplyCBNotifier()
: rpr2::IObserverEngagementReplyIntClassCB()
, m_logger(HighLevelArchitecture::getLogger("Callbacks.Interaction.EngagementReply"))
{}
void ObserverEngagementReplyCBNotifier::newEngagementReplyIntInstance(const rpr2::IObserverEngagementReplyIntInstance &interaction)
{
emit newEngagementReply(interaction);
}
void ObserverEngagementReplyCBNotifier::deleteInterface()
{
DEBUG_LOG(m_logger) << "Delete Interface";
//rpr2::IObserverEngagementReplyIntClassCB::deleteInterface();
}
@@ -0,0 +1,38 @@
/**
* Handle WeaponFire Events
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "rpr_global.h"
#include <IObserverEngagementReplyIntClassCB.h>
#include <IObserverEngagementReplyIntInstance.h>
#include <QObject>
#include <Common/logger.h>
/**
* The notifier for new action requests
*/
class ObserverEngagementReplyCBNotifier : public QObject, public rpr2::IObserverEngagementReplyIntClassCB
{
Q_OBJECT
public:
ObserverEngagementReplyCBNotifier();
void newEngagementReplyIntInstance(const rpr2::IObserverEngagementReplyIntInstance &interaction) override;
void deleteInterface() override;
protected:
NGL::INGLLogger &m_logger;
signals:
void newEngagementReply(const rpr2::IObserverEngagementReplyIntInstance &interaction);
};
@@ -0,0 +1,32 @@
/**
* Handle WeaponFire Events
* $Id$
* $HeadURL$
* $Author$
*/
#include "rpr_ia_eventreport.h"
// rpr2 data types
#include <EventIdentifierStruct.h>
#include <EntityTypeStruct.h>
/*
* ObserverWeaponFireCBNotifier
*/
ObserverEventReportCBNotifier::ObserverEventReportCBNotifier()
: rpr2::IObserverEventReportIntClassCB()
, m_logger(HighLevelArchitecture::getLogger("Callbacks.Interaction.EventReport"))
{}
void ObserverEventReportCBNotifier::newEventReportIntInstance(const rpr2::IObserverEventReportIntInstance &interaction)
{
emit newEventReport(interaction);
}
void ObserverEventReportCBNotifier::deleteInterface()
{
DEBUG_LOG(m_logger) << "Delete Interface";
//rpr2::IObserverEventReportIntClassCB::deleteInterface();
}
@@ -0,0 +1,38 @@
/**
* Handle EventReport Events
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "rpr_global.h"
#include <IObserverEventReportIntClassCB.h>
#include <IObserverEventReportIntInstance.h>
#include <QObject>
#include <Common/logger.h>
/**
* The notifier for new action requests
*/
class ObserverEventReportCBNotifier : public QObject, public rpr2::IObserverEventReportIntClassCB
{
Q_OBJECT
public:
ObserverEventReportCBNotifier();
void newEventReportIntInstance(const rpr2::IObserverEventReportIntInstance &interaction) override;
void deleteInterface() override;
protected:
NGL::INGLLogger &m_logger;
signals:
void newEventReport(const rpr2::IObserverEventReportIntInstance &interaction);
};
@@ -0,0 +1,27 @@
/**
* Handle MunitionDetonation Events
* $Id$
* $HeadURL$
* $Author$
*/
#include "rpr_ia_munitiondetonation.h"
/*
* ObserverMunitionDetonationCBNotifier
*/
ObserverMunitionDetonationCBNotifier::ObserverMunitionDetonationCBNotifier()
: rpr2::IObserverMunitionDetonationIntClassCB()
, m_logger(HighLevelArchitecture::getLogger("Callbacks.Interaction.MunitionDetonation"))
{}
void ObserverMunitionDetonationCBNotifier::newMunitionDetonationIntInstance(const rpr2::IObserverMunitionDetonationIntInstance &interaction)
{
emit newMunitionDetonation(interaction);
}
void ObserverMunitionDetonationCBNotifier::deleteInterface()
{
DEBUG_LOG(m_logger) << "Delete Interface";
//rpr2::IObserverMunitionDetonationCBNotifier::deleteInterface();
}
@@ -0,0 +1,37 @@
/**
* Handle MunitionDetonation Events
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "rpr_global.h"
#include <IObserverMunitionDetonationIntClassCB.h>
#include <IObserverMunitionDetonationIntInstance.h>
#include <QtCore/QObject>
#include <Common/logger.h>
/**
* The notifier for new munition detonation requests
*/
class ObserverMunitionDetonationCBNotifier : public QObject, public rpr2::IObserverMunitionDetonationIntClassCB
{
Q_OBJECT
public:
ObserverMunitionDetonationCBNotifier();
void newMunitionDetonationIntInstance(const rpr2::IObserverMunitionDetonationIntInstance &interaction) override;
void deleteInterface() override;
protected:
NGL::INGLLogger &m_logger;
signals:
void newMunitionDetonation(const rpr2::IObserverMunitionDetonationIntInstance &interaction);
};
@@ -0,0 +1,33 @@
/**
* Handle WeaponFire Events
* $Id$
* $HeadURL$
* $Author$
*/
#include "rpr_ia_weaponfire.h"
// rpr2 data types
#include <EventIdentifierStruct.h>
#include <EntityTypeStruct.h>
#include <WorldLocationStruct.h>
/*
* ObserverWeaponFireCBNotifier
*/
ObserverWeaponFireCBNotifier::ObserverWeaponFireCBNotifier()
: rpr2::IObserverWeaponFireIntClassCB()
, m_logger(HighLevelArchitecture::getLogger("Callbacks.Interaction.WeaponFire"))
{}
void ObserverWeaponFireCBNotifier::newWeaponFireIntInstance(const rpr2::IObserverWeaponFireIntInstance &interaction)
{
emit newWeaponFire(interaction);
}
void ObserverWeaponFireCBNotifier::deleteInterface()
{
DEBUG_LOG(m_logger) << "Delete Interface";
//rpr2::IObserverMunitionDetonationIntClassCB::deleteInterface();
}
@@ -0,0 +1,38 @@
/**
* Handle WeaponFire Events
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "rpr_global.h"
#include <IObserverWeaponFireIntClassCB.h>
#include <IObserverWeaponFireIntInstance.h>
#include <QObject>
#include <Common/logger.h>
/**
* The notifier for new action requests
*/
class ObserverWeaponFireCBNotifier : public QObject, public rpr2::IObserverWeaponFireIntClassCB
{
Q_OBJECT
public:
ObserverWeaponFireCBNotifier();
void newWeaponFireIntInstance(const rpr2::IObserverWeaponFireIntInstance &interaction) override;
void deleteInterface() override;
protected:
NGL::INGLLogger &m_logger;
signals:
void newWeaponFire(const rpr2::IObserverWeaponFireIntInstance &interaction);
};
@@ -0,0 +1,19 @@
/**
* class to handle signals for ObserverAircrafts functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "rpr_observer_platform_object_cb.h"
class ObserverAircraftObjectCB : public ObserverPlatformObjectCB
{
Q_OBJECT
public:
ObserverAircraftObjectCB(const char *loggerName = "Callbacks.Object.Aircraft")
: ObserverPlatformObjectCB(loggerName)
{}
};
@@ -0,0 +1,47 @@
/**
* template class to handle IObserverAircraftObjInstanceCB functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <IObserverAircraftObjClassCB.h>
#include <IObserverAircraftObjInstance.h>
#include <IObserverAircraftObjInstanceCB.h>
#include "rpr_observer_platform_object_instance_cb.h"
class ObserverAircraftObjectCB;
template<typename IOBJ_CB, typename OBJ, typename OBJ_CB>
class ObserverAircraftObjInstanceCB : public ObserverPlatformObjInstanceCB<IOBJ_CB, OBJ, OBJ_CB>
{
public:
explicit ObserverAircraftObjInstanceCB(OBJ_CB &hoicb, const char *loggerName = "Callbacks.Object.Aircraft")
: ObserverPlatformObjInstanceCB<IOBJ_CB, OBJ, OBJ_CB>(hoicb, loggerName)
{}
void changedAfterburnerOn(bool) override {}
void changedAntiCollisionLightsOn(bool) override {}
void changedBlackOutBrakeLightsOn(bool) override {}
void changedBlackOutLightsOn(bool) override {}
void changedBrakeLightsOn(bool) override {}
void changedFormationLightsOn(bool) override {}
void changedHatchState(rpr2::HatchStateEnum32::ET) override {}
void changedHeadLightsOn(bool) override {}
void changedInteriorLightsOn(bool) override {}
void changedLandingLightsOn(bool) override {}
void changedLauncherRaised(bool) override {}
void changedNavigationLightsOn(bool) override {}
void changedRampDeployed(bool) override {}
void changedRunningLightsOn(bool) override {}
void changedSpotLightsOn(bool) override {}
void changedTailLightsOn(bool) override {}
};
using ObserverAircraftObjInstanceCBType = ObserverAircraftObjInstanceCB<rpr2::IObserverAircraftObjInstanceCB,
rpr2::IObserverAircraftObjInstance,
ObserverAircraftObjectCB>;
@@ -0,0 +1,56 @@
/**
* class to handle signals for ObserverBaseEntities functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "rpr_observer_object_cb.h"
#include <EntityIdentifierStruct.h>
namespace rpr2
{
class WorldLocationStruct;
}
class ObserverBaseEntityObjectCB : public ObserverObjectCB
{
Q_OBJECT
public:
ObserverBaseEntityObjectCB(const char *loggerName = "Callbacks.Object.BaseEntity")
: ObserverObjectCB(loggerName)
{}
void onEntityIdentifierChanged(const rpr2::EntityIdentifierStruct &eis, rpr2::IObserverBaseEntityObjInstance &object, const ngs::SimTime &simTime)
{
INFO_LOG(m_logger) << "EntityIdentifier changed for Base Entity Object. New EntityIdentifier: "
<< eis.FederateIdentifier.SiteID << "/"
<< eis.FederateIdentifier.ApplicationID << "/"
<< eis.EntityNumber;
emit entityIdentifierChanged(eis, &object, simTime.getSeconds() * 1000ULL + simTime.getMicroSeconds() / 1000ULL);
}
void onSpatialChanged(const rpr2::EntityIdentifierStruct &eis, const rpr2::WorldLocationStruct &wl, const ngs::SimTime &simTime)
{
emit spatialChanged(eis, wl, simTime.getSeconds() * 1000ULL + simTime.getMicroSeconds() / 1000ULL);
}
void onEntityTypeChanged(const rpr2::EntityIdentifierStruct &eis, const rpr2::EntityTypeStruct &ets, const ngs::SimTime &simTime)
{
emit entityTypeChanged(eis, ets, simTime.getSeconds() * 1000ULL + simTime.getMicroSeconds() / 1000ULL);
}
void onIsPartOfChanged(const rpr2::EntityIdentifierStruct &eis, const rpr2::IsPartOfStruct &ipos, const ngs::SimTime &simTime)
{
emit isPartOfChanged(eis, ipos, simTime.getSeconds() * 1000ULL + simTime.getMicroSeconds() / 1000ULL);
}
Q_SIGNALS:
void entityIdentifierChanged(const rpr2::EntityIdentifierStruct &eis, rpr2::IObserverBaseEntityObjInstance *object, qint64 simTimeMSecs);
void spatialChanged(const rpr2::EntityIdentifierStruct &eis, const rpr2::WorldLocationStruct &wl, qint64 simTimeMSecs);
void entityTypeChanged(const rpr2::EntityIdentifierStruct &eis, const rpr2::EntityTypeStruct &ets, qint64 simTimeMSecs);
void isPartOfChanged(const rpr2::EntityIdentifierStruct &eis, const rpr2::IsPartOfStruct &ipos, qint64 simTimeMSecs);
};
@@ -0,0 +1,133 @@
/**
* template class to handle IObserverBaseEntityObjInstanceCB functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <IObserverBaseEntityObjInstanceCB.h>
#include <EntityIdentifierStruct.h>
#include <SpatialStruct.h>
#include <WorldLocationStruct.h>
#include <NGSUtils/SimTime.h>
#include "rpr_observer_object_instance_cb.h"
template<typename IOBJ_CB, typename OBJ, typename OBJ_CB>
class ObserverBaseEntityObjInstanceCB : public ObserverObjectInstanceCB<IOBJ_CB, OBJ, OBJ_CB>
{
public:
explicit ObserverBaseEntityObjInstanceCB(OBJ_CB &hoicb, const char *loggerName = "Callbacks.Object.BaseEntity")
: ObserverObjectInstanceCB<IOBJ_CB, OBJ, OBJ_CB>(hoicb, loggerName)
{}
//
// IObserverObjectInstanceCallback
//
void changedSpatial(const rpr2::SpatialStruct &data) override
{
if (!this->m_pIObject->isValidEntityType())
return;
rpr2::DeadReckoningAlgorithmEnum8::ET d = data.DeadReckoningAlgorithm__A__Alternatives.discriminant();
switch (d)
{
case rpr2::DeadReckoningAlgorithmEnum8::Other:
// nothing
break;
case rpr2::DeadReckoningAlgorithmEnum8::Static:
{
rpr2::WorldLocationStruct wl = data.DeadReckoningAlgorithm__A__Alternatives.SpatialStatic().WorldLocation;
try
{
//Bei anderen Projekten muss ein Mapping stattfinden. Dies wird jetzt im NGSInterface erledigt.
//m_pCB->onSpatialChanged(m_pIObject->getEntityIdentifier().EntityNumber, wl, simTimeMSecs);
this->m_pCB->onSpatialChanged(this->m_pIObject->getEntityIdentifier(), wl, this->m_pIObject->getLatestTimeStamp());
}
catch (...)
{
ERROR_LOG(this->m_logger) << "Human-Callback threw Exception in 'newTlnPos()";
}
break;
}
case rpr2::DeadReckoningAlgorithmEnum8::DRM_FPW:
{
rpr2::WorldLocationStruct wl = data.DeadReckoningAlgorithm__A__Alternatives.SpatialFPW().WorldLocation;
try
{
this->m_pCB->onSpatialChanged(this->m_pIObject->getEntityIdentifier(), wl, this->m_pIObject->getLatestTimeStamp());
}
catch (...)
{
ERROR_LOG(this->m_logger) << "Human-Callback threw Exception in 'newTlnPos()";
}
break;
}
case rpr2::DeadReckoningAlgorithmEnum8::DRM_RPW:
DEBUG_LOG(this->m_logger) << "ObserverHumanObjInstanceCB::changedSpatial, case rpr2::DeadReckoningAlgorithmEnum8::DRM_RPW";
break;
case rpr2::DeadReckoningAlgorithmEnum8::DRM_RVW:
DEBUG_LOG(this->m_logger) << "ObserverHumanObjInstanceCB::changedSpatial, case rpr2::DeadReckoningAlgorithmEnum8::DRM_RVW";
break;
case rpr2::DeadReckoningAlgorithmEnum8::DRM_FVW:
DEBUG_LOG(this->m_logger) << "ObserverHumanObjInstanceCB::changedSpatial, case rpr2::DeadReckoningAlgorithmEnum8::DRM_FVW";
break;
case rpr2::DeadReckoningAlgorithmEnum8::DRM_FPB:
DEBUG_LOG(this->m_logger) << "ObserverHumanObjInstanceCB::changedSpatial, case rpr2::DeadReckoningAlgorithmEnum8::DRM_FPB";
break;
case rpr2::DeadReckoningAlgorithmEnum8::DRM_RPB:
DEBUG_LOG(this->m_logger) << "ObserverHumanObjInstanceCB::changedSpatial, case rpr2::DeadReckoningAlgorithmEnum8::DRM_RPB";
break;
case rpr2::DeadReckoningAlgorithmEnum8::DRM_RVB:
DEBUG_LOG(this->m_logger) << "ObserverHumanObjInstanceCB::changedSpatial, case rpr2::DeadReckoningAlgorithmEnum8::DRM_RVB";
break;
case rpr2::DeadReckoningAlgorithmEnum8::DRM_FVB:
DEBUG_LOG(this->m_logger) << "ObserverHumanObjInstanceCB::changedSpatial, case rpr2::DeadReckoningAlgorithmEnum8::DRM_FVB";
break;
}
}
void receivedSpatial(const rpr2::SpatialStruct &, const ngs::SimTime &simTime) override
{
m_lastPositionTime = simTime;
}
void changedEntityIdentifier(const rpr2::EntityIdentifierStruct &data) override
{
if (!this->m_pIObject->isValidEntityType())
{
ERROR_LOG(this->m_logger) << "No valid Entity.";
return;
}
this->m_pCB->onEntityIdentifierChanged(data, *this->m_pIObject, this->m_pIObject->getLatestTimeStamp());
}
void changedEntityType(const rpr2::EntityTypeStruct &value) override
{
if (!this->m_pIObject->isValidEntityType())
return;
this->m_pCB->onEntityTypeChanged(this->m_pIObject->getEntityIdentifier(),
value,
this->m_pIObject->getLatestTimeStamp());
}
void changedIsPartOf(const rpr2::IsPartOfStruct &value) override
{
if (!this->m_pIObject->isValidEntityType())
return;
this->m_pCB->onIsPartOfChanged(this->m_pIObject->getEntityIdentifier(),
value,
this->m_pIObject->getLatestTimeStamp());
}
// Declarations for pure virtual functions
void changedRelativeSpatial(const rpr2::SpatialStruct &) override {}
protected:
ngs::SimTime m_lastPositionTime;
};
@@ -0,0 +1,33 @@
/**
* A notifier to inform NGSConnector about changes in an Designator instance
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "rpr_global.h"
#include "rpr_observer_designator_object_cb.h"
#include "rpr_observer_designator_object_instance_cb.h"
/**
* The notifier for new Designator instances
*/
class ObserverDesignatorCBNotifier : public ObserverDesignatorObjectCB, public rpr2::IObserverDesignatorObjClassCB
{
Q_OBJECT
public:
ObserverDesignatorCBNotifier()
: ObserverDesignatorObjectCB("Callbacks.Object.Designator")
, rpr2::IObserverDesignatorObjClassCB()
{}
//Abstract functions realized from IObserverDesignatorObjClassCB
rpr2::IObserverDesignatorObjInstanceCB &newDesignatorObjInstance(rpr2::IObserverDesignatorObjInstance &object) override
{
return newObjectInstance<ObserverDesignatorObjInstanceCBType>(object);
}
void deleteInterface() override {}
};
@@ -0,0 +1,44 @@
/**
* class to handle signals for ObserverDesignators functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "rpr_observer_embeddedsystem_object_cb.h"
#include <DesignatorCodeEnum16.h>
class ObserverDesignatorObjectCB : public ObserverEmbeddedSystemObjectCB
{
Q_OBJECT
public:
ObserverDesignatorObjectCB(const char *loggerName = "Callbacks.Object.Designator")
: ObserverEmbeddedSystemObjectCB(loggerName)
{}
void onDesignatorCodeChanged(const rpr2::EntityIdentifierStruct &eis, rpr2::DesignatorCodeEnum16::ET value, const ngs::SimTime &simTime)
{
DEBUG_LOG(m_logger) << "Code changed: " << value;
emit designatorCodeChanged(eis, value, simTime.getSeconds() * 1000ULL + simTime.getMicroSeconds() / 1000ULL);
}
void onDesignatorOutputPowerChanged(const rpr2::EntityIdentifierStruct &eis, ngs::FLOAT32 value, const ngs::SimTime &simTime)
{
DEBUG_LOG(m_logger) << "Output Power changed: " << value;
emit designatorOutputPowerChanged(eis, value, simTime.getSeconds() * 1000ULL + simTime.getMicroSeconds() / 1000ULL);
}
void onDesignatorSpotLocationChanged(const rpr2::EntityIdentifierStruct &eis, const rpr2::WorldLocationStruct &value, const ngs::SimTime &simTime)
{
DEBUG_LOG(m_logger) << "Spot Location changed (not printed)";
emit designatorSpotLocationChanged(eis, value, simTime.getSeconds() * 1000ULL + simTime.getMicroSeconds() / 1000ULL);
}
Q_SIGNALS:
void designatorCodeChanged(const rpr2::EntityIdentifierStruct &eis, rpr2::DesignatorCodeEnum16::ET value, qint64 simTimeMSecs);
void designatorOutputPowerChanged(const rpr2::EntityIdentifierStruct &eis, ngs::FLOAT32 value, qint64 simTimeMSecs);
void designatorSpotLocationChanged(const rpr2::EntityIdentifierStruct &eis, const rpr2::WorldLocationStruct &value, qint64 simTimeMSecs);
};
@@ -0,0 +1,77 @@
/**
* template class to handle IObserverDesignatorObjInstanceCB functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <IObserverDesignatorObjClassCB.h>
#include <IObserverDesignatorObjInstance.h>
#include <IObserverDesignatorObjInstanceCB.h>
#include <DesignatorCodeNameEnum16.h>
#include "rpr_observer_embeddedsystem_object_instance_cb.h"
class ObserverDesignatorObjectCB;
template<typename IOBJ_CB, typename OBJ, typename OBJ_CB>
class ObserverDesignatorObjInstanceCB : public ObserverEmbeddedSystemObjInstanceCB<IOBJ_CB, OBJ, OBJ_CB>
{
public:
explicit ObserverDesignatorObjInstanceCB(OBJ_CB &hoicb, const char *loggerName = "Callbacks.Object.Designator")
: ObserverEmbeddedSystemObjInstanceCB<IOBJ_CB, OBJ, OBJ_CB>(hoicb, loggerName)
{}
void changedDesignatorCode(rpr2::DesignatorCodeEnum16::ET value) override
{
if (!this->m_pIObject->isValidEntityIdentifier())
{
ERROR_LOG(this->m_logger) << "No valid Entity.";
return;
}
this->m_pCB->onDesignatorCodeChanged(this->m_pIObject->getEntityIdentifier(),
value,
this->m_pIObject->getLatestTimeStamp());
}
void changedDesignatorOutputPower(ngs::FLOAT32 value) override
{
if (!this->m_pIObject->isValidEntityIdentifier())
{
ERROR_LOG(this->m_logger) << "No valid Entity.";
return;
}
this->m_pCB->onDesignatorOutputPowerChanged(this->m_pIObject->getEntityIdentifier(),
value,
this->m_pIObject->getLatestTimeStamp());
}
void changedDesignatorSpotLocation(const rpr2::WorldLocationStruct &value) override
{
if (!this->m_pIObject->isValidEntityIdentifier())
{
ERROR_LOG(this->m_logger) << "No valid Entity.";
return;
}
this->m_pCB->onDesignatorSpotLocationChanged(this->m_pIObject->getEntityIdentifier(),
value,
this->m_pIObject->getLatestTimeStamp());
}
// Declarations for pure virtual functions
void changedCodeName(rpr2::DesignatorCodeNameEnum16::ET) override {}
void changedDesignatedObjectIdentifier(const rpr2::RTIObjectIdStruct&) override {}
void changedDesignatorEmissionWavelength(ngs::FLOAT32) override {}
void changedDeadReckoningAlgorithm(rpr2::DeadReckoningAlgorithmEnum8::ET) override {}
void changedRelativeSpotLocation(const rpr2::RelativePositionStruct&) override {}
void changedSpotLinearAccelerationVector(const rpr2::AccelerationVectorStruct&) override {}
};
using ObserverDesignatorObjInstanceCBType = ObserverDesignatorObjInstanceCB<rpr2::IObserverDesignatorObjInstanceCB,
rpr2::IObserverDesignatorObjInstance,
ObserverDesignatorObjectCB>;
@@ -0,0 +1,45 @@
/**
* class to handle signals for ObserverBaseEntities functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "rpr_observer_object_cb.h"
#include <EntityIdentifierStruct.h>
#include <RTIObjectIdStruct.h>
namespace rpr2
{
class WorldLocationStruct;
}
class ObserverEmbeddedSystemObjectCB : public ObserverObjectCB
{
Q_OBJECT
public:
ObserverEmbeddedSystemObjectCB(const char *loggerName = "Callbacks.Object.EmbeddedSystem")
: ObserverObjectCB(loggerName)
{}
void onEntityIdentifierChanged(const rpr2::EntityIdentifierStruct &eis, rpr2::IObserverEmbeddedSystemObjInstance &object, const ngs::SimTime simTime)
{
INFO_LOG(m_logger) << "EntityIdentifier changed for Embedded System Object. New EntityIdentifier: "
<< eis.FederateIdentifier.SiteID << "/"
<< eis.FederateIdentifier.ApplicationID << "/"
<< eis.EntityNumber;
emit entityIdentifierChanged(eis, &object, simTime.getSeconds() * 1000ULL + simTime.getMicroSeconds() / 1000ULL);
}
// void onHostObjectIdentifierChanged(const rpr2::EntityIdentifierStruct &eis, const rpr2::RTIObjectIdStruct &host, const ngs::SimTime &simTime)
// {
// emit objectIdentifierChanged(eis, host, simTime.getSeconds() * 1000ULL + simTime.getMicroSeconds() / 1000ULL);
// }
Q_SIGNALS:
void entityIdentifierChanged(const rpr2::EntityIdentifierStruct &eis, rpr2::IObserverEmbeddedSystemObjInstance *object, qint64 simTimeMSecs);
// void objectIdentifierChanged(const rpr2::EntityIdentifierStruct &eis, const rpr2::RTIObjectIdStruct &wl, qint64 simTimeMSecs);
};
@@ -0,0 +1,58 @@
/**
* template class to handle IObserverEmbeddedSystemObjInstanceCB functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <IObserverEmbeddedSystemObjInstanceCB.h>
#include <EntityIdentifierStruct.h>
#include <SpatialStruct.h>
#include <WorldLocationStruct.h>
#include <NGSUtils/SimTime.h>
#include "rpr_observer_object_instance_cb.h"
template<typename IOBJ_CB, typename OBJ, typename OBJ_CB>
class ObserverEmbeddedSystemObjInstanceCB : public ObserverObjectInstanceCB<IOBJ_CB, OBJ, OBJ_CB>
{
public:
explicit ObserverEmbeddedSystemObjInstanceCB(OBJ_CB &hoicb, const char *loggerName = "Callbacks.Object.EmbeddedSystem")
: ObserverObjectInstanceCB<IOBJ_CB, OBJ, OBJ_CB>(hoicb, loggerName)
{}
//
// IObserverObjectInstanceCallback
//
void changedEntityIdentifier(const rpr2::EntityIdentifierStruct &data) override
{
if (!this->m_pIObject->isValidEntityIdentifier())
{
ERROR_LOG(this->m_logger) << "No valid Entity.";
return;
}
this->m_pCB->onEntityIdentifierChanged(data, *this->m_pIObject, this->m_pIObject->getLatestTimeStamp());
}
/* Unused yet. It is in EntityIdentifier. Not nice, but that's how ICE sends the data.
void changedHostObjectIdentifier(const rpr2::RTIObjectIdStruct &data) override
{
if (!this->m_pIObject->isValidEntityIdentifier())
{
ERROR_LOG(this->m_logger) << "No valid Entity.";
return;
}
this->m_pCB->onHostObjectIdentifierChanged(this->m_pIObject->getEntityIdentifier(),
data,
this->m_pIObject->getLatestTimeStamp());
}
*/
// Declarations for pure virtual functions
void changedHostObjectIdentifier(const rpr2::RTIObjectIdStruct &) override {}
void changedRelativePosition(const rpr2::RelativePositionStruct &) override {}
protected:
ngs::SimTime m_lastPositionTime;
};
@@ -0,0 +1,34 @@
/**
* A notifier to inform NGSConnector about changes in an GroundVehicle instance
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "rpr_global.h"
#include "rpr_observer_groundvehicle_object_cb.h"
#include "rpr_observer_groundvehicle_object_instance_cb.h"
/**
* The notifier for new ground vehicle instances
*/
class ObserverGroundVehicleCBNotifier : public ObserverGroundVehicleObjectCB, public rpr2::IObserverGroundVehicleObjClassCB
{
Q_OBJECT
public:
ObserverGroundVehicleCBNotifier()
: ObserverGroundVehicleObjectCB("Callbacks.Object.GroundVehicle")
, rpr2::IObserverGroundVehicleObjClassCB()
{}
//Abstract functions realized from IObserverGroundVehicleObjClassCB
rpr2::IObserverGroundVehicleObjInstanceCB &newGroundVehicleObjInstance(rpr2::IObserverGroundVehicleObjInstance &object) override
{
return newObjectInstance<ObserverGroundVehicleObjInstanceCBType>(object);
}
void deleteInterface() override {}
};
@@ -0,0 +1,19 @@
/**
* class to handle signals for ObserverHumans functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "rpr_observer_platform_object_cb.h"
class ObserverGroundVehicleObjectCB : public ObserverPlatformObjectCB
{
Q_OBJECT
public:
ObserverGroundVehicleObjectCB(const char *loggerName = "Callbacks.Object.GroundVehicle")
: ObserverPlatformObjectCB(loggerName)
{}
};
@@ -0,0 +1,31 @@
/**
* template class to handle IObserverGroundVehicleObjInstanceCB functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <IObserverGroundVehicleObjClassCB.h>
#include <IObserverGroundVehicleObjInstance.h>
#include <IObserverGroundVehicleObjInstanceCB.h>
#include "rpr_observer_platform_object_instance_cb.h"
class ObserverGroundVehicleObjectCB;
template<typename IOBJ_CB, typename OBJ, typename OBJ_CB>
class ObserverGroundVehicleObjInstanceCB : public ObserverPlatformObjInstanceCB<IOBJ_CB,
OBJ,
OBJ_CB>
{
public:
explicit ObserverGroundVehicleObjInstanceCB(OBJ_CB &hoicb, const char *loggerName = "Callbacks.Object.GroundVehicle")
: ObserverPlatformObjInstanceCB<IOBJ_CB, OBJ, OBJ_CB>(hoicb, loggerName)
{}
};
using ObserverGroundVehicleObjInstanceCBType = ObserverGroundVehicleObjInstanceCB<rpr2::IObserverGroundVehicleObjInstanceCB,
rpr2::IObserverGroundVehicleObjInstance,
ObserverGroundVehicleObjectCB>;
@@ -0,0 +1,33 @@
/**
* A notifier to inform NGSConnector about changes in an Human instance
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "rpr_global.h"
#include "rpr_observer_human_object_cb.h"
#include "rpr_observer_human_object_instance_cb.h"
/**
* The notifier for new human instances
*/
class ObserverHumanCBNotifier : public ObserverHumanObjectCB, public rpr2::IObserverHumanObjClassCB
{
Q_OBJECT
public:
ObserverHumanCBNotifier()
: ObserverHumanObjectCB("Callbacks.Object.Human")
, rpr2::IObserverHumanObjClassCB()
{}
//Abstract functions realized from IObserverHumanObjClassCB
rpr2::IObserverHumanObjInstanceCB &newHumanObjInstance(rpr2::IObserverHumanObjInstance &object) override
{
return newObjectInstance<ObserverHumanObjInstanceCBType>(object);
}
void deleteInterface() override {}
};
@@ -0,0 +1,19 @@
/**
* class to handle signals for ObserverHumans functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "rpr_observer_lifeform_object_cb.h"
class ObserverHumanObjectCB : public ObserverLifeformObjectCB
{
Q_OBJECT
public:
ObserverHumanObjectCB(const char *loggerName = "Callbacks.Object.Human")
: ObserverLifeformObjectCB(loggerName)
{}
};
@@ -0,0 +1,29 @@
/**
* template class to handle IObserverHumanObjInstanceCB functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <IObserverHumanObjClassCB.h>
#include <IObserverHumanObjInstance.h>
#include <IObserverHumanObjInstanceCB.h>
#include "rpr_observer_lifeform_object_instance_cb.h"
class ObserverHumanObjectCB;
template<typename IOBJ_CB, typename OBJ, typename OBJ_CB>
class ObserverHumanObjInstanceCB : public ObserverLifeformObjInstanceCB<IOBJ_CB, OBJ, OBJ_CB>
{
public:
explicit ObserverHumanObjInstanceCB(OBJ_CB &hoicb, const char *loggerName = "Callbacks.Object.Human")
: ObserverLifeformObjInstanceCB<IOBJ_CB, OBJ, OBJ_CB>(hoicb, loggerName)
{}
};
using ObserverHumanObjInstanceCBType = ObserverHumanObjInstanceCB<rpr2::IObserverHumanObjInstanceCB,
rpr2::IObserverHumanObjInstance,
ObserverHumanObjectCB>;
@@ -0,0 +1,19 @@
/**
* class to handle signals for ObserverLifeforms functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "rpr_observer_physicalentity_object_cb.h"
class ObserverLifeformObjectCB : public ObserverPhysicalEntityObjectCB
{
Q_OBJECT
public:
ObserverLifeformObjectCB(const char *loggerName = "Callbacks.Object.Lifeform")
: ObserverPhysicalEntityObjectCB(loggerName)
{}
};
@@ -0,0 +1,40 @@
/**
* template class to handle IObserverLifeformObjInstanceCB functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <IObserverLifeformObjClassCB.h>
#include <IObserverLifeformObjInstance.h>
#include <IObserverLifeformObjInstanceCB.h>
#include "rpr_observer_physicalentity_object_instance_cb.h"
class ObserverLifeformObjectCB;
template<typename IOBJ_CB, typename OBJ, typename OBJ_CB>
class ObserverLifeformObjInstanceCB : public ObserverPhysicalEntityObjInstanceCB<IOBJ_CB, OBJ, OBJ_CB>
{
public:
explicit ObserverLifeformObjInstanceCB(OBJ_CB &hoicb, const char *loggerName = "Callbacks.Object.Lifeform")
: ObserverPhysicalEntityObjInstanceCB<IOBJ_CB, OBJ, OBJ_CB>(hoicb, loggerName)
{}
//
// IObserverLifeformObjInstanceCB
//
// Declarations for pure virtual functions
void changedFlashLightsOn(bool) override {}
void changedStanceCode(rpr2::StanceCodeEnum32::ET) override {}
void changedPrimaryWeaponState(rpr2::WeaponStateEnum32::ET) override {}
void changedSecondaryWeaponState(rpr2::WeaponStateEnum32::ET) override {}
void changedComplianceState(rpr2::ComplianceStateEnum32::ET) override {}
};
using ObserverLifeformObjInstanceCBType = ObserverLifeformObjInstanceCB<rpr2::IObserverLifeformObjInstanceCB,
rpr2::IObserverLifeformObjInstance,
ObserverLifeformObjectCB>;
@@ -0,0 +1,33 @@
/**
* A notifier to inform NGSConnector about changes in an GuezObserverController instance
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "rpr_global.h"
#include "rpr_observer_longbow_apache_object_cb.h"
#include "rpr_observer_longbow_apache_object_instance_cb.h"
/**
* The notifier for new longbow apache instances
*/
class ObserverLongBowApacheCBNotifier : public ObserverLongBowApacheObjectCB, public rpr2::IObserverLongBowApacheObjClassCB
{
Q_OBJECT
public:
ObserverLongBowApacheCBNotifier()
: ObserverLongBowApacheObjectCB("Callbacks.Object.LongBowApache")
, rpr2::IObserverLongBowApacheObjClassCB()
{}
//Abstract functions realized from IObserverGuezObserverControllerObjClassCB
rpr2::IObserverLongBowApacheObjInstanceCB &newLongBowApacheObjInstance(rpr2::IObserverLongBowApacheObjInstance &object) override
{
return newObjectInstance<ObserverLongBowApacheObjInstanceCBType>(object);
}
void deleteInterface() override {}
};
@@ -0,0 +1,30 @@
/**
* class to handle signals for ObserverGuezObserverControllers functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "rpr_observer_aircraft_object_cb.h"
#include <SensorFieldEnum32.h>
class ObserverLongBowApacheObjectCB : public ObserverAircraftObjectCB
{
Q_OBJECT
public:
ObserverLongBowApacheObjectCB(const char *loggerName = "Callbacks.Object.LongBowApache")
: ObserverAircraftObjectCB(loggerName)
{}
void onSensorChanged(const rpr2::EntityIdentifierStruct &eis, rpr2::SensorFieldEnum32::ET value, const ngs::SimTime &simTime)
{
emit sensorChanged(eis, value, simTime.getSeconds() * 1000ULL + simTime.getMicroSeconds() / 1000ULL);
}
Q_SIGNALS:
void sensorChanged(const rpr2::EntityIdentifierStruct &eis, rpr2::SensorFieldEnum32::ET value, qint64 simTimeMSecs);
};
@@ -0,0 +1,45 @@
/**
* template class to handle IObserverGuezObserverControllerObjInstanceCB functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <IObserverLongBowApacheObjClassCB.h>
#include <IObserverLongBowApacheObjInstance.h>
#include <IObserverLongBowApacheObjInstanceCB.h>
#include "rpr_observer_aircraft_object_instance_cb.h"
class ObserverLongBowApacheObjectCB;
template<typename IOBJ_CB, typename OBJ, typename OBJ_CB>
class ObserverLongBowApacheObjInstanceCB : public ObserverAircraftObjInstanceCB<IOBJ_CB,
OBJ,
OBJ_CB>
{
public:
explicit ObserverLongBowApacheObjInstanceCB(OBJ_CB &hoicb, const char *loggerName = "Callbacks.Object.LongBowApache")
: ObserverAircraftObjInstanceCB<IOBJ_CB, OBJ, OBJ_CB>(hoicb, loggerName)
{}
void changedSensor(rpr2::SensorFieldEnum32::ET value) override
{
if (!this->m_pIObject->isValidEntityType())
{
ERROR_LOG(this->m_logger) << "No valid Entity.";
return;
}
this->m_pCB->onSensorChanged(this->m_pIObject->getEntityIdentifier(),
value,
this->m_pIObject->getLatestTimeStamp());
}
};
using ObserverLongBowApacheObjInstanceCBType = ObserverLongBowApacheObjInstanceCB<rpr2::IObserverLongBowApacheObjInstanceCB,
rpr2::IObserverLongBowApacheObjInstance,
ObserverLongBowApacheObjectCB>;
@@ -0,0 +1,48 @@
/**
* class to handle signals for ObserverObjects functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <QObject>
#include <IObserverBaseEntityObjInstance.h>
#include <IObserverEmbeddedSystemObjInstance.h>
#include <IObserverEnvironmentObjectObjInstance.h>
#include <Common/logger.h>
class ObserverObjectCB : public QObject
{
Q_OBJECT
public:
ObserverObjectCB(const char *loggerName = "Callbacks.Object.Object")
: m_logger(HighLevelArchitecture::getLogger(loggerName))
{}
template<typename T>
typename T::IObjectCallback &newObjectInstance(typename T::Object &object)
{
typedef typename T::ObjectCallback OBJ_CB;
OBJ_CB *that = dynamic_cast<OBJ_CB *>(this);
T *cb = new T(*that); //Neues Observer-Objekt erstellen
cb->setInterface(&object); //Merken des Objekts, falls man die get-Funktionen nutzen möchte
emit newObjectInstance2(object); //Bekannt machen, das ein neues Objekt gemeldet wurde
return *cb; //Hier wird der Observer für dieses Objekt zurückgegeben.
}
void deleteObjectInstance(const ngs::IObserverObjectInstance &object)
{
emit objectInstanceDeleted(object);
}
Q_SIGNALS:
void newObjectInstance(const ngs::IObserverObjectInstance &object);
void newObjectInstance2(const ngs::IObserverObjectInstance &object);
void objectInstanceDeleted(const ngs::IObserverObjectInstance &object);
protected:
NGL::INGLLogger &m_logger;
};
@@ -0,0 +1,51 @@
/**
* template class to handle IObserverBaseEntityObjInstanceCB functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <IObserverObjectInstanceCallback.h>
#include <Common/logger.h>
template<typename IOBJ_CB, typename OBJ, typename OBJ_CB>
class ObserverObjectInstanceCB : public IOBJ_CB
{
public:
explicit ObserverObjectInstanceCB(OBJ_CB &hoicb, const char *loggerName = "Callbacks.Object.Object")
: m_pIObject(nullptr)
, m_pCB(&hoicb)
, m_logger(HighLevelArchitecture::getLogger(loggerName))
{}
void setInterface(OBJ *_piobject) { m_pIObject = _piobject; }
//
// IObserverObjectInstanceCallback
//
// Declarations for pure virtual functions
void deleteObjectInstance() override
{
DEBUG_LOG(m_logger) << "deleteObjectInstance";
if (m_pCB && m_pIObject)
m_pCB->deleteObjectInstance(*m_pIObject);
delete this;
}
void anyAttributesChanged() override
{
//DEBUG_LOG(m_logger) << "anyAttributeChanged on EntityID:"<< m_pIObject->getEntityIdentifier().EntityNumber;
}
typedef OBJ Object;
typedef OBJ_CB ObjectCallback;
typedef IOBJ_CB IObjectCallback;
protected:
OBJ *m_pIObject;
OBJ_CB *m_pCB;
NGL::INGLLogger &m_logger;
};
@@ -0,0 +1,46 @@
/**
* class to handle signals for ObserverPhysicalEntities functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "rpr_observer_baseentity_object_cb.h"
#include <MarkingStruct.h>
#include <DamageStatusEnum32.h>
class ObserverPhysicalEntityObjectCB : public ObserverBaseEntityObjectCB
{
Q_OBJECT
public:
ObserverPhysicalEntityObjectCB(const char *loggerName = "Callbacks.Object.PhysicalEntity")
: ObserverBaseEntityObjectCB(loggerName)
{}
void onForceIdentifierChanged(const rpr2::EntityIdentifierStruct &eis,
rpr2::ForceIdentifierEnum8::ET identifier,
const ngs::SimTime &simTime)
{
emit forceIdentifierChanged(eis, identifier, simTime.getSeconds() * 1000ULL + simTime.getMicroSeconds() / 1000ULL);
}
void onMarkingChanged(const rpr2::EntityIdentifierStruct &eis,
const rpr2::MarkingStruct &marking,
const ngs::SimTime &simTime)
{
emit markingChanged(eis, marking, simTime.getSeconds() * 1000ULL + simTime.getMicroSeconds() / 1000ULL);
}
void onDamageStateChanged(const rpr2::EntityIdentifierStruct &eis,
rpr2::DamageStatusEnum32::ET status,
const ngs::SimTime &simTime)
{
emit damageStateChanged(eis, status, simTime.getSeconds() * 1000ULL + simTime.getMicroSeconds() / 1000ULL);
}
Q_SIGNALS:
void forceIdentifierChanged(const rpr2::EntityIdentifierStruct &eis, rpr2::ForceIdentifierEnum8::ET state, qint64 simTimeMSecs);
void markingChanged(const rpr2::EntityIdentifierStruct &eis, const rpr2::MarkingStruct &marking, qint64 simTimeMSecs);
void damageStateChanged(const rpr2::EntityIdentifierStruct &eis, rpr2::DamageStatusEnum32::ET status, qint64 simTimeMSecs);
};
@@ -0,0 +1,76 @@
/**
* template class to handle IObserverPhysicalEntityObjInstanceCB functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <IObserverPhysicalEntityObjInstanceCB.h>
#include <MarkingStruct.h>
#include "rpr_observer_baseentity_object_instance_cb.h"
template<typename IOBJ_CB, typename OBJ, typename OBJ_CB>
class ObserverPhysicalEntityObjInstanceCB : public ObserverBaseEntityObjInstanceCB<IOBJ_CB, OBJ, OBJ_CB>
{
public:
explicit ObserverPhysicalEntityObjInstanceCB(OBJ_CB &hoicb, const char *loggerName = "Callbacks.Object.PhysicalEntity")
: ObserverBaseEntityObjInstanceCB<IOBJ_CB, OBJ, OBJ_CB>(hoicb, loggerName)
{}
//
// IObserverPhysicalEntityObjInstanceCB
//
void changedForceIdentifier(rpr2::ForceIdentifierEnum8::ET data) override
{
if (!this->m_pIObject->isValidEntityType())
return;
this->m_pCB->onForceIdentifierChanged(this->m_pIObject->getEntityIdentifier(),
data,
this->m_pIObject->getLatestTimeStamp());
}
void changedMarking(const rpr2::MarkingStruct &data) override
{
if (!this->m_pIObject->isValidEntityType())
return;
this->m_pCB->onMarkingChanged(this->m_pIObject->getEntityIdentifier(),
data,
this->m_pIObject->getLatestTimeStamp());
}
void changedDamageState(rpr2::DamageStatusEnum32::ET data) override
{
if (!this->m_pIObject->isValidEntityType())
return;
this->m_pCB->onDamageStateChanged(this->m_pIObject->getEntityIdentifier(),
data,
this->m_pIObject->getLatestTimeStamp());
}
// Declarations for pure virtual functions
void changedFirePowerDisabled(bool) override {}
void changedImmobilized(bool) override {}
void changedAcousticSignatureIndex(short) override {}
void changedAlternateEntityType(const rpr2::EntityTypeStruct &) override {}
void changedArticulatedParametersArray(const rpr2::ArrayOfArticulatedParameterStructDynamicHLAunpaddedLengthlessVarArray &) override {}
void receivedArticulatedParametersArray(const rpr2::ArrayOfArticulatedParameterStructDynamicHLAunpaddedLengthlessVarArray &, const ngs::SimTime &) override {}
void changedCamouflageType(rpr2::CamouflageEnum32::ET) override {}
void changedEngineSmokeOn(bool) override {}
void changedFlamesPresent(bool) override {}
void changedHasAmmunitionSupplyCap(bool) override {}
void changedHasFuelSupplyCap(bool) override {}
void changedHasRecoveryCap(bool) override {}
void changedHasRepairCap(bool) override {}
void changedInfraredSignatureIndex(short) override {}
void changedIsConcealed(bool) override {}
void changedLiveEntityMeasuredSpeed(unsigned short) override {}
void changedPowerPlantOn(bool) override {}
void changedPropulsionSystemsData(const rpr2::ArrayOfPropulsionSystemDataStructDynamicHLAlengthlessVarArray &) override {}
void changedRadarCrossSectionSignatureIndex(short) override {}
void changedSmokePlumePresent(bool) override {}
void changedTentDeployed(bool) override {}
void changedTrailingEffectsCode(rpr2::TrailingEffectsCodeEnum32::ET) override {}
void changedVectoringNozzleSystemData(const rpr2::ArrayOfVectoringNozzleSystemDataStructDynamicHLAlengthlessVarArray &) override {}
};
@@ -0,0 +1,19 @@
/**
* class to handle signals for ObserverPlatforms functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "rpr_observer_physicalentity_object_cb.h"
class ObserverPlatformObjectCB : public ObserverPhysicalEntityObjectCB
{
Q_OBJECT
public:
ObserverPlatformObjectCB(const char *loggerName = "Callbacks.Object.Platform")
: ObserverPhysicalEntityObjectCB(loggerName)
{}
};
@@ -0,0 +1,42 @@
/**
* template class to handle IObserverPlatformObjInstanceCB functions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <IObserverPlatformObjInstanceCB.h>
#include "rpr_observer_physicalentity_object_instance_cb.h"
template<typename IOBJ_CB, typename OBJ, typename OBJ_CB>
class ObserverPlatformObjInstanceCB : public ObserverPhysicalEntityObjInstanceCB<IOBJ_CB, OBJ, OBJ_CB>
{
public:
explicit ObserverPlatformObjInstanceCB(OBJ_CB &hoicb, const char *loggerName = "Callbacks.Object.Platform")
: ObserverPhysicalEntityObjInstanceCB<IOBJ_CB, OBJ, OBJ_CB>(hoicb, loggerName)
{}
//
// IObserverPlatformObjInstanceCB
//
// Declarations for pure virtual functions
void changedAfterburnerOn(bool) override {}
void changedAntiCollisionLightsOn(bool) override {}
void changedBlackOutBrakeLightsOn(bool) override {}
void changedBlackOutLightsOn(bool) override {}
void changedBrakeLightsOn(bool) override {}
void changedFormationLightsOn(bool) override {}
void changedHatchState(rpr2::HatchStateEnum32::ET) override {}
void changedHeadLightsOn(bool) override {}
void changedInteriorLightsOn(bool) override {}
void changedLandingLightsOn(bool) override {}
void changedLauncherRaised(bool) override {}
void changedNavigationLightsOn(bool) override {}
void changedRampDeployed(bool) override {}
void changedRunningLightsOn(bool) override {}
void changedSpotLightsOn(bool) override {}
void changedTailLightsOn(bool) override {}
};
+86
View File
@@ -0,0 +1,86 @@
/**
* @RDE_HEADER@
* Access Data from TRIMBLE and emit contents as QByteArray
* $Id$
* $HeadURL$
* $Author$
*/
#include "socketreader.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
#include <QtNetwork/QTcpSocket>
#include <QtCore/QTimer>
#include <QtCore/QCoreApplication>
#include <QtCore/QMetaEnum>
namespace HighLevelArchitecture {
SocketReader::SocketReader(QObject *parent)
: QThread(parent)
, m_socket(new QTcpSocket(this))
, m_hlaRequestIdentifier(0)
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("SocketReader"))
{
}
bool SocketReader::init(const QString &host, quint16 port, int hlaRequestIdentifier)
{
DEBUG_LOG(m_logger) << "SR " << hlaRequestIdentifier << ": Trying to establish connection to " << host << ":" << port;
m_hlaRequestIdentifier = hlaRequestIdentifier;
connect(m_socket, SIGNAL(readyRead()), this, SLOT(onReadyRead()));
connect(m_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(onSocketError(QAbstractSocket::SocketError)));
m_socket->connectToHost(host, port, QIODevice::ReadOnly);
return m_socket->waitForConnected(1000);
}
SocketReader::~SocketReader()
{
m_socket->disconnectFromHost();
// Gracely try to disconnect. If not successfull within 1000msecs, abort the socket.
if (m_socket->state() != QAbstractSocket::UnconnectedState &&
!m_socket->waitForDisconnected(1000))
m_socket->abort();
delete m_socket;
m_socket = 0;
}
void SocketReader::onReadyRead()
{
// Checked if this works and the whole chunk is read.
// No problems in extensive testing.
// Otherwise, we had to inspect the data and search for start and ending!
DEBUG_LOG(m_logger) << "SR "<< m_hlaRequestIdentifier << ": Data received, transmitting";
QByteArray ba(m_socket->readAll());
TRACE_LOG(m_logger) << "SR "<< m_hlaRequestIdentifier << ": Data contents: " << ba.constData();
emit newData(ba, m_hlaRequestIdentifier);
}
void SocketReader::stopThread()
{
QTimer::singleShot(0, this, SLOT(quit()));
while (!isFinished())
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
deleteLater();
}
void SocketReader::onSocketError(const QAbstractSocket::SocketError &error)
{
QString errorValue;
QMetaObject meta = QAbstractSocket::staticMetaObject;
for (int i=0; i < meta.enumeratorCount(); ++i) {
QMetaEnum m = meta.enumerator(i);
if (QString::fromLatin1(m.name()) == QLatin1String("SocketError")) {
errorValue = QLatin1String(m.valueToKey(error));
break;
}
}
ERROR_LOG(m_logger) << "SR "<< m_hlaRequestIdentifier << ": Socket Error: " << errorValue;
}
} // namespace HLA
+50
View File
@@ -0,0 +1,50 @@
/**
* @RDE_HEADER@
* Access Data from TRIMBLE and emit contents as QByteArray
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <QtCore/QThread>
#include <QtNetwork/QAbstractSocket>
namespace NGL {
class INGLLogger;
}
class QTcpSocket;
/*********************************************************
* HOWTO: *
* *
* - Instantiate this Class without parent(!), *
* - call init() to establish the connection, on success: *
* - call start() to move it to the thread *
*********************************************************/
namespace HighLevelArchitecture {
class SocketReader : public QThread
{
Q_OBJECT
public:
explicit SocketReader(QObject *parent = nullptr);
bool init(const QString &host, quint16 port, int id);
void stopThread();
~SocketReader();
signals:
void newData(const QByteArray &content, int id);
protected:
QTcpSocket *m_socket;
int m_hlaRequestIdentifier;
NGL::INGLLogger &m_logger;
private slots:
void onReadyRead();
void onSocketError(const QAbstractSocket::SocketError &error);
};
} // Namespace HLA
@@ -0,0 +1,18 @@
#!/bin/bash
trap "jobs -p | xargs kill" EXIT
export PRTICRCHOST=localhost
export PRTICRCPORT=8989
export LOGDIR=/shd/CTC/SV/LOG
export PRTI1516_OPTION1=-Dsettings.file=./prti1516LRC.settings
PITCH_DIR=/opt/prti1516e
NGS_LIB_DIR=/opt/EXTFW/NGSPublic/lib
JAVA_BASE_DIR=/usr/lib64/jvm/jre-1.8.0-openjdk
JAVA_DIRS=${JAVA_BASE_DIR}/lib/amd64/:${JAVA_BASE_DIR}/lib/amd64/server
./svcHighLevelArchitecture -e42
#gdb ./svcHighLevelArchitecture
+264
View File
@@ -0,0 +1,264 @@
:===============================================================================
: Simulated World Config File
:===============================================================================
:-------------------------------------------------------------------------------
: RTI config
:-------------------------------------------------------------------------------
;Linux_RTILibs[PITCH] :gcc41_64/librti1516e64.so libprtiutil64.so DefaultSimTimeConverterHLA1516E_PITCH4310/libSimTimeConverterHLA1516.so RTIFacadeHLA1516E_PITCH4310/libRTIFacadeHLA.so
;Linux_RTILibs[PITCH] : libprtiutil64.so gcc41_64/librti1516e64.so DefaultSimTimeConverterHLA1516E_PITCH4310/libSimTimeConverterHLA1516.so RTIFacadeHLA1516E_PITCH4310/libRTIFacadeHLA.so
;: pitch_4.3.1.0
;Linux_RTIClassPath[PITCH] : /opt/prti1516e/lib/prti1516e.jar
Linux_RTILibs[MAK] : /opt/NGS/makRti4.5/lib/librti1516e64.so /opt/NGS/makRti4.5/lib/librtiutil_64.so /opt/NGS/NGSPublic/lib/RTIFacadeHLA1516E_MAK450/libRTIFacadeHLA.so
;: pitch_4.3.1.0
Linux_RTIClassPath[MAK] : /opt/NGS/makRti4.5/lib/hla.jar
:-------------------------------------------------------------------------------
: SOM- and FOMName are needed to identify the necessary shared libraries
:-------------------------------------------------------------------------------
SOMName[Saab] : RPRFOM20d17E : Name of the SOM (used for library load)
FOMName[Saab] : RPRFOM20d17E : Name of the FOM (used for library load)
:-------------------------------------------------------------------------------
:
:-------------------------------------------------------------------------------
:Fedfile : ./SimulatedWorld.xml : Path for HLA 0.3 fed-file (.fed) or HLA
;Fedfile : ./RPR2-d17.xml : Path for HLA 1.3 fed-file (.fed) or HLA 1516 xml-file (.xml)
Fedfile : ./RPRFOM20d17E.xml
GoForeverCycleTime : 100 : Automatic cycle time [ms] for goForever
PlayerObserverEchoOn : true : true for automatic Player-Observer
: echo
DISConnectorConfig : disconnectorconf.cfg : Configfile of disconnector
:-------------------------------------------------------------------------------
: Update Timeouts for FOM Classes [s] 0 = off
: when no new updates are received after this time, the object is deleted
:-------------------------------------------------------------------------------
UpdateTimeoutHLA[BaseEntity] : 0 :
UpdateTimeoutHLA[PhysicalEntity] : 0 :
UpdateTimeoutHLA[Platform] : 0 :
UpdateTimeoutHLA[GroundVehicle] : 0 :
UpdateTimeoutHLA[Minefield] : 0 :
UpdateTimeoutHLA[EmbeddedSystem] : 0 :
UpdateTimeoutHLA[MinefieldData] : 0 :
UpdateTimeoutDIS[BaseEntity] : 0 :
UpdateTimeoutDIS[PhysicalEntity] : 0 :
UpdateTimeoutDIS[Platform] : 0 :
UpdateTimeoutDIS[GroundVehicle] : 0 :
UpdateTimeoutDIS[Minefield] : 0 :
UpdateTimeoutDIS[EmbeddedSystem] : 0 :
UpdateTimeoutDIS[MinefieldData] : 0 :
UpdateTimeoutCORBA[BaseEntity] : 0 :
UpdateTimeoutCORBA[PhysicalEntity] : 0 :
UpdateTimeoutCORBA[Platform] : 0 :
UpdateTimeoutCORBA[GroundVehicle] : 0 :
UpdateTimeoutCORBA[Minefield] : 0 :
UpdateTimeoutCORBA[EmbeddedSystem] : 0 :
UpdateTimeoutCORBA[MinefieldData] : 0 :
:-------------------------------------------------------------------------------
: Publish Timeouts for FOM Classes [ms] 0 = off :
: updates are sent automatically at the latest after this time (heartbeat)
:-------------------------------------------------------------------------------
PublishTimeoutHLA[BaseEntity] : 60000 :
PublishTimeoutHLA[PhysicalEntity] : 60000 :
PublishTimeoutHLA[Platform] : 60000 :
PublishTimeoutHLA[Minefield] : 60000 :
PublishTimeoutHLA[EmbeddedSystem] : 60000 :
PublishTimeoutHLA[MinefieldData] : 60000 :
PublishTimeoutDIS[BaseEntity] : 30000 :
PublishTimeoutDIS[PhysicalEntity] : 30000 :
PublishTimeoutDIS[EmitterBeam] : 0 : should always be zero
PublishTimeoutDIS[EmitterSystem] : 30000 :
PublishTimeoutDIS[Minefield] : 30000 :
PublishTimeoutDIS[EmbeddedSystem] : 30000 :
PublishTimeoutDIS[MinefieldData] : 30000 :
PublishTimeoutCORBA[BaseEntity] : 30000 :
PublishTimeoutCORBA[PhysicalEntity] : 30000 :
PublishTimeoutCORBA[Platform] : 30000 :
PublishTimeoutCORBA[Minefield] : 30000 :
PublishTimeoutCORBA[EmbeddedSystem] : 30000 :
PublishTimeoutCORBA[MinefieldData] : 30000 :
:-------------------------------------------------------------------------------
: Publish All Attributes Flags from FOM Classes :
: This emulates DIS behaviour in CORBA and HLA, on publish all valid attributs
: are sent, instead of only the modified attributesa are sent.
:-------------------------------------------------------------------------------
PublishAll[BaseEntity] : false :
PublishAll[PhysicalEntity] : false :
PublishAll[Platform] : false :
:-------------------------------------------------------------------------------
: DIS Electromagnetic Emission PDU: policy for deletion of EmitterSystem
: and EmitterBeam objects on DIS level
:-------------------------------------------------------------------------------
ElectromagneticEmissionDIS[useStateUpdate] : true : the deletion of objects
: will be announced and
: detected with complete
: state updates where the
: respective elements are
: missing
ElectromagneticEmissionDIS[useZeroBeamPower] : false : the deletion of beams will
: be announced and detected
: by zero beam power,
: emittersystems without beams
: will be considerd deleted
:-------------------------------------------------------------------------------
: Timestamps:
:
: Normal procedure would be to send timestamps when expicitly published, to keep
: timestamps when received and to use timestamps for deadreckoning when possible.
: With the parameters below this behaviour can be modified.
:
: DIS-PDU realtime-timestamps will be converted to/from the corresponding simulationtime.
:
:-------------------------------------------------------------------------------
HLALogicalTimeImplementationName : HLAfloat64Time : Name of HLALogicalTime implementation
HLATimeStampInTag[default] : true : Send DIS-Timestamp in UserSupplied Tag
SendPlayerTimeStamps[HLA] : true : true/false
SendPlayerTimeStamps[CORBA] : true : true/false
SendPlayerTimeStamps[DIS] : true : true/false
: true : published timestamps will be transmitted
: (for DIS as the realtime corresponding to the simulationtime)
: false : published timestamps will not be transmitted (or for DIS the current realtime)
: or will be replaced when ImplicitPlayerTimeStamps=true
ImplicitPlayerTimeStamps[HLA] : false : true/false
ImplicitPlayerTimeStamps[CORBA] : false : true/false
ImplicitPlayerTimeStamps[DIS] : false : true/false
: true : generation of implicit timestamps from the current simulationtime,
: when no explicit timestamp has been published or when
: SendPlayerTimeStamps=false
: false : no generation of implicit timestamps
ReceiveObserverTimeStamps[HLA] : true : true/false
ReceiveObserverTimeStamps[CORBA] : true : true/false
ReceiveObserverTimeStamps[DIS] : true : true/false
: true : received timestamps are transmitted to the observer
: (for DIS simulationtime-timestamps are generated from the PDU realtime-timestamps)
: false : received timestamps are ignored or replaced when
: ImplicitObserverTimeStamps=true
ImplicitObserverTimeStamps[HLA] : false : true/false
ImplicitObserverTimeStamps[CORBA] : false : true/false
ImplicitObserverTimeStamps[DIS] : false : true/false
: true : timestamps are implicitly generated from the current
: simulationtime when not received or ReceiveObserverTimeStamps=false
: false : no generation of implicit timestamps
:-------------------------------------------------------------------------------
: Deadreckoning time handling
:-------------------------------------------------------------------------------
IgnorePlayerTimeStampsForDeadReckoning : false : true/false
: false : deadreckoning with timestamps when present, otherwise with
: current simulationtime, never when the current simulationtime is
: invalid
: true : timestamps are ignored for dead reckoning
IgnoreObserverTimeStampsForDeadReckoning : false : true/false
: false : deadreckoning with timestamps when present, otherwise with
: current simulationtime, never when the current simulationtime is
: invalid
: true : timestamps are ignored for dead reckoning
DeadReckoningWithRealtime : false : true/false
: false : normal deadeckoning with simulationtime
: true : simulationtime is ignored, dead reckoning is always done with
: the current realtime
UseRealtime : true : true/false
: true : implicitly configure simulationtime=realtime
: can be overwritten through the api
: false : initial simulationtime is invalid
DISTimeStampRelative : true : true/false
: true : own clock is not UTC
: the LSB of generated DIS timestamps will signify relative time
: false : own clock must be UTC
: the LSB of generated DIS timestamps will signify synchronized UTC
: time
DRReceiveDelay[HLA] : 0.0 : age of data on receive, e.g.
DRReceiveDelay[DIS] : 0.0 : to compensate network delays [s]
DRReceiveDelay[CORBA] : 0.0 :
:-------------------------------------------------------------------------------
: Deadreckoning player:
: Supresses sending of object-updates, when they are only marginaly changed.
:-------------------------------------------------------------------------------
PlayerDeadReckoningOn[BaseEntity] : true : turns on the dead-reckoning
PlayerDeadReckoningOn[PhysicalEntity] : true : suppressing mechanism
PlayerDeadReckoningOn[Platform] : true : for attribute updates
MaxDRSuppressTime[BaseEntity] : 10 : Updates are sent always at the
MaxDRSuppressTime[PhysicalEntity] : 10 : latest after this time
MaxDRSuppressTime[Platform] : 10 : 0=infinte time [s]
DRThresholdTime[BaseEntity] : 0.1 : Time span (into the future) used for
DRThresholdTime[PhysicalEntity] : 0.1 : calculating threshold deviations
DRThresholdTime[Platform] : 0.1 : This time should correspond to the
: publish-interval [s]
DRPositionThreshold[BaseEntity] : 0.01 : Updates are not supressed
DRPositionThreshold[PhysicalEntity] : 0.01 : when position-changes exceed
DRPositionThreshold[Platform] : 0.01 : this threshold [m]
DROrientationThreshold[BaseEntity] : 0.01 : Updates are not supressed
DROrientationThreshold[PhysicalEntity] : 0.01 : when orientation-changes exceed
DROrientationThreshold[Platform] : 0.01 : this threshold [rad]
DRDimlessThreshold[BaseEntity] : 0.01 : Updates are not supressed
DRDimlessThreshold[PhysicalEntity] : 0.01 : when changes for dimensionless
DRDimlessThreshold[Platform] : 0.01 : values [0..1] exceed this
: threshold [1]
:-------------------------------------------------------------------------------
: Deadreckoning observer
: calculates values for deadreckoning attributes, for get() und callbacks()
:-------------------------------------------------------------------------------
ObserverDeadReckoningOn[BaseEntity] : true : turns on the dead-reckoning
ObserverDeadReckoningOn[PhysicalEntity] : true : mechanism
ObserverDeadReckoningOn[Platform] : true :
SmoothingTime[BaseEntity] : 0.2 : time interval for smoothing [s]
:-------------------------------------------------------------------------------
: Coordinate Transformation
:-------------------------------------------------------------------------------
: Jetzt neu: Wir werfen schon echte Lon/Lat-Koordinaten in den Topf
CoordTrans[algorithm] : null : algorithm
CoordTrans[datafile] : null : datafile for the algorithm
:CoordTrans[algorithm] : database : algorithm
:CoordTrans[datafile] : ProjConf.txt : datafile for the algorithm
:-------------------------------------------------------------------------------
: End of File
:-------------------------------------------------------------------------------
@@ -0,0 +1,261 @@
/**
* Websocket interface to the training area proxy
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2017-01-11
*/
#include "web_socket_handler.h"
#include "main_handler.h"
#include "ngs_handler.h"
#include "ppm_handler.h"
#include <Common/settings.h>
#include <QJsonDocument>
#include <QWebSocket>
namespace HighLevelArchitecture
{
WebSocketHandler::WebSocketHandler(int exerciseId, MainHandler *mainHandler, QObject *parent)
: QObject(parent)
, m_webSocketServer(new QWebSocketServer(QStringLiteral("WLS"), QWebSocketServer::NonSecureMode, this))
, m_mainHandler(mainHandler)
, m_exerciseId(exerciseId)
, m_logger(getLogger("WebSocketHandler"))
{}
WebSocketHandler::~WebSocketHandler()
{
for (const auto &s : qAsConst(m_webSockets))
s->disconnect(this);
}
bool WebSocketHandler::init(quint16 listenPort)
{
if (!m_webSocketServer->listen(QHostAddress::Any, listenPort))
{
WARNING_LOG(m_logger) << "Can not listen on port " << listenPort << " - aborting";
return false;
}
connect(m_webSocketServer, &QWebSocketServer::newConnection,
this, &WebSocketHandler::onNewConnection);
return true;
}
bool WebSocketHandler::sendTelegramInternal(const TrainingAreaBase::TetraIcd::TrainingAreaTelegram *data,
const QString &type, int exerciseId)
{
QJsonObject obj;
obj[QStringLiteral("data")] = data->toJson();
obj[QStringLiteral("type")] = type;
obj[QStringLiteral("typeId")] = data->id();
// if (data->id() != TrainingAreaBase::TetraIcd::TelegramId::BESTAETIGUNG)
// obj[QStringLiteral("counter")] = m_sendCounter++;
const QString jsonStr = QString::fromUtf8(QJsonDocument(obj).toJson(QJsonDocument::Compact));
DEBUG_LOG(m_logger) << "jsonStr: " << jsonStr;
bool bOk = false;
for (auto wsw : qAsConst(m_webSockets))
{
if (wsw->sendTextMessage(jsonStr, exerciseId))
bOk = true;
}
return bOk;
}
void WebSocketHandler::sendHlaConnectionState()
{
// send wls connection state (to all web sockets, should not hurt much)
TrainingAreaBase::TetraIcd::ProxyConnectionState connState;
connState.connectedToSystem = m_mainHandler->isConnectedToHla();
sendTelegram(&connState, m_exerciseId);
DEBUG_LOG(m_logger) << "sendHlaConnectionState, isConnected: " << connState.connectedToSystem;
}
void WebSocketHandler::sendParticipantConnectionStates()
{
DEBUG_LOG(m_logger) << "sendParticipantConnectionStates";
TrainingAreaBase::TetraIcd::WlsParticipantsConnectionState partConnState;
partConnState.equipmentNumber = -1;
partConnState.dataCommunicationPossible = false;
sendTelegram(&partConnState, m_exerciseId);
if (!m_mainHandler->isConnectedToHla())
{
INFO_LOG(m_logger) << "We are (not) yet connected to HLA - don't send participant connection states";
return;
}
const auto externalEquipmentNumbers = m_mainHandler->ngsHandler()->ppmHandler()->externalEquipmentNumbers();
for (int equipNo : externalEquipmentNumbers)
{
partConnState.equipmentNumber = equipNo;
partConnState.dataCommunicationPossible = true;
sendTelegram(&partConnState, m_exerciseId);
}
}
void WebSocketHandler::onExternalEquipmentNumberAdded(int equipNo)
{
sendDataCommunicationState(equipNo, true);
}
void WebSocketHandler::onExternalEquipmentNumberRemoved(int equipNo)
{
sendDataCommunicationState(equipNo, false);
}
void WebSocketHandler::sendDataCommunicationState(int equipNo, bool bIsAvailable)
{
TrainingAreaBase::TetraIcd::WlsParticipantsConnectionState tele;
tele.equipmentNumber = equipNo;
tele.dataCommunicationPossible = bIsAvailable;
sendTelegram(&tele, m_exerciseId);
}
void WebSocketHandler::onNewConnection()
{
QWebSocket *ws = m_webSocketServer->nextPendingConnection();
if (!ws)
return;
DEBUG_LOG(m_logger) << "New websocket connection from " << ws->peerAddress().toString() << ":" << ws->peerPort();
auto wsw = std::make_shared<WebSocketWrapper>(ws);
connect(wsw.get(), &WebSocketWrapper::textMessageReceived,
this, &WebSocketHandler::onTextMessageReceived);
connect(ws, &QWebSocket::disconnected,
this, &WebSocketHandler::onWebSocketDisconnected);
m_webSockets += wsw;
}
void WebSocketHandler::onTextMessageReceived(const QByteArray &baJson)
{
using namespace TrainingAreaBase::TetraIcd;
TRACE_LOG(m_logger) << "WebSocketHandler::onTextMessageReceived: " << baJson;
WebSocketWrapper *wsw = qobject_cast<WebSocketWrapper *>(sender());
if (!wsw)
{
ERROR_LOG(m_logger) << "Internal error - sender is no WebSocketWrapper";
return;
}
if (baJson.isEmpty())
return;
const QJsonObject obj = QJsonDocument::fromJson(baJson).object();
// const QJsonValue sendCounter = obj.value(QStringLiteral("counter"));
// if (!sendCounter.isUndefined())
// {
// if (!sendCounter.isDouble())
// return false;
// recvCounter = sendCounter.toInt(-1);
// DEBUG_LOG(m_logger) << "Incoming telegram with Id " << obj.value(QStringLiteral("type")).toString();
// if (recvCounter < 0)
// return false;
// }
const QJsonValue typeId = obj.value(QStringLiteral("typeId"));
if (!typeId.isDouble())
{
ERROR_LOG(m_logger) << "Can not read type id: " << baJson;
return;
}
const QJsonObject data = obj.value(QStringLiteral("data")).toObject();
try
{
switch (typeId.toInt())
{
case Constraints<ExerciseStateData>::id(): // 2008
wsw->setExerciseId(ExerciseStateData::fromJson(data).exerciseId);
if (m_exerciseId == wsw->exerciseId())
{
sendParticipantConnectionStates();
sendHlaConnectionState();
}
break;
case Constraints<ExerciseEquipmentAssignmentComplete>::id(): // 2012
// not interesed in atm but here to not create a warning in the logfile
break;
case Constraints<Init>::id(): // 1
emit initRequest(Init::fromJson(data));
break;
case Constraints<CesHitInformation>::id(): // 211
emit cesHitInformationRequest(CesHitInformation::fromJson(data));
break;
case Constraints<DemandVulnerabilityStateChange>::id(): // 54
emit vulnerabilityStateRequest(DemandVulnerabilityStateChange::fromJson(data));
break;
default:
WARNING_LOG(m_logger) << "Handler for telegram Id " << typeId.toInt()
<< " not yet implemented (" << baJson << ")";
return;
}
}
catch (const std::exception &e)
{
WARNING_LOG(m_logger) << "Could not parse json: " << e.what() << " (" << baJson << ")";
return;
}
}
void WebSocketHandler::onWebSocketDisconnected()
{
QWebSocket *ws = qobject_cast<QWebSocket *>(sender());
if (!ws)
return;
for (auto it = m_webSockets.begin(); it != m_webSockets.end(); ++it)
{
auto wsw = *it;
if (wsw->webSocket() == ws)
{
m_webSockets.erase(it);
break;
}
}
}
//
// WebSocketWrapper
//
WebSocketWrapper::WebSocketWrapper(QWebSocket *ws)
: m_webSocket(ws)
, m_exerciseId(-1)
{
connect(m_webSocket, &QWebSocket::textMessageReceived,
this, &WebSocketWrapper::onTextMessageReceived);
}
WebSocketWrapper::~WebSocketWrapper()
{
if (m_webSocket)
{
m_webSocket->disconnect(this);
m_webSocket->close();
}
delete m_webSocket;
}
bool WebSocketWrapper::sendTextMessage(const QString &msg, int exerciseId)
{
if (m_exerciseId != exerciseId && exerciseId != 0 && m_exerciseId != -1)
return false;
m_webSocket->sendTextMessage(msg);
return true;
}
void WebSocketWrapper::setExerciseId(int exerciseId)
{
m_exerciseId = exerciseId;
}
void WebSocketWrapper::onTextMessageReceived(const QString &data)
{
emit textMessageReceived(data.toUtf8());
}
} // namespace HighLevelArchitecture
@@ -0,0 +1,99 @@
/**
* Websocket interface to the training area proxy
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2017-01-11
*/
#pragma once
#include <QObject>
#include <QQueue>
#include <QWebSocketServer>
#include <memory>
#include <TrainingAreaBase/training_area_telegrams.h>
#include <Common/logger.h>
namespace HighLevelArchitecture
{
class MainHandler;
class WebSocketWrapper;
class WebSocketHandler : public QObject
{
Q_OBJECT
public:
explicit WebSocketHandler(int exerciseId, MainHandler *mainHandler, QObject *parent = nullptr);
~WebSocketHandler();
bool init(quint16 listenPort);
bool isConnected() const
{
return !m_webSockets.isEmpty();
}
template <typename T>
bool sendTelegram(const T *data, int exerciseId)
{
if (!isConnected() || !data || m_webSockets.isEmpty())
return false;
return sendTelegramInternal(data,
TrainingAreaBase::TetraIcd::Constraints<T>::type(),
exerciseId);
}
Q_SIGNALS:
void initRequest(const TrainingAreaBase::TetraIcd::Init &request);
void vulnerabilityStateRequest(const TrainingAreaBase::TetraIcd::DemandVulnerabilityStateChange &request);
void cesHitInformationRequest(const TrainingAreaBase::TetraIcd::CesHitInformation &request);
public Q_SLOTS:
void sendHlaConnectionState();
void sendParticipantConnectionStates();
void onExternalEquipmentNumberAdded(int equipNo);
void onExternalEquipmentNumberRemoved(int equipNo);
private:
void sendDataCommunicationState(int equipNo, bool bIsAvailable);
bool sendTelegramInternal(const TrainingAreaBase::TetraIcd::TrainingAreaTelegram *data,
const QString &type, int exerciseId);
private Q_SLOTS:
void onNewConnection();
void onWebSocketDisconnected();
void onTextMessageReceived(const QByteArray &baJson);
private:
QWebSocketServer *m_webSocketServer;
QVector<std::shared_ptr<WebSocketWrapper>> m_webSockets;
MainHandler *m_mainHandler;
int m_exerciseId;
LOGGER_T m_logger;
};
class WebSocketWrapper : public QObject
{
Q_OBJECT
public:
explicit WebSocketWrapper(QWebSocket *ws);
~WebSocketWrapper();
bool sendTextMessage(const QString &msg, int exerciseId);
void setExerciseId(int exerciseId);
int exerciseId() const { return m_exerciseId; }
QWebSocket *webSocket() const { return m_webSocket; }
Q_SIGNALS:
void textMessageReceived(const QByteArray &data);
private Q_SLOTS:
void onTextMessageReceived(const QString &data);
private:
QWebSocket *m_webSocket;
int m_exerciseId;
};
} // namespace HighLevelArchitecture
+14
View File
@@ -0,0 +1,14 @@
#
# $Id$
# $HeadURL$
# $Author:
#
ADD_SUBDIRECTORY(Common)
IF (NGS_IS_GUEZ)
ADD_SUBDIRECTORY(Guez)
ELSEIF(NGS_IS_AHTC)
ADD_SUBDIRECTORY(Apache)
ELSE()
MESSAGE(FATAL_ERROR "Unknown NGS type found (neither Apache nor GUEZ)")
ENDIF()
+57
View File
@@ -0,0 +1,57 @@
#
# $Id$
# $HeadURL$
# $Author$
#
#
# --- Library HlaCommon -------------------------------------------------
#
SET(SRCS_exe
logger.cpp
logger.h
player_callback.cpp
player_callback.h
settings.cpp
settings.h
identifierstruct.cpp
identifierstruct.h
typestruct.cpp
typestruct.h
participantposition.cpp
participantposition.h
participantinformation.cpp
participantinformation.h
)
# Due to debug output for EntityTypeStruct
SET_SOURCE_FILES_PROPERTIES(ngs_connector.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE)
NGL_ADD_LIBRARY2(HLA HlaCommon SHARED ${SRCS_exe})
NGL_TARGET_INCLUDE_DIRECTORIES(HlaCommon
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../
)
NGL_TARGET_LINK_LIBRARIES(HlaCommon
LtsCoordTrans # ParticipantPosition
NGLLogger
nglsettings
Qt5::Core
svcPpmClient # ParticipantInformation
svcPpmCommon
ngltools # NGL::findProjectConfigFiles
NGS::NGS
ddsconnector
# RTI::nddsc
# RTI::nddscpp2
)
#NGL_INSTALL(AAR SV FILES
# log4cxx_hla.props
# swconf.cfg
# DESTINATION bin)
#NGL_INSTALL(AAR SV FILES
# RPRFOM20d17E_guez.xml
# DESTINATION bin RENAME RPRFOM20d17E.xml)
#NGL_ADD_TARGET_LINK(HlaCommon pHLA)
@@ -0,0 +1,89 @@
/**
* Helper Class for handling Entity IdentifierStructs
* $Id$
* $HeadURL$
* $Author$
* Created by Malte Diers, NLE, 2019-07-11
*/
#include "identifierstruct.h"
#include "settings.h"
#include <EntityIdentifierStruct.h>
namespace HighLevelArchitecture
{
quint16 IdentifierStruct::s_nextId = 1;
quint16 IdentifierStruct::s_ownSiteId = 1;
IdentifierStruct::IdentifierStruct(const rpr2::EntityIdentifierStruct &eis)
: m_siteId(eis.FederateIdentifier.SiteID)
{
setSiteId(eis.FederateIdentifier.SiteID);
setApplicationId(eis.FederateIdentifier.ApplicationID);
setEntityNumber(eis.EntityNumber);
}
rpr2::EntityIdentifierStruct IdentifierStruct::toEIS() const
{
rpr2::EntityIdentifierStruct eis;
eis.FederateIdentifier.SiteID = siteId();
eis.FederateIdentifier.ApplicationID = applicationId();
eis.EntityNumber = entityNumber();
return eis;
}
void IdentifierStruct::makeOwn()
{
setSiteId(ownSiteId());
setApplicationId(ownApplicationId());
}
QString IdentifierStruct::toString() const
{
return QStringLiteral("[Site %1 | Application: %2 | Entity %3]")
.arg(siteId())
.arg(applicationId())
.arg(entityNumber());
}
qint64 IdentifierStruct::toInt64() const
{
quint64 res = 0;
res += siteId();
res <<= 16;
res += applicationId();
res <<= 16;
res += entityNumber();
return static_cast<qint64>(res);
}
IdentifierStruct IdentifierStruct::fromInt64(qint64 value)
{
const quint64 uvalue = static_cast<quint64>(value);
IdentifierStruct is;
if ((uvalue >> 32) == 0)
is.setSiteId(ownSiteId());
else
is.setSiteId((uvalue >> 32) & 0xffffU);
if (((uvalue >> 16) & 0xffffU) == 0)
is.setApplicationId(ownApplicationId());
else
is.setApplicationId((uvalue >> 16 & 0xffffU));
is.setEntityNumber(uvalue & 0xffffU);
return is;
}
quint16 IdentifierStruct::ownSiteId()
{
return s_ownSiteId;
}
quint16 IdentifierStruct::ownApplicationId()
{
static const int s_applicationId = Settings::applicationId();
return s_applicationId;
}
} // namespace
@@ -0,0 +1,69 @@
/**
* Helper Class for handling Entity IdentifierStructs
* $Id$
* $HeadURL$
* $Author$
* Created by Malte Diers, NLE, 2019-07-11
*/
#pragma once
#include <QString>
#include <Common/hlacommon_export.h>
namespace rpr2
{
class EntityIdentifierStruct;
}
namespace HighLevelArchitecture
{
class HLACOMMON_EXPORT IdentifierStruct
{
public:
IdentifierStruct() = default;
explicit IdentifierStruct(quint16 equipmentNo)
: m_siteId(ownSiteId())
, m_applicationId(ownApplicationId())
, m_entityNumber(equipmentNo)
{}
explicit IdentifierStruct(const rpr2::EntityIdentifierStruct &eis);
static IdentifierStruct fromInt64(qint64 value);
quint16 siteId() const { return m_siteId; }
void setSiteId(quint16 siteId) { m_siteId = siteId; }
quint16 applicationId() const { return m_applicationId; }
void setApplicationId(quint16 applicationId) { m_applicationId = applicationId; }
quint16 entityNumber() const { return m_entityNumber; }
void setEntityNumber(quint16 entityNumber) { m_entityNumber = entityNumber; }
static quint16 ownSiteId();
static void setOwnSiteId(quint16 siteId) { s_ownSiteId = siteId; }
rpr2::EntityIdentifierStruct toEIS() const;
QString toString() const;
qint64 toInt64() const;
bool isOwnElement() const { return siteId() == ownSiteId() && applicationId() == ownApplicationId(); }
void makeOwn();
bool isNull() const { return (m_siteId == 0 && m_applicationId == 0 && m_entityNumber == 0); }
static quint16 getNextId() { return s_nextId++; }
private:
quint16 m_siteId = 0;
quint16 m_applicationId = 0;
quint16 m_entityNumber = 0;
static quint16 ownApplicationId();
static quint16 s_nextId;
static quint16 s_ownSiteId;
};
}
+38
View File
@@ -0,0 +1,38 @@
/**
* @RDE_HEADER@
* Logging for HighLevelArchitecture
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2017-04-07
*/
#include "logger.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
namespace HighLevelArchitecture
{
LOGGER_T getLogger(const char *name)
{
static const char ns[] = "HLA.";
std::string loggerName;
const size_t len = strlen(name);
loggerName.reserve(sizeof(ns) + len);
loggerName.append(ns, sizeof(ns) - 1);
loggerName.append(name, len);
try
{
return NGL::NGLLoggerBootstrap::getNGLRootLogger().
getNGLLogger(loggerName);
}
catch (const std::exception &ex)
{
fprintf(stderr, "Error retrieving logger: %s", ex.what());
abort();
}
}
} // namespace HighLevelArchitecture
+24
View File
@@ -0,0 +1,24 @@
/**
* @RDE_HEADER@
* Logging for HighLevelArchitecture
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2017-04-07
*/
#pragma once
#include <Common/hlacommon_export.h>
#include <NGLLogger/INGLLogger.h>
namespace HighLevelArchitecture
{
using LOGGER_T = NGL::INGLLogger &;
HLACOMMON_EXPORT LOGGER_T getLogger(const char *name);
inline LOGGER_T getLogger(const QString &loggerName)
{
return getLogger(loggerName.toUtf8().constData());
}
} // namespace HighLevelArchitecture
@@ -0,0 +1,26 @@
/**
* Helper Class for handling Participant Information
* $Id$
* $HeadURL$
* $Author$
* Created by Malte Diers, NLE, 2019-07-11
*/
#include "participantinformation.h"
#include <ParticipantManagement/ppm.hpp>
namespace HighLevelArchitecture {
ParticipantInformation::ParticipantInformation(const ParticipantManagement::Participant &participant,
const TypeStruct &_typestruct,
const ParticipantPosition &_position)
: participantId(participant.id())
, equipmentNo(participant.equipmentNumber().is_set() ? participant.equipmentNumber().get() : 0)
, partyId(participant.partyId())
, parentId(participant.superiorId())
, typeStruct(_typestruct)
, designator(QString::fromStdString(participant.designator()))
, position(_position)
{}
} // Namespace HLA
@@ -0,0 +1,37 @@
/**
* Helper Class for handling Participant Information
* $Id$
* $HeadURL$
* $Author$
* Created by Malte Diers, NLE, 2019-07-11
*/
#pragma once
#include "participantposition.h"
#include "typestruct.h"
#include <Common/hlacommon_export.h>
namespace ParticipantManagement
{
class Participant;
}
namespace HighLevelArchitecture
{
struct HLACOMMON_EXPORT ParticipantInformation
{
int participantId = 0;
int equipmentNo = 0;
int partyId = 0;
int parentId = 0;
HighLevelArchitecture::TypeStruct typeStruct;
QString designator;
HighLevelArchitecture::ParticipantPosition position;
ParticipantInformation(const ParticipantManagement::Participant &participant, const TypeStruct &_typestruct, const ParticipantPosition &_position);
};
}
@@ -0,0 +1,62 @@
/**
* Helper Class for handling (Participant) Positions
* $Id$
* $HeadURL$
* $Author$
* Created by Malte Diers, NLE, 2019-07-11
*/
#include "participantposition.h"
#include <LtsCoordTrans/lts_coord_trans.h>
namespace HighLevelArchitecture
{
//
// ParticipantPosition
//
rpr2::WorldLocationStruct ParticipantPosition::toWorldLocation() const
{
rpr2::WorldLocationStruct wl;
LtsCoordTrans::lonLatAltToGeocentric(lon, lat, -z, wl.X, wl.Y, wl.Z);
return wl;
}
QString ParticipantPosition::toString(bool mgrs) const
{
if (!mgrs)
return QStringLiteral("lon: %1, lat: %2, z: %3").arg(lon).arg(lat).arg(z);
const LtsCoordTrans::UtmCoordinate c1(LtsCoordTrans::UtmCoordinate::fromGeographic(lon, lat));
return QStringLiteral("MGRS: %1, Z: %2").arg(c1.mgrs()).arg(z);
}
bool ParticipantPosition::hasMoved(const ParticipantPosition &other) const
{
const LtsCoordTrans::UtmCoordinate c1(LtsCoordTrans::UtmCoordinate::fromGeographic(lon, lat));
const LtsCoordTrans::UtmCoordinate c2(LtsCoordTrans::UtmCoordinate::fromGeographic(other.lon, other.lat));
if (c1.zone != c2.zone)
return true;
if (std::abs(c1.x - c2.x) > 1)
return true;
if (std::abs(c1.y - c2.y) > 1)
return true;
return false;
}
bool ParticipantPosition::isNull() const
{
return (qFuzzyIsNull(lon) && qFuzzyIsNull(lat));
}
ParticipantPosition::ParticipantPosition(const rpr2::WorldLocationStruct &wl)
{
LtsCoordTrans::geocentric2LonLatAlt(wl.X, wl.Y, wl.Z, lon, lat, z);
z *= -1;
}
} // Namespace
@@ -0,0 +1,47 @@
/**
* Helper Class for handling (Participant) Positions
* $Id$
* $HeadURL$
* $Author$
* Created by Malte Diers, NLE, 2019-07-11
*/
#pragma once
#include <WorldLocationStruct.h>
#include <QString>
#include <QPointF>
#include <Core/core.hpp>
#include <Common/hlacommon_export.h>
namespace HighLevelArchitecture
{
struct HLACOMMON_EXPORT ParticipantPosition
{
// lon/lat
double lon = 0;
double lat = 0;
double z = 0;
qint64 msec = 0;
ParticipantPosition() = default;
explicit inline ParticipantPosition(const QPointF &data)
: lon(data.x()), lat(data.y()) {}
explicit ParticipantPosition(const rpr2::WorldLocationStruct &wl);
explicit inline ParticipantPosition(const Core::GeoPosition &data, qint64 msecsSinceEpoch = 0)
: lon(data.lon()), lat(data.lat()), z(data.z()), msec(msecsSinceEpoch) {}
explicit inline ParticipantPosition(const Core::GeoPosition2D &data, qint64 msecsSinceEpoch = 0)
: lon(data.lon()), lat(data.lat()), msec(msecsSinceEpoch) {}
bool hasMoved(const ParticipantPosition &other) const;
bool isNull() const;
rpr2::WorldLocationStruct toWorldLocation() const;
QString toString(bool mgrs = true) const;
inline Core::GeoPosition2D toGeoPosition2D() const { return Core::GeoPosition2D(lon, lat); }
inline Core::GeoPosition toGeoPosition() const { return Core::GeoPosition(lon, lat, z); }
inline QPointF toPoint() const { return QPointF(lon,lat); }
};
}
@@ -0,0 +1,25 @@
/**
* @RDE_HEADER@
* Small callback to NullPlayerCallback to be able to recognize the first tick (which then triggers initialization)
* $Id$
* $HeadURL$
* $Author$
*/
#include "player_callback.h"
namespace HighLevelArchitecture
{
void PlayerCallback::tick()
{
NullPlayerCallback::tick();
if (!m_bFirstTick)
{
m_bFirstTick = true;
emit firstTick();
}
}
} // namespace HighLevelArchitecture
+33
View File
@@ -0,0 +1,33 @@
/**
* @RDE_HEADER@
* Small callback to NullPlayerCallback to be able to recognize the first tick (which then triggers initialization)
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <QObject>
#include <NullPlayerCallback.h>
#include <Common/hlacommon_export.h>
/*
* Simple callback for the player instance
*/
namespace HighLevelArchitecture
{
class HLACOMMON_EXPORT PlayerCallback final : public QObject, public ngs::NullPlayerCallback
{
Q_OBJECT
public:
PlayerCallback() = default;
void tick() override;
Q_SIGNALS:
void firstTick();
protected:
bool m_bFirstTick = false;
};
} // namespace HighLevelArchitecture
+145
View File
@@ -0,0 +1,145 @@
/**
* Settings for TetraRadio
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2017-04-07
*/
#include "settings.h"
#include <QtCore/QSettings>
#include <nglsettings/nglsettings_settings.h>
#include <ngltools/ngltools_filesystem.h>
namespace HighLevelArchitecture
{
class NGLSettingsClass : public NGL::Settings
{
public:
NGLSettingsClass()
: NGL::Settings(s_iniFile.isEmpty() ? NGL::findProjectConfigFile() : s_iniFile)
{}
static void setIniFile(const QString &fn)
{
s_iniFile = fn;
}
static QString s_iniFile;
};
QString NGLSettingsClass::s_iniFile;
Q_GLOBAL_STATIC(NGLSettingsClass, s)
//-----------------------------------------------------------------------------
NGL::Settings *Settings::settings()
{
return s();
}
//-----------------------------------------------------------------------------
void Settings::setIniFile(const QString &ini)
{
NGLSettingsClass::setIniFile(ini);
}
QString Settings::federationName()
{
return s()->settings()->value(QLatin1String("hla/FederationName"), QLatin1String("22")).toString();
}
ngs::IObserver::ProtocolType Settings::hlaProtocol()
{
QString protocol = s()->settings()->value(QLatin1String("hla/Protocol"), QLatin1String("HLA")).toString().toUpper();
if (protocol == QLatin1String("HLA"))
return ngs::IObserver::HLA;
if (protocol == QLatin1String("DIS"))
return ngs::IObserver::DIS;
// default CORBANOTIFY
return ngs::IObserver::CORBANOTIFY;
}
quint16 Settings::siteId()
{
return s()->settings()->value(QLatin1String("hla/SiteId"), 201).toInt();
}
quint16 Settings::applicationId()
{
return s()->settings()->value(QLatin1String("hla/ApplicationId"), 100).toInt();
}
int Settings::guezHitGraceTimeMSecs()
{
return s()->settings()->value(QLatin1String("hla/guezHitGraceTimeMSecs"), 1000).toInt();
}
QString Settings::fomIdentifier()
{
return s()->settings()->value(QLatin1String("hla/FomIdentifier"), QLatin1String("Saab")).toString();
}
QString Settings::rtiIdentifier()
{
return s()->settings()->value(QLatin1String("hla/RtiIdentifier"), QLatin1String("MAK")).toString();
}
QString Settings::swConfFileName()
{
return s()->settings()->value(QLatin1String("hla/SwConfFileName"), QLatin1String("swconf.cfg")).toString();
}
quint16 Settings::webSocketListenPort()
{
// TODO
return s()->settings()->value(QLatin1String("hla/webSocketListenPort"), 12347).toInt();
}
quint16 Settings::hlaPlayerIdIDT()
{
return s()->settings()->value(QLatin1String("hla/PlayerIdIDT"), 32001).toUInt();
}
quint16 Settings::hlaPlayerIdExcon()
{
return s()->settings()->value(QLatin1String("hla/PlayerIdExcon"), 32002).toUInt();
}
QByteArray Settings::hlaLicenseServer()
{
QByteArray ba = s()->settings()->value(QLatin1String("hla/LicenseServer"), QLatin1String("@192.168.99.100")).toByteArray();
if (!ba.contains('@'))
ba.prepend('@');
return ba;
}
Settings::Orientation Settings::spatialStructOrientation()
{
Orientation orientation;
orientation.phi = s()->settings()->value(QLatin1String("hla/SpatialStructOrientation/Phi" ), 3.138309f).toFloat();
orientation.psi = s()->settings()->value(QLatin1String("hla/SpatialStructOrientation/Psi" ), 2.446645f).toFloat();
orientation.theta = s()->settings()->value(QLatin1String("hla/SpatialStructOrientation/Theta"), -0.879588f).toFloat();
return orientation;
}
QVector<Settings::SocketData> Settings::socketDataList()
{
int size = s()->settings()->beginReadArray(QLatin1String("hla/SocketReaders"));
QVector<SocketData> list;
list.reserve(size);
for (int i = 0; i < size; ++i)
{
SocketData sd;
s()->settings()->setArrayIndex(i);
sd.port = s()->settings()->value(QLatin1String("Port")).toInt();
sd.hostname = s()->settings()->value(QLatin1String("Hostname")).toString();
sd.hlaRequestIdentifier = s()->settings()->value(QLatin1String("HlaRequestIdentifier")).toInt();
list.append(sd);
}
s()->settings()->endArray();
return list;
}
} // namespace HighLevelArchitecture
+72
View File
@@ -0,0 +1,72 @@
/**
* Settings for TetraRadio
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2017-04-07
*/
#pragma once
#include <QString>
#include <IObserver.h>
#include <Common/hlacommon_export.h>
namespace NGL
{
class Settings;
}
namespace HighLevelArchitecture
{
namespace Settings
{
struct SocketData {
int port;
QString hostname;
int hlaRequestIdentifier;
};
struct Orientation
{
float phi = 0.;
float psi = 0.;
float theta = 0.;
Orientation(float _phi, float _psi, float _theta): phi(_phi), psi(_psi), theta(_theta){}
Orientation(){}
};
//!< The real NGL::Settings - object
NGL::Settings *settings();
HLACOMMON_EXPORT void setIniFile(const QString &ini);
HLACOMMON_EXPORT QString federationName();
HLACOMMON_EXPORT ngs::IObserver::ProtocolType hlaProtocol();
quint16 siteId();
quint16 applicationId();
HLACOMMON_EXPORT int guezHitGraceTimeMSecs();
HLACOMMON_EXPORT QString fomIdentifier();
HLACOMMON_EXPORT QString rtiIdentifier();
HLACOMMON_EXPORT QString swConfFileName();
HLACOMMON_EXPORT QByteArray hlaLicenseServer();
HLACOMMON_EXPORT Orientation spatialStructOrientation();
HLACOMMON_EXPORT quint16 webSocketListenPort();
HLACOMMON_EXPORT quint16 hlaPlayerIdIDT();
HLACOMMON_EXPORT quint16 hlaPlayerIdExcon();
HLACOMMON_EXPORT QVector<SocketData> socketDataList();
}
} // namespace HighLevelArchitecture
+209
View File
@@ -0,0 +1,209 @@
/**
* Helper Class for handling (Entity) Type Structs
* $Id$
* $HeadURL$
* $Author$
* Created by Malte Diers, NLE, 2019-07-11
*/
#include "typestruct.h"
#include "settings.h"
#include <EntityTypeStruct.h>
#include <QStringList>
#include <QVector>
namespace HighLevelArchitecture
{
TypeStruct::TypeStruct(const rpr2::EntityTypeStruct &eis)
{
setEntityKind(eis.EntityKind);
setDomain(eis.Domain);
setCountryCode(eis.CountryCode);
setCategory(eis.Category);
setSubcategory(eis.Subcategory);
setSpecific(eis.Specific);
setExtra(eis.Extra);
}
TypeStruct TypeStruct::fromString(const QString &string)
{
const QVector<QStringRef> sl = string.splitRef(QLatin1Char('.'));
TypeStruct ts;
bool bOk;
const int size = sl.size();
if (size <= 0)
return ts;
int val = sl[0].toInt(&bOk);
if (!bOk || val > 255 || val < 0)
{
Q_ASSERT(false);
return TypeStruct();
}
ts.setEntityKind(val);
if (size <= 1)
return ts;
val = sl[1].toInt(&bOk);
if (!bOk || val > 255 || val < 0)
{
Q_ASSERT(false);
return TypeStruct();
}
ts.setDomain(val);
if (size <= 2)
return ts;
val = sl[2].toUShort(&bOk);
if (!bOk)
{
Q_ASSERT(false);
return TypeStruct();
}
ts.setCountryCode(val);
if (size <= 3)
return ts;
val = sl[3].toInt(&bOk);
if (!bOk || val > 255 || val < 0)
{
Q_ASSERT(false);
return TypeStruct();
}
ts.setCategory(val);
if (size <= 4)
return ts;
val = sl[4].toInt(&bOk);
if (!bOk || val > 255 || val < 0)
{
Q_ASSERT(false);
return TypeStruct();
}
ts.setSubcategory(val);
if (size <= 5)
return ts;
val = sl[5].toInt(&bOk);
if (!bOk || val > 255 || val < 0)
{
Q_ASSERT(false);
return TypeStruct();
}
ts.setSpecific(val);
if (size <= 6)
return ts;
val = sl[6].toInt(&bOk);
if (!bOk || val > 255 || val < 0)
{
Q_ASSERT(false);
return TypeStruct();
}
ts.setExtra(val);
return ts;
}
// Todo: Store all DisEntities? To have it for "operator==" or "isAbout(OTHER)" ?!?
TypeStruct TypeStruct::fromDisString(const QString &disString)
{
QString str = disString.split(QLatin1Char('.')).first(); // Sometimes, there are 2 or more DIS Entities, separated by "."
str.prepend(QString(21 - str.size(), QLatin1Char('0')));
// ETS = 3001222001246001000 -> 003001222001246001000 -> 003 001 222 001 246 001 000 -> 3.1.222.1.246.1.0
TypeStruct ts;
int etsInteger[7];
bool bOk;
for (int i = 0; i < 7; ++i)
{
etsInteger[i] = str.midRef(3 * i, 3).toInt(&bOk);
if (!bOk)
return ts;
}
int i = 0;
ts.setEntityKind(etsInteger[i++]);
ts.setDomain(etsInteger[i++]);
ts.setCountryCode(etsInteger[i++]);
ts.setCategory(etsInteger[i++]);
ts.setSubcategory(etsInteger[i++]);
ts.setSpecific(etsInteger[i++]);
ts.setExtra(etsInteger[i++]);
return ts;
}
TypeStruct TypeStruct::fromDisInt(qint64 value)
{
TypeStruct ts;
ts.setExtra(value % 1000);
value /= 1000;
ts.setSpecific(value % 1000);
value /= 1000;
ts.setSubcategory(value % 1000);
value /= 1000;
ts.setCategory(value % 1000);
value /= 1000;
ts.setCountryCode(value % 1000);
value /= 1000;
ts.setDomain(value % 1000);
value /= 1000;
ts.setEntityKind(value % 1000);
return ts;
}
TypeStruct TypeStruct::fromULong(quint64 value)
{
TypeStruct ts;
ts.setEntityKind (( value & 0xFF00000000000000) >> 56);
ts.setDomain (( value & 0x00FF000000000000) >> 48);
ts.setCountryCode(( value & 0x0000FFFF00000000) >> 32);
ts.setCategory (( value & 0x00000000FF000000) >> 24);
ts.setSubcategory(( value & 0x0000000000FF0000) >> 16);
ts.setSpecific (( value & 0x000000000000FF00) >> 8);
ts.setExtra (( value & 0x00000000000000FF) >> 0);
return ts;
}
rpr2::EntityTypeStruct TypeStruct::toETS() const
{
rpr2::EntityTypeStruct ets;
ets.EntityKind = entityKind();
ets.Domain = domain();
ets.CountryCode = countryCode();
ets.Category = category();
ets.Subcategory = subcategory();
ets.Specific = specific();
ets.Extra = extra();
return ets;
}
QString TypeStruct::toString() const
{
const QStringList sl({QString::number(entityKind()),
QString::number(domain()),
QString::number(countryCode()),
QString::number(category()),
QString::number(subcategory()),
QString::number(specific()),
QString::number(extra())});
return sl.join(QLatin1Char('.'));
}
} // Namespace
+66
View File
@@ -0,0 +1,66 @@
/**
* Helper Class for handling (Entity) Type Structs
* $Id$
* $HeadURL$
* $Author$
* Created by Malte Diers, NLE, 2019-07-11
*/
#pragma once
#include <QString>
#include <Common/hlacommon_export.h>
namespace rpr2
{
class EntityTypeStruct;
}
namespace HighLevelArchitecture
{
class HLACOMMON_EXPORT TypeStruct
{
public:
TypeStruct() = default;
explicit TypeStruct(const rpr2::EntityTypeStruct &eis);
static TypeStruct fromString(const QString &string); // 1.2.3.4.5.6.7
static TypeStruct fromDisString(const QString &disString); // 001002003004005006007
static TypeStruct fromDisInt(qint64 value); // 1002003004005006007
static TypeStruct fromULong(quint64 value); // single data squeezed into ULong
rpr2::EntityTypeStruct toETS() const;
QString toString() const;
quint8 entityKind() const { return m_entityKind; }
void setEntityKind(quint8 entityKind) { m_entityKind = entityKind; }
quint8 domain() const { return m_domain; }
void setDomain(quint8 domain) { m_domain = domain; }
quint16 countryCode() const { return m_countryCode; }
void setCountryCode(quint16 countryCode) { m_countryCode = countryCode; }
quint8 category() const { return m_category; }
void setCategory(quint8 category) { m_category = category; }
quint8 subcategory() const { return m_subcategory; }
void setSubcategory(quint8 subcategory) { m_subcategory = subcategory; }
quint8 specific() const { return m_specific; }
void setSpecific(quint8 specific) { m_specific = specific; }
quint8 extra() const { return m_extra; }
void setExtra(quint8 extra) { m_extra = extra; }
private:
quint8 m_entityKind = 0;
quint8 m_domain = 0;
quint16 m_countryCode = 0;
quint8 m_category = 0;
quint8 m_subcategory = 0;
quint8 m_specific = 0;
quint8 m_extra = 0;
};
}
+174
View File
@@ -0,0 +1,174 @@
#
# $Id$
# $HeadURL$
# $Author$
#
#
# --- Executable svcHighLevelArchitecture (svcHLA) -------------------------------------------------
#
SET(xml_FILE hla_service.xml)
SET(SRCS_exe
aes_handler.cpp
aes_handler.h
dds_handler.cpp
dds_handler.h
main.cpp
main_handler.cpp
main_handler.h
ngs_connector.cpp
ngs_connector.h
ngs_handler.cpp
ngs_handler.h
# ngs_connector_dis.cpp
# ngs_connector_dis.h
ppm_handler.cpp
ppm_handler.h
# aesmath.cpp
# aesmath.h
damage_model.cpp
damage_model.h
web_socket_handler.cpp
web_socket_handler.h
rpr/rpr_global.h
# rpr/rpr_ia_actionrequest.cpp
# rpr/rpr_ia_actionrequest.h
# rpr/rpr_ia_actionresponse.cpp
# rpr/rpr_ia_actionresponse.h
# rpr/rpr_ia_acknowledge.cpp
# rpr/rpr_ia_acknowledge.h
rpr/rpr_ia_munitiondetonation.cpp
rpr/rpr_ia_munitiondetonation.h
# rpr/rpr_ia_startresume.cpp
# rpr/rpr_ia_startresume.h
# rpr/rpr_ia_stopfreeze.cpp
# rpr/rpr_ia_stopfreeze.h
rpr/rpr_ia_weaponfire.cpp
rpr/rpr_ia_weaponfire.h
rpr/rpr_ia_guez_init.cpp
rpr/rpr_ia_guez_init.h
rpr/rpr_ia_guez_requestbitereport.cpp
rpr/rpr_ia_guez_requestbitereport.h
rpr/rpr_ia_guez_bitereport.cpp
rpr/rpr_ia_guez_bitereport.h
# rpr/rpr_ia_guez_exconengagement.cpp
# rpr/rpr_ia_guez_exconengagement.h
rpr/rpr_ia_guez_hit.cpp
rpr/rpr_ia_guez_hit.h
rpr/rpr_observer_aggregateentity_object_cb.h
rpr/rpr_observer_aggregateentity_object_instance_cb.h
rpr/rpr_observer_aircraft_cb_notifier.h
rpr/rpr_observer_aircraft_object_cb.h
rpr/rpr_observer_aircraft_object_instance_cb.h
rpr/rpr_observer_baseentity_object_cb.h
rpr/rpr_observer_baseentity_object_instance_cb.h
rpr/rpr_observer_groundvehicle_cb_notifier.h
rpr/rpr_observer_groundvehicle_object_cb.h
rpr/rpr_observer_groundvehicle_object_instance_cb.h
rpr/rpr_observer_human_cb_notifier.h
rpr/rpr_observer_human_object_cb.h
rpr/rpr_observer_human_object_instance_cb.h
rpr/rpr_observer_lifeform_object_cb.h
rpr/rpr_observer_lifeform_object_instance_cb.h
rpr/rpr_observer_object_cb.h
rpr/rpr_observer_object_instance_cb.h
rpr/rpr_observer_physicalentity_object_cb.h
rpr/rpr_observer_physicalentity_object_instance_cb.h
rpr/rpr_observer_platform_object_cb.h
rpr/rpr_observer_platform_object_instance_cb.h
# rpr/rpr_observer_surfacevessel_cb_notifier.h
# rpr/rpr_observer_surfacevessel_object_cb.h
# rpr/rpr_observer_surfacevessel_object_instance_cb.h
# rpr/rpr_observer_guez_aircraft_cb_notifier.h
# rpr/rpr_observer_guez_aircraft_object_cb.h
# rpr/rpr_observer_guez_aircraft_object_instance_cb.h
rpr/rpr_observer_guez_groundvehicle_cb_notifier.h
rpr/rpr_observer_guez_groundvehicle_object_cb.h
rpr/rpr_observer_guez_groundvehicle_object_instance_cb.h
rpr/rpr_observer_guez_human_cb_notifier.h
rpr/rpr_observer_guez_human_object_cb.h
rpr/rpr_observer_guez_human_object_instance_cb.h
rpr/rpr_observer_guez_observer_controller_cb_notifier.h
rpr/rpr_observer_guez_observer_controller_object_cb.h
rpr/rpr_observer_guez_observer_controller_object_instance_cb.h
rpr/rpr_observer_environment_object_object_cb.h
rpr/rpr_observer_environment_object_object_instance_cb.h
rpr/rpr_observer_areal_object_object_cb.h
rpr/rpr_observer_areal_object_object_instance_cb.h
rpr/rpr_observer_other_areal_object_object_cb.h
rpr/rpr_observer_other_areal_object_object_instance_cb.h
rpr/rpr_observer_point_object_object_cb.h
rpr/rpr_observer_point_object_object_instance_cb.h
rpr/rpr_observer_other_point_object_object_cb.h
rpr/rpr_observer_other_point_object_object_instance_cb.h
rpr/rpr_observer_guez_minefield_cb_notifier.h
rpr/rpr_observer_guez_minefield_object_cb.h
rpr/rpr_observer_guez_minefield_object_instance_cb.h
rpr/rpr_observer_guez_minefield_breach_cb_notifier.h
rpr/rpr_observer_guez_minefield_breach_object_cb.h
rpr/rpr_observer_guez_minefield_breach_object_instance_cb.h
# rpr/rpr_observer_guez_fire_support_cb_notifier.h
# rpr/rpr_observer_guez_fire_support_object_cb.h
# rpr/rpr_observer_guez_fire_support_object_instance_cb.h
# rpr/rpr_observer_guez_fire_support_single_shot_cb_notifier.h
# rpr/rpr_observer_guez_fire_support_single_shot_object_cb.h
# rpr/rpr_observer_guez_fire_support_single_shot_object_instance_cb.h
# rpr/rpr_observer_guez_chemical_agent_area_cb_notifier.h
# rpr/rpr_observer_guez_chemical_agent_area_object_cb.h
# rpr/rpr_observer_guez_chemical_agent_area_object_instance_cb.h
# rpr/rpr_observer_guez_nuclear_agent_area_cb_notifier.h
# rpr/rpr_observer_guez_nuclear_agent_area_object_cb.h
# rpr/rpr_observer_guez_nuclear_agent_area_object_instance_cb.h
)
# Due to debug output for EntityTypeStruct
SET_SOURCE_FILES_PROPERTIES(ngs_connector.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE)
# make sure xml file is properly installed
CODEGEN_HANDLE_SVC_XML(SRCS_exe ${xml_FILE})
NGL_ADD_SVC_ICON(SRCS_exe)
NGL_ADD_EXECUTABLE(HLA svcHighLevelArchitecture ${SRCS_exe})
NGL_TARGET_LINK_LIBRARIES(svcHighLevelArchitecture
ddsconnector
LtsCommandLineParser
LtsCoordTrans
nglcoreapplication
NGLLogger
nglsettings
Qt5::Core
Qt5::Network
Qt5::WebSockets
svcAesClient
svcCoreClient
svcExmClient
svcPdmClient
svcPpmClient
svcTabServer
svcTabClient
ngltools
LtsUtilsDds
NGS::NGS
HlaCommon
tabTelegrams
)
NGL_INSTALL_TARGET(svcHighLevelArchitecture)
NGL_INSTALL(HLA FILES
log4cxx_hla.props
swconf.cfg
DESTINATION bin)
NGL_INSTALL(HLA FILES
RPRFOM20d17E_saabNov2021.xml
DESTINATION bin RENAME RPRFOM20d17E.xml)
NGL_ADD_TARGET_LINK(svcHighLevelArchitecture pHLA)
NGL_INSTALL(HLA FILES
lts-cc.hla.conf
DESTINATION . RENAME lts-cc.hla.conf.distrib)
File diff suppressed because it is too large. Load diff
+59
View File
@@ -0,0 +1,59 @@
ObjectClass: GuezAircraft: Aircraft // Guez Specific Aircraft
Attribute: TacticalStatus: TacticalStatusStruct // The VBG/VBA/TotalStatus
ObjectClass: GuezGroundVehicle: GroundVehicle // Guez Specific GroundVehicle
Attribute: TacticalStatus: TacticalStatusStruct // The VBG/VBA/TotalStatus
ObjectClass: GuezHuman: Human // Guez Specific Human Lifeform
Attribute: TacticalStatus: TacticalStatusStruct // The VBG/VBA/TotalStatus
ObjectClass: GuezObserverController: Human // Guez Specific Observer / Controller
ObjectClass: GuezChemicalAgentArea: OtherArealObject // Guez Chemical Agent Area
Attribute: AreaEffectSimulationName: OMT13string // name of the AreaEffectSimulation
Attribute: ActivationTime: ClockTimeStruct // GPS ActivationTime
Attribute: Duration: Unsignedinteger32BE // Duration in seconds. 0=unlimited, 1-240 minutes, resolution: 1 minute
Attribute: DetonationLocation: WorldLocationStruct // Optional: Location of the impact of the chemical agent
Attribute: Radius: HLAfloat64BE // Optional: The radius of the chemical area
Attribute: ChemicalAgentType: ChemicalAgentTypeEnum8 // The chemical agent used
Attribute: IsPermanentAgent: HLAboolean // true for a permanent agent, false for a non permanent agent
ObjectClass: GuezFireSupport: OtherArealObject // Guez Fire Support
Attribute: AreaEffectSimulationName: OMT13string // name of the AreaEffectSimulation
Attribute: ActivationTime: ClockTimeStruct // GPS ActivationTime
Attribute: Duration: Unsignedinteger32BE // Duration in seconds. 0=unlimited, 1-1800 seconds
Attribute: Rounds: Unsignedinteger32BE // 1-1000
Attribute: MunitionType: EntityTypeStruct // The munition type used
Attribute: FirePositions: ArrayOfWorldLocationStructDynamicHLAlengthlessVarArray // Positions of the single impacts
Attribute: FireState: ArrayOfHLAoctetN_slsh_AperfectalwaysN_slsh_ADynamicHLApaddingTo32Array // BitArray of the single impacts, whether an impact already occured or not.
ObjectClass: GuezFireSupportSingleShot: OtherPointObject // Guez Fire Support Single Shot
Attribute: AreaEffectSimulationName: OMT13string // name of the AreaEffectSimulation
Attribute: ActivationTime: ClockTimeStruct // GPS ActivationTime
Attribute: DetonationLocation: WorldLocationStruct // Optional: The planned location of the impact. Note: A MunitionDetonation must be sent nevertheless
Attribute: Radius: HLAfloat64BE // The radius of the affected area
Attribute: MunitionType: EntityTypeStruct // The munition type used
ObjectClass: GuezMineField: OtherArealObject // Guez Mine Field
Attribute: AreaEffectSimulationName: OMT13string // name of the AreaEffectSimulation
Attribute: ActivationTime: ClockTimeStruct // GPS ActivationTime
Attribute: Duration: Unsignedinteger32BE // Duration in seconds. 0=unlimited, 1-240 minutes, resolution: 1 minute
Attribute: MineType: EntityTypeStruct //
Attribute: MineCount: Unsignedinteger32BE //
Attribute: MinePositions: ArrayOfWorldLocationStructDynamicHLAlengthlessVarArray //
Attribute: MineState: ArrayOfHLAoctetN_slsh_AperfectalwaysN_slsh_ADynamicHLApaddingTo32Array // BitArray of the single mines, whether mine is already triggered or not.
Attribute: Width: Unsignedinteger32BE // Width of the minefield (segment)
Attribute: Length: Unsignedinteger32BE // Length of the minefield (segment)
ObjectClass: GuezMineFieldBreach: OtherArealObject // Guez Mine Field Breach
Attribute: AreaEffectSimulationName: OMT13string // name of the AreaEffectSimulation
Attribute: ActivationTime: ClockTimeStruct // GPS ActivationTime
ObjectClass: GuezNuclearAgentArea: OtherArealObject // Guez Mine Field Breach
Attribute: AreaEffectSimulationName: OMT13string // name of the AreaEffectSimulation
Attribute: ActivationTime: ClockTimeStruct // GPS ActivationTime
Attribute: Duration: Unsignedinteger32BE // Duration in 10 minutes, 0=unlimited, up to 1000 -> 10000 minutes
Attribute: DetonationLocation: WorldLocationStruct // Optional: Location of the impact of a nuclear ammunition
Attribute: Radius: HLAfloat64BE // The radius of the affected area
+18
View File
@@ -0,0 +1,18 @@
DynamicArray: ErrorStructVariableArray : ErrorStruct [] : HLAvariableArray //
FixedRecord: TacticalStatusStruct // TacticalStatus
Field: TacticalStatus: TacticalStatusEnum8 // current tactical status
Field: VulnerabilityKind: Unsignedinteger32BE // index of ADAG
Field: TotalStatus: TotalStatusEnum32 // detailed status of all vulnerabilities that occured
FixedRecord: BiteResultStruct //
Field: DeviceOkay: CanDeviceEnum32 // Bits that are set identify working devices
Field: BatteryWarning: BatteryWarningEnum32 // Bit set to identify devices with low battery
Field: ErrorCodes: ErrorStructVariableArray // Array of Error Codes (0-21)
FixedRecord: ErrorStruct //
Field: DeviceId: Unsignedinteger16BE // Device Id on CAN Bus
Field: SubDeviceId: Unsignedinteger16BE // Subdevice Id within the device
Field: UniqueSubdeviceId: Unsignedinteger32BE // Unique Subdevice Id
Field: ErrorId: Unsignedinteger32BE // Specific Error Id of the Device / Subdevice Combination
+103
View File
@@ -0,0 +1,103 @@
Enumeration: ActivateHelmetObservationEnum8: HLAoctet
Enumerator: NoChange: 0 //
Enumerator: WithoutHelmetWithoutVest: 1 //
Enumerator: HelmetWithoutVest: 2 // (unused)
Enumerator: HelmetAndVest: 3 //
Enumeration: CanDeviceEnum32: Unsignedinteger32BE // Aka BiteStatusCANBusEnum32, ActualConfigurationEnum32, different from Doc
Enumerator: TNE: 1 //
Enumerator: AGDUS: 2 //
Enumerator: ABE: 4 //
Enumerator: SpecialSensorFIR: 8 //
Enumerator: SpecialSensorMV: 16 //
Enumerator: SpecialSensorStd: 32 //
Enumerator: MhgrSensor: 64 //
Enumerator: AbcOverpressureSensor: 128 //
Enumerator: AbcFlowDetector: 256 //
Enumerator: WeaponEffect: 512 //
Enumerator: SRT: 1024 //
Enumerator: DMF: 2048 //
Enumerator: IedSensor: 4096 //
Enumerator: IedControlDevice: 8192 //
Enumeration: BatteryWarningEnum32: Unsignedinteger32BE
Enumerator: BatteryWarningTNE: 1 //
Enumerator: BatteryWarningAbcFilter: 16 //
Enumerator: BatteryWarningWeapon: 32 //
Enumerator: BatteryWarningHelmet: 64 //
Enumeration: ResetPlayerEnum8: HLAoctet
Enumerator: NoChange: 0 //
Enumerator: AfterExercisePause: 1 // (unused)
Enumerator: CombatReadyWithoutReammunition: 2 //
Enumerator: CombatReadyWithReammunition: 3 //
Enumeration: BiteReportTypeEnum8: HLAoctet
Enumerator: CurrentStatus: 0 //
Enumerator: StatusAfterSelftest: 1 //
Enumeration: RegistrationTypeEnum8: HLAoctet
Enumerator: NoChange: 0 //
Enumerator: NewRegistration: 1 //
Enumerator: ReRegistration: 2 //
Enumeration: TacticalStatusEnum8 : HLAoctet
Enumerator: CombatReady: 0 //
Enumerator: LightHit: 1 //
Enumerator: MediumHit: 2 //
Enumerator: HeavyHit: 3 //
Enumerator: Immobilized: 4 //
Enumerator: ImmobilizedVisible: 5 //
Enumerator: WeaponKill: 6 //
Enumerator: WeaponKillVisible: 7 //
Enumerator: TotalKill: 8 //
Enumerator: TemporaryFailure: 9 //
Enumerator: NearMiss: 10 //
Enumerator: HitWithoutEffect: 11 //
Enumeration: ChemicalAgentTypeEnum8: HLAoctet
Enumerator: Other: 0 //
Enumerator: SLost: 1 //
Enumerator: Sarin: 2 //
Enumerator: VX: 3 //
Enumeration: TotalStatusEnum32 : Unsignedinteger32BE
Enumerator: CombatReady: 1 //
Enumerator: LightHit: 2 //
Enumerator: MediumHit: 4 //
Enumerator: HeavyHit: 8 //
Enumerator: Immobilized: 16 //
Enumerator: ImmobilizedVisible: 32 //
Enumerator: WeaponKill: 64 //
Enumerator: WeaponKillVisible: 128 //
Enumerator: TotalKill: 256 //
Enumerator: TemporaryFailure: 512 //
Enumerator: NearMiss: 1024 //
Enumerator: HitWithoutEffect: 2048 //
Enumerator: AContamination: 16384 //
Enumerator: CContamination: 65536 //
Enumerator: Manipulation: 131072 //
Enumeration: OriginatorTypeEnum16: Unsignedinteger16BE
Enumerator: Unknown: 0 //
Enumerator: Participant: 1 //
Enumerator: AreaEffectSimulation: 2 //
Enumerator: ObserverController: 3 //
Enumerator: ExerciseControl: 4 //
Enumerator: NoMedicalTreatment: 5 //
Enumeration: HitResultEnum16: Unsignedinteger16BE
Enumerator: Reset: 0 //
Enumerator: LightDamage: 1 //
Enumerator: MediumDamage: 2 //
Enumerator: HeavyDamage: 3 //
Enumerator: MobilityKill: 4 //
Enumerator: MobilityKillVisible: 5 //
Enumerator: WeaponDamage: 6 //
Enumerator: WeaponDamageVisible: 7 //
Enumerator: TotalKill: 8 //
Enumerator: CheatingKill: 9 //
Enumerator: NearMiss: 10 //
Enumerator: HitWithNoEffect: 11 //
Enumerator: Contaminated: 12 //
Enumerator: TemporaryFailure: 13 //
Loaded 100 of 16245 files, more files were not shown because too many files have changed in this diff. Show more