VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtRadioLogic Class Reference

Detailed Description

DtRadioLogic provides management of radio communication systems in the simulation, handling radio channel selection, push-to-talk functionality, crypto settings, and various radio modulation parameters. It supports both standard radios and vehicle intercom systems, automatically managing radio state when embarking or disembarking from vehicles. The component provides menu-driven controls for switching between radios, channels, and communication settings.

#include <radioLogic.h>

Inheritance diagram for makVre::DtRadioLogic:
[legend]

Public Types

enum  PttState { PTT_ON , PTT_OFF }
 

Public Member Functions

 DtRadioLogic ()
 
virtual ~DtRadioLogic () override
 
virtual bool initialize (DtPlayerStation *player, DtInitTable &config) override
 
virtual bool postInitialize () override
 
virtual void tick (double dt) override
 
virtual void shutdown () override
 
virtual const char * type () const override
 
virtual void ptt (PttState state)
 
- Public Member Functions inherited from makVre::DtPlayerComponent
 DtPlayerComponent ()
 
virtual ~DtPlayerComponent ()
 
virtual void setName (const std::string &name)
 
virtual const std::string & name ()
 
virtual DtPlayerStationplayer ()
 
virtual DtAttributeHandleplayerAttributeStore ()
 
virtual const DtAttributeHandleplayerAttributeStore () const
 

Protected Member Functions

virtual void initializeStateAttributes () override
 
DtVreMessageResult handleRadioMenuMessage (DtVreMessage *msg)
 
void handleEmbarkedOnChanged (DtEntityIdentifier val)
 
void updateRadioManager ()
 
void updateAttributes ()
 
void handlePushToTalk (float val)
 
void handleSetRadio (MenuActionMessage *msg)
 
void handleCycleRadio (MenuActionMessage *msg)
 
void handleCycleChannel (MenuActionMessage *msg)
 
void handleCycleDuplex (MenuActionMessage *msg)
 
void handleCycleCryptoSystem (MenuActionMessage *msg)
 
void handleCryptoKeyInput (MenuActionMessage *msg)
 
void handleCycleCryptoMode (MenuActionMessage *msg)
 
void handleCycleModulationSystem (MenuActionMessage *msg)
 
void handleCycleModulationMajor (MenuActionMessage *msg)
 
void handleCycleModulationDetail (MenuActionMessage *msg)
 
void handleCycleFrequencyHopping (MenuActionMessage *msg)
 
void handleCycleTimeHopping (MenuActionMessage *msg)
 
void handleCyclePseudoNoise (MenuActionMessage *msg)
 
std::string currentRadioName ()
 
std::string currentChannelName ()
 
std::string currentDuplex ()
 
std::string currentCryptoSystem ()
 
std::string currentCryptoKey ()
 
std::string currentCryptoMode ()
 
std::string currentModulationSystem ()
 
std::string currentModulationMajor ()
 
std::string currentModulationDetail ()
 
std::string currentFrequencyHopping ()
 
std::string currentTimeHopping ()
 
std::string currentPseudoNoise ()
 
void setCryptoKey (unsigned short cryptoKey)
 

Protected Attributes

int myCurrentRadio
 
DtInputLogic myInputLogic
 
std::map< std::string, boost::function< void(DtRadioLogic *, MenuActionMessage *)> > myMenuActionMessageFnMap
 
boost::signals2::connection myRadioManagerTickConnection
 
DtEntityIdentifier myPreviouslyEmbarkedOn
 
- Protected Attributes inherited from makVre::DtPlayerComponent
std::string myName
 
DtInitTable myConfig
 
DtPlayerStationmyPlayer
 
makVrv::DtDe * myDe
 
DtEntityResolvermyResolver
 
DtAttributeCallbackManager myAttributeCallbacks
 

Member Enumeration Documentation

◆ PttState

Enumeration for push-to-talk state.

Defines the possible states for the push-to-talk functionality

Enumerator
PTT_ON 

Push-to-talk button is pressed, transmitting.

PTT_OFF 

Push-to-talk button is released, not transmitting.

Constructor & Destructor Documentation

◆ DtRadioLogic()

makVre::DtRadioLogic::DtRadioLogic ( )

Constructor for DtRadioLogic.

Initializes the component with the name "DtRadioLogic" and sets up handlers for various radio menu actions

◆ ~DtRadioLogic()

virtual makVre::DtRadioLogic::~DtRadioLogic ( )
overridevirtual

Virtual destructor for DtRadioLogic.

Member Function Documentation

◆ initialize()

virtual bool makVre::DtRadioLogic::initialize ( DtPlayerStation * player,
DtInitTable & config )
overridevirtual

Initializes the radio logic component.

Parameters
playerPointer to the player station this component belongs to
configConfiguration table containing radio settings
Returns
True if initialization succeeded, false otherwise

Sets up the radio manager, registers message handlers, and configures input handling for push-to-talk functionality. Also initializes the current radio based on saved state or configuration.

Reimplemented from makVre::DtPlayerComponent.

References makVre::DtPlayerComponent::player().

