WSF
WsfXIO_PlatformInfoService.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2003-2015 The Boeing Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11// ****************************************************************************
12// Updated by Infoscitex, a DCS Company
13// ****************************************************************************
14
15#ifndef WSFXIO_PLATFORMINFOSERVICE_HPP
16#define WSFXIO_PLATFORMINFOSERVICE_HPP
17
18#include "wsf_export.h"
19
20#include "UtCallback.hpp"
21#include "UtCallbackHolder.hpp"
22#include "UtMath.hpp"
23#include "UtVec3.hpp"
24#include "WsfEvent.hpp"
27class WsfMover;
28class WsfObject;
29class WsfPlatformPart;
30class WsfProcessor;
31class WsfSensor;
32class WsfSensorMode;
33class WsfSimulation;
34#include "WsfStringId.hpp"
35#include "xio/WsfXIO.hpp"
42class WsfXIO_ProcessorInfoPkt;
48
49namespace wsf
50{
51namespace comm
52{
53class Comm;
54}
55} // namespace wsf
56
65class WSF_EXPORT WsfXIO_PlatformInfoService : public WsfXIO_ServiceT<WsfXIO_RequestPlatformInfoPkt, WsfXIO_SimService>
66{
67protected:
69
70public:
72
74
76 ~WsfXIO_PlatformInfoService() override = default;
77
78 void PartDebugChange(WsfPlatformPart* aPartPtr);
79
80 void SendPartState(const WsfPlatformPart& aPart, int aInfoMask);
81
82protected:
83 void SubscriptionCancelledT(WsfXIO_Subscription* aSubscriptionPtr, WsfXIO_RequestPlatformInfoPkt& aRequestPkt) override;
84
85 void UpdateCallbacks();
86
88
89 void ProcessorStateChange(double aSimTime, WsfProcessor* aProcessorPtr);
90
91 void SensorStateChange(double aSimTime, WsfSensor* aSensorPtr);
92 void SensorModeChange(double aSimTime, WsfSensor* aSensorPtr, WsfSensorMode* aModePtr);
93
94 void CommStateChange(double aSimTime, wsf::comm::Comm* aCommPtr);
95
96 void MoverChanged(WsfPlatform* aPlatformPtr);
97 void RouteChanged(WsfMover* aMoverPtr);
98
99 void TrackManagerStateChange(double aSimTime, WsfPlatform* aPlatformPtr);
100
102
103 void SendCommandChain(WsfXIO_Subscription& aSubscription, WsfPlatform& aPlatform);
104
105 void SendTrackManagerState(WsfPlatform& aPlatform);
106
110
111 void DR_Change(double aSimTime, WsfExtEntityDeadReckon::PlatformDR& aDRData);
112
113 // Represents a request for platform information
120
126
127 // Event to evaluate dead reckoning at an interval given by the requester.
128 // Note that this is NOT used when using the default DR thresholds / update rates.
130 {
131 public:
133 EvaluateDeadReckoningEvent(double aSimTime,
134 WsfXIO_PlatformInfoService* aServicePtr,
135 WsfXIO_SubscriptionId aSubscription,
136 WsfPlatform* aPlatformPtr,
137 double aInterval,
138 double aMaxError,
139 double aMaxOrientationError);
140 EventDisposition Execute() override;
141
142 void SendState(WsfXIO_Subscription* aSubscriptionPtr);
143
144 void CopyState(WsfPlatform* aPlatformPtr);
145
149 double mInterval;
150 double mMaxError;
152 UtVec3d mLocation;
153 UtVec3d mVelocity;
155 double mPsi;
156 double mTheta;
157 double mPhi;
158 double mRootTime;
159 };
160
161 PlatformInfo* FindPlatformInfo(size_t aPlatformIndex);
162
163 using PlatformInfoMap = std::multimap<size_t, PlatformInfo>;
164
165 void GetInfoRange(size_t aIndex, PlatformInfoMap::iterator& aBegin, PlatformInfoMap::iterator& aEnd);
166
167 using iterator = PlatformInfoMap::iterator;
168 using ValuePair = PlatformInfoMap::value_type;
169
174 // Map of platform index to requested data in PlatformInfo
177 std::vector<DR_Destination*> mDR_Destinations;
179 std::unique_ptr<UtCallback> mDR_MoverUpdatedCallbackPtr;
181 UtCallbackHolder mActiveCallbacks;
182};
183
186{
187public:
188 WsfXIO_PlatformPartInfoRequest(int aPlatformIndex, int aPartType, WsfStringId aPartName, WsfXIO_Connection* aConnectionPtr);
189 void SetUpdateInterval(double aUpdateInterval, bool aRealTimeInterval = false)
190 {
191 mUpdateInterval = aUpdateInterval;
192 mRealtimeInterval = aRealTimeInterval;
193 }
194
195 void Initialized() override;
196
197 int GetPlatformIndex() const { return mPlatformIndex; }
198
200
201protected:
207};
208
210 public WsfXIO_ServiceT<WsfXIO_RequestPlatformPartInfoPkt, WsfXIO_SimService>
211{
212public:
216
217protected:
218 void SubscriptionCancelledT(WsfXIO_Subscription* aSubscriptionPtr,
219 WsfXIO_RequestPlatformPartInfoPkt& aRequestPkt) override;
220
222
223 friend class UpdatePartEvent;
224
226 {
227 public:
228 UpdatePartEvent(double aSimTime,
230 WsfArticulatedPart* aPartPtr,
231 double aInterval);
232 EventDisposition Execute() override;
233
234 void SendState();
235 void CopyState();
236
240 double mInterval;
243 };
244
247
248 using EventMap = std::map<WsfPlatformPart*, UpdatePartEvent*>;
250};
251
252#endif
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
std::pair< int, int > WsfXIO_SubscriptionId
Definition WsfXIO_Subscription.hpp:26
Definition WsfArticulatedPart.hpp:36
WsfEvent()=default
EventDisposition
Definition WsfEvent.hpp:37
Maintains a platform's dead reckon state.
Definition WsfExtEntityDeadReckon.hpp:108
The WSF Ext is code which is shared between common external interfaces like DIS and HLA.
Definition WsfExtInterface.hpp:183
Definition WsfMover.hpp:37
Definition WsfObject.hpp:40
Definition WsfPlatformPart.hpp:61
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
Definition WsfProcessor.hpp:39
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
Definition WsfSensorMode.hpp:36
Definition WsfSensor.hpp:92
The main controller for a simulation.
Definition WsfSimulation.hpp:109
Definition WsfXIO_Connection.hpp:37
Definition WsfXIO_Destination.hpp:26
Inform other applications about a platform part state change.
Definition WsfXIO_PacketRegistry.hpp:460
Request for platform information.
Definition WsfXIO_PlatformInfoRequest.hpp:22
Definition WsfXIO_PlatformInfoService.hpp:130
double mPhi
Definition WsfXIO_PlatformInfoService.hpp:157
void CopyState(WsfPlatform *aPlatformPtr)
Definition WsfXIO_PlatformInfoService.cpp:602
double mInterval
Definition WsfXIO_PlatformInfoService.hpp:149
double mRootTime
Definition WsfXIO_PlatformInfoService.hpp:158
void SendState(WsfXIO_Subscription *aSubscriptionPtr)
Definition WsfXIO_PlatformInfoService.cpp:611
double mPsi
Definition WsfXIO_PlatformInfoService.hpp:155
UtVec3d mAcceleration
Definition WsfXIO_PlatformInfoService.hpp:154
double mMaxError
Definition WsfXIO_PlatformInfoService.hpp:150
size_t mPlatformIndex
Definition WsfXIO_PlatformInfoService.hpp:148
UtVec3d mVelocity
Definition WsfXIO_PlatformInfoService.hpp:153
double mTheta
Definition WsfXIO_PlatformInfoService.hpp:156
WsfXIO_SubscriptionId mSubscriptionId
Definition WsfXIO_PlatformInfoService.hpp:147
EventDisposition Execute() override
Definition WsfXIO_PlatformInfoService.cpp:560
WsfXIO_PlatformInfoService * mServicePtr
Definition WsfXIO_PlatformInfoService.hpp:146
double mMaxOrientationError
Definition WsfXIO_PlatformInfoService.hpp:151
UtVec3d mLocation
Definition WsfXIO_PlatformInfoService.hpp:152
std::vector< DR_Destination * > mDR_Destinations
Array of destinations receiving DR data for each platform index.
Definition WsfXIO_PlatformInfoService.hpp:177
void UpdateCallbacks()
Definition WsfXIO_PlatformInfoService.cpp:51
void GetInfoRange(size_t aIndex, PlatformInfoMap::iterator &aBegin, PlatformInfoMap::iterator &aEnd)
void HandleTypeQuery(WsfXIO_TypeQueryPkt &aPkt)
Definition WsfXIO_PlatformInfoService.cpp:479
void MoverChanged(WsfPlatform *aPlatformPtr)
Definition WsfXIO_PlatformInfoService.cpp:665
std::multimap< size_t, PlatformInfo > PlatformInfoMap
Definition WsfXIO_PlatformInfoService.hpp:163
void ProcessorStateChange(double aSimTime, WsfProcessor *aProcessorPtr)
Definition WsfXIO_PlatformInfoService.cpp:260
WsfExtInterface * mExtInterfacePtr
Definition WsfXIO_PlatformInfoService.hpp:173
void FillPartState(const WsfPlatformPart &aPart, WsfXIO_PartStateChangePkt &aPkt)
Definition WsfXIO_PlatformInfoService.cpp:314
UtCallbackHolder mActiveCallbacks
List of callbacks only required while we have subscriptions.
Definition WsfXIO_PlatformInfoService.hpp:181
WsfObject * FindObjectType(WsfXIO_TypeQueryPkt &aPkt)
Definition WsfXIO_PlatformInfoService.cpp:380
PlatformInfoMap::iterator iterator
Definition WsfXIO_PlatformInfoService.hpp:167
void CommStateChange(double aSimTime, wsf::comm::Comm *aCommPtr)
Definition WsfXIO_PlatformInfoService.cpp:275
std::unique_ptr< UtCallback > mDR_MoverUpdatedCallbackPtr
Callback for WsfExtEntityDeadReckon::DeadReckonChanged.
Definition WsfXIO_PlatformInfoService.hpp:179
void DR_Change(double aSimTime, WsfExtEntityDeadReckon::PlatformDR &aDRData)
Definition WsfXIO_PlatformInfoService.cpp:643
PlatformInfoMap mPlatformInfo
Definition WsfXIO_PlatformInfoService.hpp:175
PlatformInfo * FindPlatformInfo(size_t aPlatformIndex)
Definition WsfXIO_PlatformInfoService.cpp:249
void RouteChanged(WsfMover *aMoverPtr)
Definition WsfXIO_PlatformInfoService.cpp:691
void SensorModeChange(double aSimTime, WsfSensor *aSensorPtr, WsfSensorMode *aModePtr)
Definition WsfXIO_PlatformInfoService.cpp:270
void PartDebugChange(WsfPlatformPart *aPartPtr)
Definition WsfXIO_PlatformInfoService.cpp:281
void HandleRequest(WsfXIO_RequestPlatformInfoPkt &aPkt)
Definition WsfXIO_PlatformInfoService.cpp:123
WsfXIO_ServiceT< WsfXIO_RequestPlatformInfoPkt, WsfXIO_SimService > BaseClassType
Definition WsfXIO_PlatformInfoService.hpp:73
void HandleTypeListQuery(WsfXIO_TypeListQueryPkt &aPkt)
Definition WsfXIO_PlatformInfoService.cpp:518
void SendPartState(const WsfPlatformPart &aPart, int aInfoMask)
Definition WsfXIO_PlatformInfoService.cpp:292
void SensorStateChange(double aSimTime, WsfSensor *aSensorPtr)
Definition WsfXIO_PlatformInfoService.cpp:265
WsfXIO_PlatformInfoService(WsfXIO_Simulation &aXIO_Simulation)
Definition WsfXIO_PlatformInfoService.cpp:36
PlatformInfoMap::value_type ValuePair
Definition WsfXIO_PlatformInfoService.hpp:168
void SendCommandChain(WsfXIO_Subscription &aSubscription, WsfPlatform &aPlatform)
Definition WsfXIO_PlatformInfoService.cpp:347
WsfSimulation & mSimulation
Definition WsfXIO_PlatformInfoService.hpp:171
const WsfScenario & mScenario
Definition WsfXIO_PlatformInfoService.hpp:172
void SendTrackManagerState(WsfPlatform &aPlatform)
Definition WsfXIO_PlatformInfoService.cpp:626
WsfXIO_Simulation & mXIO_Simulation
Definition WsfXIO_PlatformInfoService.hpp:170
void TrackManagerStateChange(double aSimTime, WsfPlatform *aPlatformPtr)
Definition WsfXIO_PlatformInfoService.cpp:286
~WsfXIO_PlatformInfoService() override=default
WsfStringId GetPartName() const
Definition WsfXIO_PlatformInfoService.hpp:199
double mUpdateInterval
Definition WsfXIO_PlatformInfoService.hpp:205
WsfXIO_PlatformPartInfoRequest(int aPlatformIndex, int aPartType, WsfStringId aPartName, WsfXIO_Connection *aConnectionPtr)
Definition WsfXIO_PlatformInfoService.cpp:696
WsfStringId mPartName
Definition WsfXIO_PlatformInfoService.hpp:204
bool mRealtimeInterval
Definition WsfXIO_PlatformInfoService.hpp:206
void SetUpdateInterval(double aUpdateInterval, bool aRealTimeInterval=false)
Definition WsfXIO_PlatformInfoService.hpp:189
int mPlatformIndex
Definition WsfXIO_PlatformInfoService.hpp:202
int mPartType
Definition WsfXIO_PlatformInfoService.hpp:203
int GetPlatformIndex() const
Definition WsfXIO_PlatformInfoService.hpp:197
Definition WsfXIO_PlatformInfoService.hpp:226
bool mDisabled
Definition WsfXIO_PlatformInfoService.hpp:242
WsfXIO_Destination mDestination
Definition WsfXIO_PlatformInfoService.hpp:239
double mInterval
Definition WsfXIO_PlatformInfoService.hpp:240
WsfXIO_PlatformPartInfoService * mServicePtr
Definition WsfXIO_PlatformInfoService.hpp:237
void CopyState()
Definition WsfXIO_PlatformInfoService.cpp:838
WsfArticulatedPart * mPartPtr
Definition WsfXIO_PlatformInfoService.hpp:238
UpdatePartEvent(double aSimTime, WsfXIO_PlatformPartInfoService *aServicePtr, WsfArticulatedPart *aPartPtr, double aInterval)
Definition WsfXIO_PlatformInfoService.cpp:806
WsfXIO_PlatformPartStatePkt mStateData
Definition WsfXIO_PlatformInfoService.hpp:241
void SendState()
Definition WsfXIO_PlatformInfoService.cpp:833
EventDisposition Execute() override
Definition WsfXIO_PlatformInfoService.cpp:821
std::map< WsfPlatformPart *, UpdatePartEvent * > EventMap
Definition WsfXIO_PlatformInfoService.hpp:248
EventMap mEvents
Definition WsfXIO_PlatformInfoService.hpp:249
WsfXIO_Simulation & mXIO_Simulation
Definition WsfXIO_PlatformInfoService.hpp:245
WsfXIO_PlatformPartInfoService(WsfXIO_Simulation &aXIO_Simulation)
Definition WsfXIO_PlatformInfoService.cpp:720
void HandleRequest(WsfXIO_RequestPlatformPartInfoPkt &aPkt)
Definition WsfXIO_PlatformInfoService.cpp:756
WsfXIO_ServiceT< WsfXIO_RequestPlatformPartInfoPkt, WsfXIO_SimService > BaseClassType
Definition WsfXIO_PlatformInfoService.hpp:213
WsfSimulation & mSimulation
Definition WsfXIO_PlatformInfoService.hpp:246
Requests that an application begin sending state information for a specified platform part.
Definition WsfXIO_PacketRegistry.hpp:1157
Contains information about a processor.
Definition WsfXIO_ObjectInfo.hpp:470
Requests that an application begin sending information for a specified platform.
Definition WsfXIO_PacketRegistry.hpp:416
Requests that an application begin sending state information for a specified platform part.
Definition WsfXIO_PacketRegistry.hpp:1136
WsfXIO_Request(WsfXIO_Connection *aConnectionPtr, bool aIsReliable=true)
Definition WsfXIO_Request.cpp:160
virtual void SubscriptionCancelledT(WsfXIO_Subscription *aSubscriptionPtr, RequestType &aRequest)
Definition WsfXIO_Service.hpp:99
WsfXIO_ServiceT(WsfXIO_Interface *aInterfacePtr)
Definition WsfXIO_Service.hpp:84
Definition WsfXIO_Simulation.hpp:49
A WsfXIO_Subscription wraps information about a remote request for information.
Definition WsfXIO_Subscription.hpp:30
Definition WsfXIO_PacketRegistry.hpp:852
Definition WsfXIO_PacketRegistry.hpp:804
Definition WsfComm.hpp:43
Definition WsfComm.cpp:34
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Destination for DR updates for a single platform.
Definition WsfXIO_PlatformInfoService.hpp:123
WsfXIO_Destination mDestination
Definition WsfXIO_PlatformInfoService.hpp:124
Definition WsfXIO_PlatformInfoService.hpp:115
WsfXIO_Subscription * mSubscriptionPtr
Definition WsfXIO_PlatformInfoService.hpp:118
int mInfoTypes
Definition WsfXIO_PlatformInfoService.hpp:117
int mPlatformIndex
Definition WsfXIO_PlatformInfoService.hpp:116
Copyrights Multiple, All Rights Reserved