WSF
WsfCommComponentHW.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 2017 Infoscitex, a DCS 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#ifndef WSFCOMMCOMPONENTHW_HPP
13#define WSFCOMMCOMPONENTHW_HPP
14
15#include "wsf_export.h"
16
17#include <memory>
18
19#include "WsfCommComponent.hpp"
20#include "WsfEM_Antenna.hpp"
21#include "WsfEM_Rcvr.hpp"
22#include "WsfEM_Xmtr.hpp"
23#include "WsfEvent.hpp"
24
25namespace wsf
26{
27namespace comm
28{
29
32{
33public:
34 static ComponentHW* Find(const Comm& aParent);
35 static ComponentHW* FindOrCreate(Comm& aParent);
36
38 ~ComponentHW() override = default;
39
41
42 WsfComponent* CloneComponent() const override;
43 WsfStringId GetComponentName() const override;
44 const int* GetComponentRoles() const override;
45 void* QueryInterface(int aRole) override;
47
49
50 bool Initialize(double aSimTime) override;
51 bool ProcessInput(UtInput& aInput) override;
52 void TurnOn(double aSimTime) override;
53 void TurnOff(double aSimTime) override;
54 bool CanInteractWith(const Comm* aXmtrCommPtr) override;
56
57 virtual bool CanSendTo(double aSimTime, Comm* aRcvrPtr, Result& aResult);
58
59 virtual bool CanReceiveFrom(double aSimTime, Comm* aXmtrPtr, Result& aResult) { return true; }
60
63
64 virtual unsigned int GetEM_RcvrCount() const { return 1; }
65 virtual WsfEM_Rcvr& GetEM_Rcvr(unsigned int aIndex) { return *mRcvrPtr; }
66 virtual unsigned int GetEM_XmtrCount() const { return 1; }
67 virtual WsfEM_Xmtr& GetEM_Xmtr(unsigned int aIndex) { return *mXmtrPtr; }
69
71
73 double GetAltFreqSelectDelay() const { return mAltFreqSelectDelay; }
74 virtual double GetLastAltFreqSelectTime() const { return mLastAltFreqSelectTime; }
75 virtual void ScheduleAltFreqChange(double aSimTime, int aAltFreqId = -1);
76 void SelectAlternateFrequency(double aSimTime, int aAltFreqId = -1);
78
82
86 {
87 public:
89 AltFrequencyChangeEvent(double aSimTime, Comm* aCommPtr, int aAltFrequencyId = -1);
90
91 EventDisposition Execute() override;
92
93 private:
94 size_t mPlatformIndex;
95 Comm* mCommPtr;
96 int mAltFrequencyId;
97 };
98
99protected:
100 ComponentHW(const ComponentHW& aSrc);
101 ComponentHW& operator=(const ComponentHW& aRhs) = delete;
102
103 std::unique_ptr<WsfEM_Antenna> mAntennaPtr;
104 std::unique_ptr<WsfEM_Xmtr> mXmtrPtr;
105 std::unique_ptr<WsfEM_Rcvr> mRcvrPtr;
106
110
112
115};
116
117} // namespace comm
118} // namespace wsf
119
121
122#endif
#define WSF_DECLARE_COMPONENT_ROLE_TYPE(TYPE, ROLE)
Definition WsfComponentRoles.hpp:44
@ cWSF_COMPONENT_COMM_HW
Definition WsfComponentRoles.hpp:119
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Definition WsfComponent.hpp:39
Definition WsfEM_Rcvr.hpp:68
Definition WsfEM_Xmtr.hpp:55
WsfEvent()=default
EventDisposition
Definition WsfEvent.hpp:37
Definition WsfComm.hpp:43
EventDisposition Execute() override
Definition WsfCommComponentHW.cpp:388
The hardware component that can be attached to all comm systems.
Definition WsfCommComponentHW.hpp:32
virtual bool CanSendTo(double aSimTime, Comm *aRcvrPtr, Result &aResult)
Definition WsfCommComponentHW.cpp:275
void TurnOn(double aSimTime) override
Definition WsfCommComponentHW.cpp:242
bool ProcessInput(UtInput &aInput) override
Definition WsfCommComponentHW.cpp:165
virtual WsfEM_Xmtr & GetEM_Xmtr(unsigned int aIndex)
Definition WsfCommComponentHW.hpp:67
std::unique_ptr< WsfEM_Rcvr > mRcvrPtr
Definition WsfCommComponentHW.hpp:105
double mAltFreqSelectDelay
Definition WsfCommComponentHW.hpp:108
ComponentHW()
Definition WsfCommComponentHW.cpp:56
ComponentHW & operator=(const ComponentHW &aRhs)=delete
double mLastAltFreqSelectTime
Definition WsfCommComponentHW.hpp:109
virtual unsigned int GetEM_RcvrCount() const
Definition WsfCommComponentHW.hpp:64
~ComponentHW() override=default
WsfComponent * CloneComponent() const override
Definition WsfCommComponentHW.cpp:93
bool mAltFreqChangeScheduled
Definition WsfCommComponentHW.hpp:107
bool TransmitsContinuously() const
Definition WsfCommComponentHW.hpp:81
std::unique_ptr< WsfEM_Antenna > mAntennaPtr
Definition WsfCommComponentHW.hpp:103
void * QueryInterface(int aRole) override
Definition WsfCommComponentHW.cpp:112
static ComponentHW * Find(const Comm &aParent)
Find the instance of this component attached to the specified processor.
Definition WsfCommComponentHW.cpp:34
const int * GetComponentRoles() const override
Definition WsfCommComponentHW.cpp:105
void TurnOff(double aSimTime) override
Definition WsfCommComponentHW.cpp:227
virtual unsigned int GetEM_XmtrCount() const
Definition WsfCommComponentHW.hpp:66
WsfStringId GetComponentName() const override
Definition WsfCommComponentHW.cpp:99
double GetAltFreqSelectDelay() const
Definition WsfCommComponentHW.hpp:73
std::unique_ptr< WsfEM_Xmtr > mXmtrPtr
Definition WsfCommComponentHW.hpp:104
static ComponentHW * FindOrCreate(Comm &aParent)
Definition WsfCommComponentHW.cpp:44
bool mTransmitsContinuously
True if this interface transmits continuously.
Definition WsfCommComponentHW.hpp:111
bool CanInteractWith(const Comm *aXmtrCommPtr) override
Definition WsfCommComponentHW.cpp:257
virtual bool CanReceiveFrom(double aSimTime, Comm *aXmtrPtr, Result &aResult)
Definition WsfCommComponentHW.hpp:59
virtual double GetLastAltFreqSelectTime() const
Definition WsfCommComponentHW.hpp:74
WsfStringId mZoneAttenuationModifier
If non-zero, the name of ID of the category to be used for zone-based attenuation.
Definition WsfCommComponentHW.hpp:114
bool IsAltFreqChangeScheduled() const
Definition WsfCommComponentHW.hpp:72
virtual WsfEM_Rcvr & GetEM_Rcvr(unsigned int aIndex)
Definition WsfCommComponentHW.hpp:65
bool Initialize(double aSimTime) override
Definition WsfCommComponentHW.cpp:127
Definition WsfCommResult.hpp:34
Definition WsfComm.cpp:34
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Copyrights Multiple, All Rights Reserved