◆ postInitialize()

virtual bool makVre::DtRadioLogic::postInitialize ( )
overridevirtual

Performs post-initialization after all components are initialized.

Returns
True if post-initialization succeeded, false otherwise

Currently just returns true as no special post-initialization is needed

Reimplemented from makVre::DtPlayerComponent.

◆ tick()

virtual void makVre::DtRadioLogic::tick ( double dt)
inlineoverridevirtual

Called every frame to update the component state.

Parameters
dtDelta time since the last frame in seconds

Current implementation is empty as updates occur through message handlers and attribute change callbacks

Implements makVre::DtPlayerComponent.

◆ shutdown()

virtual void makVre::DtRadioLogic::shutdown ( )
overridevirtual

Shuts down the radio logic component.

Saves the current radio state to attributes for persistence, removes message handlers and callbacks, and shuts down the radio manager

Reimplemented from makVre::DtPlayerComponent.

◆ type()

virtual const char * makVre::DtRadioLogic::type ( ) const
overridevirtual

Returns the type identifier for this component.

Returns
The type string for DtRadioLogic

Implements makVre::DtPlayerComponent.

◆ ptt()

virtual void makVre::DtRadioLogic::ptt ( PttState state)
virtual

Sets the push-to-talk state for the current radio.

Parameters
stateThe desired PTT state (on or off)

Activates or deactivates transmission on the current radio based on the specified PTT state. Does nothing if no radio is selected.

◆ initializeStateAttributes()

virtual void makVre::DtRadioLogic::initializeStateAttributes ( )
overrideprotectedvirtual

Initializes state attributes for radio communication.

Current implementation is empty as attributes are initialized elsewhere

Reimplemented from makVre::DtPlayerComponent.

◆ handleRadioMenuMessage()

DtVreMessageResult makVre::DtRadioLogic::handleRadioMenuMessage ( DtVreMessage * msg)
protected

Handles menu messages related to radio operations.

Parameters
msgThe menu message to process
Returns
Message handling result indicating the message was handled

Routes menu action messages to the appropriate handler based on the action type

◆ handleEmbarkedOnChanged()

void makVre::DtRadioLogic::handleEmbarkedOnChanged ( DtEntityIdentifier val)
protected

Handles changes to the player's embarked state.

Parameters
valEntity identifier of the vehicle being embarked on, or null if disembarking

Manages vehicle intercom system when embarking on or disembarking from vehicles

◆ updateRadioManager()

void makVre::DtRadioLogic::updateRadioManager ( )
protected

Updates the radio manager based on current radio state.

Ensures only the current radio is powered on, manages audio capture settings, and configures push-to-talk functionality based on radio state

◆ updateAttributes()

void makVre::DtRadioLogic::updateAttributes ( )
protected

Updates state attributes with current radio settings.

Stores all current radio parameters (current radio, channel, crypto settings, etc.) to the player attribute store for UI display and persistence

◆ handlePushToTalk()

void makVre::DtRadioLogic::handlePushToTalk ( float val)
protected

Handles push-to-talk input events.

Parameters
valInput value (1.0 for pressed, 0.0 for released)

Translates input values to PTT states and calls the ptt() function

◆ handleSetRadio()

void makVre::DtRadioLogic::handleSetRadio ( MenuActionMessage * msg)
protected

Sets the current radio to a specific index.

Parameters
msgMenu message containing the radio index as a parameter

◆ handleCycleRadio()

void makVre::DtRadioLogic::handleCycleRadio ( MenuActionMessage * msg)
protected

Cycles to the next available radio or turns off if at the last radio.

Parameters
msgMenu message triggering the action

◆ handleCycleChannel()

void makVre::DtRadioLogic::handleCycleChannel ( MenuActionMessage * msg)
protected

Cycles to the next channel on the current radio.

Parameters
msgMenu message triggering the action

◆ handleCycleDuplex()

void makVre::DtRadioLogic::handleCycleDuplex ( MenuActionMessage * msg)
protected

Cycles through available duplex modes (FULL/HALF)

Parameters
msgMenu message triggering the action

◆ handleCycleCryptoSystem()

void makVre::DtRadioLogic::handleCycleCryptoSystem ( MenuActionMessage * msg)
protected

Cycles through available cryptographic systems.

Parameters
msgMenu message triggering the action

◆ handleCryptoKeyInput()

void makVre::DtRadioLogic::handleCryptoKeyInput ( MenuActionMessage * msg)
protected

Sets the crypto key based on input from a menu.

Parameters
msgMenu message containing the crypto key as a parameter

◆ handleCycleCryptoMode()

void makVre::DtRadioLogic::handleCycleCryptoMode ( MenuActionMessage * msg)
protected

Cycles through available cryptographic modes.

Parameters
msgMenu message triggering the action

◆ handleCycleModulationSystem()

void makVre::DtRadioLogic::handleCycleModulationSystem ( MenuActionMessage * msg)
protected

Cycles through available modulation system types.

Parameters
msgMenu message triggering the action

