11 #include <tbb/mutex.h>
12 #include <tbb/spin_rw_mutex.h>
17 #include <boost/signals2/connection.hpp>
19 #include <vlpi/entityType.h>
20 #include <vlpi/disEnums.h>
24 #include <json/json.h>
42 class DtVrlinkVrfRemoteController;
117 void addProcessor(std::shared_ptr<DtProcessor> processor);
143 const std::vector<std::string>& roleNames)
const;
184 std::string& errorMessage,
bool& isValidationError);
194 std::string& errorMessage,
195 bool& isValidationError);
225 bool issueCommand(
const std::string& objectName,
const std::string& commandType,
const Json::Value& parameters,
226 std::string* errorMessage =
nullptr);
234 bool skipTask(
const std::string& objectName, std::string* errorMessage =
nullptr);
Json::Value getScenarioStatus() const
Returns a JSON snapshot of the current scenario status, ready for wire transmission. Safe to call from any thread.
UUID is a unique ID wrapper class.
Definition: uuid.h:59
tbb::spin_rw_mutex & vrfApiMutex()
Definition: vrfManager.h:130
size_t capableTaskQueueSize() const
Returns the number of entities waiting for a CapableTaskAndSet response. Safe to call from any thread...
Definition: vrfManager.h:155
DtWebServerObjectList & trackedObjects()
Definition: vrfManager.h:129
Json::Value getCommandSpec(const std::string &commandType, const std::string &objectName="")
Returns the full parameter spec for a single command type. objectName is optional; when supplied...
Definition: scenarioManager.h:40
DtCapableTaskRequester myCapableTaskRequester
Definition: vrfManager.h:339
std::atomic< bool > myInitialized
Definition: vrfManager.h:303
Json::Value myScenarioStatusCache
Definition: vrfManager.h:285
DtSimulationStatus
Definition: backend.h:27
std::atomic< bool > myStatusChanged
Definition: vrfManager.h:282
DtDataSourceStatus - Status of the VRF connection.
Definition: dataTypes.h:265
Definition: vrfManager.h:70
Manage scripted tasks (primarily Lua tasks) known by VR-Forces.
Definition: scriptedTaskManager.h:76
int myTickRateMs
Definition: vrfManager.h:304
void tryBindParameterDb()
Fully loads available sms parameters, so they are available for querying information afterwards Calle...
std::unique_ptr< DtSpotReportAutoEnabler > mySpotReportAutoEnabler
Definition: vrfManager.h:341
std::vector< std::function< void(const std::string &)> > myScenarioChangedListeners
Definition: vrfManager.h:293
std::string createTacticalGraphic(const Json::Value &body, std::string &errorMessage, bool &isValidationError)
Create a new tactical graphic (overlay object) from the JSON request body. Validates all required fie...
bool skipTask(const std::string &objectName, std::string *errorMessage=nullptr)
Sends a skip-task request to the named entity.
const DtRemoteControlModelSetManager * modelSetManager
Definition: vrfManager.h:65
DtWebServerObjectList * trackedObjects
Definition: vrfManager.h:63
void addScenarioChangedListener(std::function< void(const std::string &)> listener)
Registers a callback that is invoked on the VRF update thread whenever the scenario name changes (a n...
uint64_t scenarioStatusGeneration() const
Monotonically increasing counter incremented whenever scenario status changes (excluding simulation t...
void onStateDataAboutToBeRemoved(const makVrf::DtStateData *stateData)
DtDatasource::DtDataSourceStatus getStatus()
DtCapableTaskRequester — sends DtIfCapableTaskAndSetQuery messages to the VRF backend and applies the...
Definition: capableTaskRequester.h:37
This class is a specialization of the DtVrfRemoteController for use with a VR-Link exercise connectio...
Definition: vrlinkVrfRemoteController.h:44
bool deleteObject(const std::string &objectName)
size_t size() const
Returns the total number of currently tracked objects.
Concrete subordinate resolver backed by the webserver's tracked object list.
Definition: webServerSubordinateResolver.h:13
DtVrfContext - Bundles the VRF runtime objects passed to a processor on initialization. All pointers remain valid for the lifetime of the processor.
Definition: vrfManager.h:59
uint64_t myCachedRoleDefinitionGeneration
Generation counter cached from DtRoleDefinitionStore::definitionGeneration(). Initialised to UINT64_M...
Definition: vrfManager.h:337
void initialize(DtRemoteControlInitializer &initializer, const std::string &configFilePath)
void addProcessor(std::shared_ptr< DtProcessor > processor)
Add a processor to the tick loop. The processor's initialize() is called immediately so it is ready b...
const DtWebServerSubordinateResolver & subordinateResolver() const
Definition: vrfManager.h:131
size_t trackedObjectCount() const
Definition: vrfManager.h:128
bool updateRwCommandSpecEntry(const std::string &commandType, const Json::Value &entry)
Upserts the commandSpecs.json entry for commandType in memory and on disk. The supplied entry JSON en...
double longitude
Definition: vrfManager.h:73
DtResourceCache * resourceCache
Definition: vrfManager.h:66
std::unique_ptr< DtScenarioManager > myScenarioManager
Definition: vrfManager.h:321
tbb::spin_rw_mutex myVrfApiMutex
Definition: vrfManager.h:297
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
std::unique_ptr< DtCommandSpecBuilder > myCommandSpecBuilder
Definition: vrfManager.h:320
std::vector< std::shared_ptr< DtProcessor > > myProcessors
Definition: vrfManager.h:315
DtVrfManager - Generic VRF tick engine and command gateway.
Definition: vrfManager.h:97
void * myVrfApi
Definition: vrfManager.h:296
Json::Value getCommandSummaries(const std::vector< std::string > &filter={})
Returns a JSON array of lightweight command summaries for building menus/toolbars. If filter is non-empty, only the listed commandTypes are returned.
std::string tacticalGraphicOverlay(const std::string &objectName) const
Returns the overlay name for the tactical graphic with the given UUID. Returns an empty string if the...
void onCurrentTaskChanged(const DtUUID &uuid)
Invoked on the VRF update thread whenever an entity's current task changes. Copies the latest EntityT...
IMGUI_API void Value(const char *prefix, bool b)
int entityForceId(const std::string &objectName) const
Returns the DIS force ID for the entity with the given objectName (UUID string). Returns -1 if the ob...
double latitude
Definition: vrfManager.h:72
The DtRemoteControlModelSetManager class is used to lookup meta data regarding simulation model sets...
Definition: remoteControlModelSetManager.h:25
DtResourceCache — subscribes to VRF resource monitoring and keeps per-entity resource data current on...
Definition: resourceCache.h:27
Json::Value queryScenarioStatusFromVRF()
Query current scenario status from VRF; called on the VRF tick thread.
std::unique_ptr< DtExerciseConn > myExerciseConn
Definition: vrfManager.h:307
DtSpotReportAutoEnabler — automatically sends DtSetSpotReportingRequestEnableToGuiIfOff to entities w...
Definition: spotReportAutoEnabler.h:32
DtRoleSpotReportPerspectiveManager — maintains one DtSpotReportByForceAndUuidPerspective per role tha...
Definition: roleSpotReportPerspectiveManager.h:24
DtWebServerObjectList — thread-safe container for tracked VRF objects.
Definition: webServerObjectList.h:25
bool issueCommand(const std::string &objectName, const std::string &commandType, const Json::Value ¶meters, std::string *errorMessage=nullptr)
Dispatches a command to the named entity.
std::unique_ptr< DtResourceCache > myResourceCache
Definition: vrfManager.h:340
boost::signals2::connection myCurrentTaskChangedConnection
Connection handle for DtRemoteControlCurrentTaskManager::signal_currentTaskChanged. Disconnected explicitly in shutdownVRFAPI() to avoid dangling callbacks into a partially-torn-down DtVrfManager.
Definition: vrfManager.h:326
void removeProcessor(std::shared_ptr< DtProcessor > processor)
Remove a processor from the tick loop. The processor's shutdown() is called before it is removed...
size_t queueSize() const
Returns the number of entities waiting to be dispatched in the capable-task request queue...
Definition: capableTaskRequester.h:69
makVrf::DtVrlinkVrfRemoteController * remoteController
Definition: vrfManager.h:61
std::atomic< uint64_t > myScenarioStatusGeneration
Definition: vrfManager.h:289
void initializeVRFAPI(DtRemoteControlInitializer &initializer)
DtWebServerObjectList myTrackedObjects
Definition: vrfManager.h:318
DtDatasource::DtDataSourceStatus myStatusCache
Definition: vrfManager.h:311
DtRoleSpotReportPerspectiveManager myRoleSpotReportPerspectiveMgr
Manages one DtSpotReportByForceAndUuidPerspective per role that is configured to receive contact repo...
Definition: vrfManager.h:330
tbb::mutex myProcessorsMutex
Definition: vrfManager.h:316
const DtCommandSpecBuilder * commandSpecBuilder
Definition: vrfManager.h:64
DtDatasource::DtDataSourceStatus queryStatusFromVRF()
static void statusChangedCallback(DtSimulationStatus status, void *userData)
std::unique_ptr< DtWebServerSubordinateResolver > mySubordinateResolver
Definition: vrfManager.h:332
std::vector< DtWebServerObjectPtr > allTrackedObjects() const
Returns a thread-safe snapshot of all currently tracked simulation objects. Acquires a shared read lo...
tbb::spin_mutex myDataMutex
Definition: vrfManager.h:312
DtVrfManager & operator=(const DtVrfManager &)=delete
bool editObject(const std::string &objectName, const Json::Value &body, std::string &errorMessage, bool &isValidationError)
Applies one or more attribute/geometry edits to an existing tactical graphic by building a single DtI...
double myPrevDateAndTimeOfDay
Last observed DateAndTimeOfDay; used to detect manual time jumps.
Definition: vrfManager.h:288
static DtVrfManager & getInstance()
Singleton accessor.
tbb::spin_rw_mutex * vrfDataMutex
Definition: vrfManager.h:62
std::vector< DtDatasource::DtContactReportSnapshot > contactReportsForRoles(const std::vector< std::string > &roleNames) const
Returns contact report snapshots visible to the given roles. For each role, queries the corresponding...
void syncRoleSpotReportPerspectives()
Checks whether the active role definition has changed and, if so, rebuilds the per-role DtSpotReportB...
void onStateDataAdded(makVrf::DtStateData *stateData)
Definition: remoteControlInit.h:26
Json::Value getRwCommandSpecsConfig()
Returns a JSON array of all registered RW command types merged with any existing configuration from c...
Definition: commandSpecBuilder.h:27
Json::Value myPrevScenarioStatusStable
Definition: vrfManager.h:287
std::thread myVrfThread
Definition: vrfManager.h:301
std::unique_ptr< makVrf::DtVrlinkVrfRemoteController > myRemoteController
Definition: vrfManager.h:308
std::atomic< bool > myRunning
Definition: vrfManager.h:302
bool isInitialized() const
Definition: vrfManager.h:108