15#ifndef WSFDISINTERFACEP_HPP
16#define WSFDISINTERFACEP_HPP
27#include "DisClockTime.hpp"
28#include "DisEntityId.hpp"
30#include "DisEntityType.hpp"
35#include "UtCallbackHolder.hpp"
37#include "UtRandom.hpp"
49#include "wsf_export.h"
118 void GetEntityId(
WsfPlatform* aPlatformPtr, DisEntityId& aEntityId);
120 void GetEntityIdFromIndex(
size_t aPlatformIndex, DisEntityId& aEntityId);
134 double GetTimeFromPdu(DisPdu& aPdu)
const;
158 unsigned int GetDeviceCount()
const {
return static_cast<unsigned int>(mDevices.size()); }
165 int GetSendPort()
const;
168 int GetRcvPort()
const;
178 ut::Random& GetRandom();
180 void PutPdu(
double aSimTime, std::unique_ptr<DisPdu> aPduPtr);
182 void ImmediatePutPdu(
double aSimTime, DisPdu& aPduPtr);
184 static void ReadEntityId(UtInput& aInput, DisEntityId& aEntityId);
186 static void ReadEntityType(UtInput& aInput, DisEntityType& aEntityType);
190 void SetPduFactory(DisPduFactory* aFactoryPtr);
211 void ResumeEntityStateProcessing(
double aSimTime,
const DisEntityId& aEntityId);
217 void AdvanceTime(
double aSimTime);
219 void Comment(
double aSimTime,
WsfPlatform* aPlatformPtr,
const std::string& aComment);
227 void FrameComplete(
double aSimTime);
229 void FramePlatformsUpdated(
double aSimTime);
231 void FrameStarting(
double aSimTime);
239 void MessageReceived(
double aSimTime,
249 void PlatformAdded(
double aSimTime,
WsfPlatform* aPlatformPtr);
251 void PlatformDeleted(
double aSimTime,
WsfPlatform* aPlatformPtr);
253 void PlatformInitialized(
double aSimTime,
WsfPlatform* aPlatformPtr);
255 void RequestTimeAdvance(
double aSimTime,
double aMaxRate,
double aTimeStep);
257 void SensorDetectionChanged(
double aSimTime,
WsfSensor* aSensorPtr,
size_t aTargetPlatformIndex,
WsfSensorResult& aResult);
265 void SensorRequestCanceled(
double aSimTime,
WsfSensor* aSensorPtr,
const WsfTrack* aTrackPtr);
271 void SensorScanUpdated(
double aSimTime,
WsfSensor* aSensorPtr);
273 void SensorTrackDropped(
double aSimTime,
WsfSensor* aSensorPtr,
const WsfTrack* aTrackPtr);
275 void SensorTrackInitiated(
double aSimTime,
WsfSensor* aSensorPtr,
const WsfTrack* aTrackPtr);
277 void SensorTurnedOff(
double aSimTime,
WsfSensor* aSensorPtr);
279 void SensorTurnedOn(
double aSimTime,
WsfSensor* aSensorPtr);
281 static void SimTimeToDisClockTime(
double aSimTime, DisClockTime& aClockTime);
283 void SimulationPausing();
284 void SimulationResuming();
286 void SimulationComplete(
double aSimTime);
288 void SimulationStarting();
295 void SendPeriodicPdusWhilePaused(std::vector<unsigned int>& aEntityIndices);
296 void SendDateAndTime(
WsfDisDevice& aDevice,
const DisEntityId& aReceivingId,
const UtCalendar& aDateTime);
308 void ResetFiltering();
314 void ExtrapolatePlatformState(
double aSimTime,
WsfDisPlatform* aDisPlatformPtr);
316 void PrepareFinalEntityState(
double aSimTime,
WsfPlatform* aPlatformPtr, DisEntityState* aEntityStatePtr);
318 bool UpdateAppearanceFromPlatform(
double aSimTime,
WsfPlatform* aPlatformPtr, DisEntityState* aEntityStatePtr);
320 void UpdatePlatformFromAppearance(
double aSimTime,
WsfPlatform* aPlatformPtr, DisEntityState* aEntityStatePtr);
322 void UpdatePlatformFromEntityState(
double aSimTime,
WsfDisPlatform* aDisPlatformPtr, DisEntityState* aEntityStatePtr);
330 DisEnum8 aDefaultFunction);
332 void SetEmitterTypeAndFunction(
WsfPlatformPart* aPartPtr, DisSystem* aSystemPtr);
334 void UpdateBeamFromXmtr(
WsfEM_Xmtr& aXmtr, DisBeam* aBeamPtr,
double aMinAz,
double aMaxAz,
double aMinEl,
double aMaxEl);
338 void UpdateSystemFromSensor(
WsfSensor* aSensorPtr, DisSystem* aSystemPtr);
345 void ExecuteDeferredTransmitEvent(
double aSimTime,
size_t aPlatformIndex);
346 double ExecuteSensorUpdateEvent(
double aSimTime);
347 void InitializeInputData();
349 void ReceivedBadEntityState();
351 bool GetEntityType(
WsfStringId aTypeName, DisEntityType& aEntityType)
const;
354 WsfDisPlatform* AddExternalPlatformP(
double aSimTime, std::unique_ptr<WsfDisEntityState> aEntityPtr);
358 class PauseUpdateEvent :
public WsfEvent
361 PauseUpdateEvent(
double aWallTime,
363 double aWallUpdateInterval,
364 unsigned int aNumPlatformsPerPulse,
365 const std::vector<unsigned int>& aPlatformIndices,
367 EventDisposition Execute()
override;
371 double mWallUpdateInterval;
373 unsigned int mNumberPlatIndicesPerExecute;
374 unsigned int mSendCounter;
375 std::vector<unsigned int> mPlatformIndices;
381 class ActivateDeferredConnectionEvent :
public WsfEvent
384 ActivateDeferredConnectionEvent(
double aSimTime, WsfDisInterface* aInterfacePtr)
386 , mInterfacePtr(aInterfacePtr)
390 EventDisposition Execute()
override;
393 WsfDisInterface* mInterfacePtr;
398 void AddPlatform(
double aSimTime, WsfPlatform* aPlatformPtr);
400 void AddShadowPlatform(
double aSimTime,
const WsfPlatform* aPlatformPtr);
402 void DeletePlatform(
double aSimTime,
size_t aPlatformIndex);
404 void CleanupDevices();
406 bool GetEntityType(
const WsfObject* aObjectPtr, DisEntityType& aEntityType)
const;
408 bool RunFilterChecks(
const DisPdu* aPdu);
410 DisUint32 ConvertDamageFactorToDamageState(
double aDamageFactor);
411 double ConvertDamageStateToDamageFactor(DisUint32 aDamageState);
413 StringToStateIdVec* GetAfterburnerSigStateByType(
WsfStringId aType,
int aStateFlag);
414 StringToStateIdVec* GetAfterburnerSigStateByName(
WsfStringId aName,
int aStateFlag);
416 StringToStateIdVec* GetConfigSigStateByType(
WsfStringId aType,
int aStateFlag);
417 StringToStateIdVec* GetConfigSigStateByName(
WsfStringId aName,
int aStateFlag);
419 void UpdatePlatformFromArticulationRecords(
double aSimTime,
420 WsfPlatform* aPlatformPtr,
421 DisEntityState* aNewStatePtr,
422 DisEntityState* aOldStatePtr);
424 void SetAppearance(DisUint32& aAppearance, WsfPlatform* aPlatformPtr,
unsigned int aLSB,
unsigned int aNumBits);
426 WsfExtInterface* mExtInterfacePtr;
427 UtCallbackHolder mCallbacks;
428 UtCallbackHolder mConditionalCallbacks;
430 std::vector<WsfPlatform*> mAddedPlatforms;
431 std::vector<unsigned int> mDeletedPlatforms;
433 double mHeartbeatMultiplier;
435 bool mIsDeferredConnection;
437 WsfDisIO_Thread* mIO_ThreadPtr;
440 bool mHasInputDevice;
441 bool mHasOutputDevice;
442 bool mHasExternalDevice;
443 unsigned int mCurrentGetDevice;
445 DisPduFactory* mPduFactoryPtr;
447 WsfDisExchange mWsfDisExchange;
449 unsigned int mPutCounter;
451 DisUint32 mSerialRequestNumber;
452 DisUint8 mReliabilityService;
457 std::unique_ptr<WsfDisEntityState> mExternalEntityStatePtr;
460 std::vector<WsfDisPlatform*> mDisPlatforms;
463 std::map<DisEntityId, WsfDisPlatform*> mEntityIdToDisPlatform;
467 std::map<size_t, DisEntityId> mDelPlatformIndexToEntityId;
469 std::vector<std::unique_ptr<WsfDisEntityState>> mDelayedEntityStates;
471 DelayEntityStateFn mEntityStateDelayFunctionPtr;
472 CreatePlatformFn mCreatePlatformFunctionPtr;
476 bool mFilteringEnabled;
479 bool mSuppressDisOutput;
482 bool mPauseIsInProgress;
485 WsfDisDraw* mReplayDrawPtr;
486 WsfDisVisualization* mVisualizationPtr;
489 WsfExtEntityDeadReckon* mDeadReckonPtr;
491 WsfDisArticulatedPartList* mArticulatedPartListPtr;
499 unsigned int mNullEntityIdCount;
500 std::map<DisEntityId, int> mBadDataCount;
504 std::list<size_t> mSensorUpdateList;
505 bool mSensorUpdateScheduled;
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Definition WsfDisArticulatedPart.hpp:102
A base class for a DIS I/O device (file, network, etc).
Definition WsfDisDevice.hpp:33
Provides DIS output for WsfDraw.
Definition WsfDisDraw.hpp:26
Definition WsfDisEmission.hpp:37
Definition WsfDisEntityState.hpp:38
Definition WsfDisFilterAllowance.hpp:33
Definition WsfDisInterface.hpp:83
void SetPutCounter(int aCount)
Sets the number of sent DIS PDUs.
Definition WsfDisInterface.hpp:144
WsfDisPlatform * AddExternalPlatform(double aSimTime, std::unique_ptr< WsfDisEntityState > aEntityPtr)
Definition WsfDisInterface.cpp:480
bool(*)(WsfDisInterface &aInterfacePtr, const DisEntityId &aEntityId) DelayEntityStateFn
Definition WsfDisInterface.hpp:204
DisUint8 GetReliabilityService() const
Definition WsfDisInterface.hpp:292
double GetInitialDistributionInterval()
Returns initial distribution time.
Definition WsfDisInterface.hpp:171
bool GetAutostart() const
Definition WsfDisInterface.hpp:138
DeviceList & GetDeviceList()
Definition WsfDisInterface.hpp:162
bool HasDevice() const
Returns true if a device is configured for sending or receiving PDU's.
Definition WsfDisInterface.hpp:156
DisUint32 GetNextRequestNumber()
Definition WsfDisInterface.hpp:291
bool HasInputDevice() const
Returns true if at least device is configured for receiving DIS PDU's.
Definition WsfDisInterface.hpp:147
bool PauseIsInProgress() const
Definition WsfDisInterface.hpp:294
bool ClearIgnoredSiteAndApp(unsigned short aSite, unsigned short aApp)
Remove a site/application from the ignored site/application list.
Definition WsfDisInterface.cpp:840
bool HasExternalDevice() const
Returns true if at least one device is a external device.
Definition WsfDisInterface.hpp:153
WsfDisInterface(WsfDisInput &aScenario, WsfSimulation &aSim, WsfExtInterface *aExtInterfacePtr)
Definition WsfDisInterface.cpp:95
static DisUint16 cMAX_PLAYBACK_SITE
Definition WsfDisInterface.hpp:90
DisPduFactory * GetPduFactory()
Definition WsfDisInterface.hpp:173
size_t GetDisPlatformCount() const
Definition WsfDisInterface.hpp:114
double GetEntityOrientationThreshold() const
Return the orientation threshold (radians).
Definition WsfDisInterface.hpp:123
WsfExtInterface * GetExtInterface() const
Definition WsfDisInterface.hpp:302
unsigned int GetDeviceCount() const
Definition WsfDisInterface.hpp:158
static WsfDisInterface * Find(const WsfSimulation &aSimulation)
Definition WsfDisInterface.cpp:89
bool GetSuppressDisOutput()
Definition WsfDisInterface.hpp:192
double GetHeartbeatTimer() const
Return the heartbeat timer (seconds).
Definition WsfDisInterface.hpp:129
void UpdateLastSimTime(double aSimTime)
Definition WsfDisInterface.hpp:341
bool UseSimpleOrientationRate()
Definition WsfDisInterface.hpp:233
void EnableFiltering()
Definition WsfDisInterface.hpp:307
void SetSuppressDisOutput(bool aFlag)
Definition WsfDisInterface.hpp:193
bool SuppressAllNonStandardPDUs()
Definition WsfDisInterface.hpp:197
void SetDelayEntityStateFunction(DelayEntityStateFn aDelayFn)
Definition WsfDisInterface.hpp:209
bool HasOutputDevice() const
Returns true if at least device is configured for sending DIS PDU's.
Definition WsfDisInterface.hpp:150
WsfDisDevice * GetDevice(unsigned int aIndex)
Definition WsfDisInterface.hpp:160
std::vector< WsfDisDevice * > DeviceList
Definition WsfDisInterface.hpp:161
void WriteEntityTypes(std::ostream &aStream)
unsigned int GetPutCounter() const
Returns number of sent DIS PDUs.
Definition WsfDisInterface.hpp:141
WsfPlatform *(*)(WsfDisInterface & aInterface, WsfStringId aPlatformType, WsfDisEntityState *aEntityStatePtr) CreatePlatformFn
Definition WsfDisInterface.hpp:205
double GetSimTime() const
Definition WsfDisInterface.hpp:110
WsfExtEntityDeadReckon * GetDeadReckonPtr()
Definition WsfDisInterface.hpp:116
bool IgnoreStopFreezePDU()
Definition WsfDisInterface.hpp:237
bool ActivateConnection(double aSimTime)
Definition WsfDisInterface.cpp:224
friend class WsfDisPlatform
Definition WsfDisInterface.hpp:85
void SetCreateDisPlatformFunction(CreatePlatformFn aModifyFn)
Definition WsfDisInterface.hpp:210
static DisUint16 cSHADOW_SITE
Definition WsfDisInterface.hpp:88
static DisUint16 cMIN_PLAYBACK_SITE
Definition WsfDisInterface.hpp:89
friend class WsfDisEntityState
Definition WsfDisInterface.hpp:86
bool ShouldJoinExercise() const
Definition WsfDisInterface.hpp:298
bool ClearIgnoredSitesAndApps()
Definition WsfDisInterface.cpp:863
WsfDisArticulatedPartList * GetArticulatedParts() const
Definition WsfDisInterface.hpp:304
bool GetSuppressEmissionsData() const
Definition WsfDisInterface.hpp:195
bool ZeroWorldToBodyAngularVelocities()
Definition WsfDisInterface.hpp:235
double GetHeartbeatMultiplier() const
Return the heartbeat multiplier.
Definition WsfDisInterface.hpp:132
double GetEntityPositionThreshold() const
Return the entity position threshold (meters).
Definition WsfDisInterface.hpp:126
bool IsDeferredConnection() const
Definition WsfDisInterface.hpp:343
void SetHeartbeatMultiplier(double aValue)
Definition WsfDisInterface.hpp:188
WsfDisPlatform * FindDisPlatform(const DisEntityId &aEntityId)
Definition WsfDisInterface.cpp:926
bool UseWorldToBodyAngularVelocities()
Definition WsfDisInterface.hpp:234
std::map< DisEntityId, WsfDisPlatform * > & GetEntityIdToDisPlatform()
Definition WsfDisInterface.hpp:310
Sends DisOther PDU's with commands to change visualization parameters.
Definition WsfDisVisualization.hpp:28
Definition WsfEM_Xmtr.hpp:55
Definition WsfEvent.hpp:29
Definition WsfExtEmission.hpp:32
Definition WsfExtEntityDeadReckon.hpp:46
The WSF Ext is code which is shared between common external interfaces like DIS and HLA.
Definition WsfExtInterface.hpp:183
A base class for messages sent among simulation communication objects, processors and sensors.
Definition WsfMessage.hpp:33
Definition WsfSensorMode.hpp:36
Definition WsfSensorResult.hpp:27
Definition WsfSensor.hpp:92
const WsfScenario & GetScenario() const
Definition WsfSimulationExtension.cpp:31
WsfSimulationExtension()
Definition WsfSimulationExtension.cpp:23
virtual bool PrepareExtension()
Definition WsfSimulationExtension.cpp:72
friend class WsfSimulation
Definition WsfSimulationExtension.hpp:43
virtual bool Initialize()
Definition WsfSimulationExtension.cpp:49
virtual void AddedToSimulation()
Definition WsfSimulationExtension.cpp:41
The main controller for a simulation.
Definition WsfSimulation.hpp:109
An object that represents an 'track' (perception) of something.
Definition WsfTrack.hpp:120
Definition WsfComm.hpp:43
Definition WsfCommResult.hpp:34
Definition WsfComm.cpp:34
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32