◆ handleCycleModulationMajor()

void makVre::DtRadioLogic::handleCycleModulationMajor ( MenuActionMessage * msg)
protected

Cycles through available major modulation types.

Parameters
msgMenu message triggering the action

◆ handleCycleModulationDetail()

void makVre::DtRadioLogic::handleCycleModulationDetail ( MenuActionMessage * msg)
protected

Cycles through available modulation detail types.

Parameters
msgMenu message triggering the action

◆ handleCycleFrequencyHopping()

void makVre::DtRadioLogic::handleCycleFrequencyHopping ( MenuActionMessage * msg)
protected

Toggles frequency hopping on/off.

Parameters
msgMenu message triggering the action

◆ handleCycleTimeHopping()

void makVre::DtRadioLogic::handleCycleTimeHopping ( MenuActionMessage * msg)
protected

Toggles time hopping on/off.

Parameters
msgMenu message triggering the action

◆ handleCyclePseudoNoise()

void makVre::DtRadioLogic::handleCyclePseudoNoise ( MenuActionMessage * msg)
protected

Toggles pseudo-noise on/off.

Parameters
msgMenu message triggering the action

◆ currentRadioName()

std::string makVre::DtRadioLogic::currentRadioName ( )
protected

Gets the name of the current radio.

Returns
Name of the current radio or "OFF" if no radio is selected

◆ currentChannelName()

std::string makVre::DtRadioLogic::currentChannelName ( )
protected

Gets the channel name of the current radio.

Returns
Channel name with frequency information or placeholder if not applicable

◆ currentDuplex()

std::string makVre::DtRadioLogic::currentDuplex ( )
protected

Gets the duplex mode of the current radio.

Returns
Duplex mode as a string or placeholder if no radio selected

◆ currentCryptoSystem()

std::string makVre::DtRadioLogic::currentCryptoSystem ( )
protected

Gets the cryptographic system of the current radio.

Returns
Crypto system name or "OTHER" if no radio/channel selected

◆ currentCryptoKey()

std::string makVre::DtRadioLogic::currentCryptoKey ( )
protected

Gets the cryptographic key of the current radio.

Returns
Crypto key as a string or "0" if no radio/channel selected

◆ currentCryptoMode()

std::string makVre::DtRadioLogic::currentCryptoMode ( )
protected

Gets the cryptographic mode of the current radio.

Returns
Crypto mode as a string or empty if no radio/channel selected

◆ currentModulationSystem()

std::string makVre::DtRadioLogic::currentModulationSystem ( )
protected

Gets the modulation system of the current radio.

Returns
Modulation system as a string or empty if no radio/channel selected

◆ currentModulationMajor()

std::string makVre::DtRadioLogic::currentModulationMajor ( )
protected

Gets the major modulation type of the current radio.

Returns
Major modulation type as a string or empty if no radio/channel selected

◆ currentModulationDetail()

std::string makVre::DtRadioLogic::currentModulationDetail ( )
protected

Gets the modulation detail type of the current radio.

Returns
Modulation detail as a string or empty if no radio/channel selected

◆ currentFrequencyHopping()

std::string makVre::DtRadioLogic::currentFrequencyHopping ( )
protected

Gets the frequency hopping state of the current radio.

Returns
"ON" or "OFF" as a string or empty if no radio/channel selected

◆ currentTimeHopping()

std::string makVre::DtRadioLogic::currentTimeHopping ( )
protected

Gets the time hopping state of the current radio.

Returns
"ON" or "OFF" as a string or empty if no radio/channel selected

◆ currentPseudoNoise()

std::string makVre::DtRadioLogic::currentPseudoNoise ( )
protected

Gets the pseudo-noise state of the current radio.

Returns
"ON" or "OFF" as a string or empty if no radio/channel selected

◆ setCryptoKey()

void makVre::DtRadioLogic::setCryptoKey ( unsigned short cryptoKey)
protected

Sets the cryptographic key for the current radio.

Parameters
cryptoKeyThe crypto key value to set

Updates the crypto key of the current radio if one is selected

Member Data Documentation

◆ myCurrentRadio

int makVre::DtRadioLogic::myCurrentRadio
protected

Index of the currently selected radio (-1 if no radio selected)

◆ myInputLogic

DtInputLogic makVre::DtRadioLogic::myInputLogic
protected

Input logic for handling push-to-talk and other input actions.

◆ myMenuActionMessageFnMap

std::map<std::string, boost::function<void(DtRadioLogic*, MenuActionMessage*)> > makVre::DtRadioLogic::myMenuActionMessageFnMap
protected

Map of menu action names to handler functions.

Used to dispatch menu action messages to the appropriate handler methods

◆ myRadioManagerTickConnection

boost::signals2::connection makVre::DtRadioLogic::myRadioManagerTickConnection
protected

Connection made to de post tick to tick the radio manager.

◆ myPreviouslyEmbarkedOn

DtEntityIdentifier makVre::DtRadioLogic::myPreviouslyEmbarkedOn
protected

The documentation for this class was generated from the following file: