VR-Engage  2.2
Loading...
Searching...
No Matches
laserDesignatorConnector.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file laserDesignatorConnector.h
7//! \brief Defines the DtLaserDesignatorConnector class for handling laser designator events
8//!
9//! This connector monitors laser designators in the simulation, providing position
10//! updates and status changes to VREngage components on request.
11
12#pragma once
13
14#include "export.h"
15
17
18//! \brief Forward declaration of the reflected designator class
19class DtReflectedDesignator;
20
21namespace makVrv
22{
24{
25//! \brief Forward declaration of the reflected laser designator list class
26class DtVrlinkReflectedLaserDesignatorList;
27} // namespace DT_PROTOCOL_NAMESPACE
28} // namespace makVrv
29
30namespace makVre
31{
32//! \brief Forward declaration of the VREngage message class
33class DtVreMessage;
34
35//! \brief Connector for monitoring and reporting laser designator events
36//!
37//! DtLaserDesignatorConnector listens for Start/StopMonitoringDesignatorMessages
38//! and provides updates on designator position and removal for monitored laser codes.
39//! It tracks designators by their code and sends position updates when they change or
40//! are removed from the simulation.
42{
43public:
44 //! \brief Default constructor
46
47 //! \brief Virtual destructor
48 virtual ~DtLaserDesignatorConnector() override;
49
50 //! \brief Installs the laser designator connector with the application and connection
51 //! \param app Pointer to the player station application
52 //! \param connection Pointer to the protocol-specific VR-Link connection
53 //!
54 //! Registers designator added/removed callbacks on the reflected list and registers handlers
55 //! for Start/StopMonitoringDesignatorMessages
56 virtual void install(
57 DtPlayerStationApp* app, makVrv::DT_PROTOCOL_NAMESPACE::DtVrlinkConnection* connection) override;
58
59 //! \brief Performs periodic checks of monitored designator positions
60 //!
61 //! For each designator code being monitored (that exists), checks if its location
62 //! has changed. If so, sends an update message with the new position.
63 virtual void tick() override;
64
65 //! \brief Shuts down the laser designator connector
66 //!
67 //! Removes all callback registrations and message handlers
68 virtual void shutdown() override;
69
70 //! \brief Handles the addition of a new designator
71 //! \param des Pointer to the newly added designator
72 //!
73 //! Callback triggered when a new designator is discovered.
74 //! If this code is being monitored, sends an initial update with the position.
75 virtual void handleDesignatorAdded(DtReflectedDesignator* des);
76
77 //! \brief Handles the removal of a designator
78 //! \param des Pointer to the designator about to be removed
79 //!
80 //! Callback triggered when a designator is about to be destroyed.
81 //! If this code is being monitored, sends a deletion notification.
82 virtual void handleDesignatorRemoved(DtReflectedDesignator* des);
83
84protected:
85 //! \brief Handles requests to start monitoring a laser designator
86 //! \param msg Pointer to the monitoring request message
87 //! \return Message result indicating the message was handled
88 //!
89 //! Processes StartMonitoringDesignatorMessages by adding the requested code to myCodesToMonitor.
90 //! If the designator already exists, sends an initial position update.
92
93 //! \brief Handles requests to stop monitoring a laser designator
94 //! \param msg Pointer to the message requesting monitoring to stop
95 //! \return Message result indicating the message was handled
96 //!
97 //! Processes StopMonitoringDesignatorMessages by removing the code from myCodesToMonitor.
99
100protected:
101 //! \brief Type alias for the map of monitored designator codes
102 //!
103 //! Key is the designator code to monitor (integer).
104 //! Value is a pair containing:
105 //! - Pointer to the reflected designator (nullptr if not yet discovered)
106 //! - Last sent position (used to detect changes)
107 using CodeMonitorMap = std::map<int, std::pair<DtReflectedDesignator*, DtVector>>;
108
109 //! \brief Map of laser codes being monitored
110 //!
111 //! Tracks which designator codes are being monitored, along with their
112 //! current designator object and last reported position
114};
115} // namespace makVre
Base class for all simulation event connectors in VREngage.
Definition simEventConnector.h:54
CodeMonitorMap myCodesToMonitor
Map of laser codes being monitored.
Definition laserDesignatorConnector.h:113
virtual ~DtLaserDesignatorConnector() override
Virtual destructor.
DtLaserDesignatorConnector()
Default constructor.
virtual void handleDesignatorAdded(DtReflectedDesignator *des)
Handles the addition of a new designator.
virtual DtVreMessageResult handleStartMonitoringDesignator(DtVreMessage *msg)
Handles requests to start monitoring a laser designator.
virtual DtVreMessageResult handleStopMonitoringDesignator(DtVreMessage *msg)
Handles requests to stop monitoring a laser designator.
virtual void install(DtPlayerStationApp *app, makVrv::DT_PROTOCOL_NAMESPACE::DtVrlinkConnection *connection) override
Installs the laser designator connector with the application and connection.
virtual void shutdown() override
Shuts down the laser designator connector.
std::map< int, std::pair< DtReflectedDesignator *, DtVector > > CodeMonitorMap
Type alias for the map of monitored designator codes.
Definition laserDesignatorConnector.h:107
virtual void tick() override
Performs periodic checks of monitored designator positions.
virtual void handleDesignatorRemoved(DtReflectedDesignator *des)
Handles the removal of a designator.
Top-level class representing the VR-Engage application.
Definition playerStationApp.h:163
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
Defines export macros and protocol namespace for vrePlayerStationConnector.
#define VRL_DLL
Empty definition for non-Windows platforms.
Definition export.h:52
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
Definition connectorAccessory.h:33
Definition appLauncherComponent.h:28
Defines the base DtSimEventConnector class for VREngage simulation events.