VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
radioTransmitterStateComponent.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
11 #include "vrfutil/rwUUID.h"
12 #include <legionStandardOM/sets/readRadioTransmitterRepository.hpp>
13 #include <legionStandardOM/sets/writeRadioTransmitterRepository.hpp>
14 #include <matrix/vlVector.h>
15 #include <vlpi/entityType.h>
16 
17 namespace makVrf
18 {
20  {
22  {
32  Intercom
33  };
34 
36  : myAntennaPatternType(0)
37  , myPseudoNoiseInUse(false)
38  , myTimeHopInUse(false)
39  , myModulationParams(0)
40  , myModulationParamsSize(0)
41  , myRadioId(0)
42  {
43  }
44 
46  : myWorldAntennaLoc(orig.myWorldAntennaLoc)
47  , myRelativeAntennaLoc(orig.myRelativeAntennaLoc)
48  , myAntennaPatternType(orig.myAntennaPatternType)
49  , myPseudoNoiseInUse(orig.myPseudoNoiseInUse)
50  , myTimeHopInUse(orig.myTimeHopInUse)
51  , myModulationParams(0)
52  , myModulationParamsSize(0)
53  , myRadioId(orig.myRadioId)
54  {
55  if (orig.myModulationParams)
56  {
57  myModulationParams = (char*)malloc(orig.myModulationParamsSize);
58  memcpy(myModulationParams, orig.myModulationParams, orig.myModulationParamsSize);
59  myModulationParamsSize = orig.myModulationParamsSize;
60  }
61  }
62 
64  {
65  if (myModulationParams)
66  {
67  free(myModulationParams);
68  }
69  }
70 
72  {
73  myRelativeAntennaLoc = orig.myRelativeAntennaLoc;
74  myWorldAntennaLoc = orig.myWorldAntennaLoc;
75  myRadioId = orig.myRadioId;
76  myAntennaPatternType = orig.myAntennaPatternType;
77  myPseudoNoiseInUse = orig.myPseudoNoiseInUse;
78  myTimeHopInUse = orig.myTimeHopInUse;
79 
80  if (myModulationParams)
81  {
82  free(myModulationParams);
83  myModulationParams = 0;
84  myModulationParamsSize = 0;
85  }
86 
87  if (orig.myModulationParams)
88  {
89  myModulationParams = (char*)malloc(orig.myModulationParamsSize);
90  memcpy(myModulationParams, orig.myModulationParams, orig.myModulationParamsSize);
91  myModulationParamsSize = orig.myModulationParamsSize;
92  }
93 
94  return *this;
95  }
96 
97  DEFINE_ACCESSOR_MUTATOR(DtVector, worldAntennaLoc, WorldAntennaLoc)
98  DEFINE_ACCESSOR_MUTATOR(DtVector, relativeAntennaLoc, RelativeAntennaLoc)
99  DEFINE_ACCESSOR_MUTATOR(unsigned int, antennaPatternType, AntennaPatternType)
100  DEFINE_ACCESSOR_MUTATOR(UInt64, radioId, RadioId)
101  DEFINE_ACCESSOR_MUTATOR(bool, pseudoNoiseInUse, PseudoNoiseInUse)
102  DEFINE_ACCESSOR_MUTATOR(bool, timeHopInUse, TimeHopInUse)
103 
104  const char* modulationParams() const { return myModulationParams; };
105  const unsigned char& modulationParamsSize() const { return myModulationParamsSize; };
106 
107  void setModulationParams(const char* p, unsigned char l)
108  {
109  if (myModulationParams)
110  {
111  free(myModulationParams);
112  myModulationParamsSize = 0;
113  }
114 
115  if (p && l)
116  {
117  myModulationParams = (char*)malloc(l);
118  memcpy(myModulationParams, p, l);
119  myModulationParamsSize = l;
120  }
121  }
122 
123  protected:
125  unsigned char myModulationParamsSize;
126 
129  unsigned int myAntennaPatternType;
130 
133 
135  };
136 
140  {
141  public:
143 
145  : DtFrameStateInterface(storage)
146  {
147  }
148 
150  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(unsigned int, transmitState, TransmitState)
151  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(DtRadioEntityType, radioEntityType, RadioEntityType)
152  virtual const unsigned long long frequency() const { throw DtUnimplementedMethod("The const frequency() method is unimplemented"); };
153  virtual void setFrequency(unsigned long long) { throw DtUnimplementedMethod("The const setFrquency(unsigned long long) method is unimplemented"); };
154  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(float, power, Power)
155  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(DtVector, relativeAntennaLoc, RelativeAntennaLoc)
156  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(DtVector, relativePosition, RelativePosition)
157  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(DtVector, worldAntennaLoc, WorldAntennaLoc)
158  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(unsigned int, inputSource, InputSource)
159  UNDEFINED_RETURNVALUE_ACCESSOR(unsigned long, streamTagUpper)
160  UNDEFINED_RETURNVALUE_ACCESSOR(unsigned long, streamTagLower)
161  virtual const unsigned long long streamTag() const { throw DtUnimplementedMethod("The const streamTag() method is unimplemented"); };
162  virtual void setStreamTag(unsigned long u, unsigned long l) { throw DtUnimplementedMethod("The const setStreamTag() method is unimplemented"); };
163  virtual void setStreamTag(unsigned long long) { throw DtUnimplementedMethod("The const setStreamTag(unsigned long long) method is unimplemented"); };
164  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(unsigned int, antennaPatternType, AntennaPatternType)
166  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(unsigned int, cryptoKey, CryptoKey)
167  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(unsigned int, cryptoMode, CryptoMode)
168  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(unsigned int, cryptoSystem, CryptoSystem)
169  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(unsigned int, detailedModulationType, DetailedModulationType)
170  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(float, frequencyBandwidth, FrequencyBandwidth)
171  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(bool, frequencyHopInUse, FrequencyHopInUse)
172  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(bool, pseudoNoiseInUse, PseudoNoiseInUse)
173  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(bool, timeHopInUse, TimeHopInUse)
174  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(unsigned int, majorModulationType, MajorModulationType)
175  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(unsigned int, modulationSystemType, ModulationSystemType)
176  UNDEFINED_RETURNVALUE_ACCESSOR(char*, modulationParams)
177  UNDEFINED_RETURNREF_ACCESSOR(unsigned char, modulationParamsSize)
178  virtual void setModulationParams(const char* params, unsigned char length) { throw DtUnimplementedMethod("The const setModulationParams() method is unimplemented"); };
179  };
180 
183  {
184  public:
186 
188 
190  const DtRadioTransmitterStateComponentData& frameState() const { return myData; };
192 
193  const DtUUID hostId() const;
194 
195  const unsigned int transmitState() const;
196  void setTransmitState(const unsigned int&);
197 
198  const unsigned int& antennaPatternType() const;
199  void setAntennaPatternType(const unsigned int&);
200 
201  const UInt64 radioId() const;
202  void setRadioId(const UInt64&);
203 
204  const DtRadioEntityType radioEntityType() const;
205  void setRadioEntityType(const DtRadioEntityType&);
206 
207  const unsigned long long frequency() const;
208  void setFrequency(unsigned long long);
209 
210  const unsigned long streamTagUpper() const;
211  const unsigned long streamTagLower() const;
212  const unsigned long long streamTag() const;
213  void setStreamTag(unsigned long u, unsigned long l);
214  void setStreamTag(unsigned long long tag);
215 
216  const float power() const;
217  void setPower(const float&);
218 
219  const char* modulationParams() const;
220  const unsigned char& modulationParamsSize() const;
221  void setModulationParams(const char* params, unsigned char length);
222 
223  const DtVector& relativeAntennaLoc() const;
224  void setRelativeAntennaLoc(const DtVector&);
225 
226  const DtVector& worldAntennaLoc() const;
227  void setWorldAntennaLoc(const DtVector&);
228 
229  const DtVector relativePosition() const;
230  void setRelativePosition(const DtVector&);
231 
232  const unsigned int inputSource() const;
233  void setInputSource(const unsigned int&);
234 
235  const unsigned int cryptoKey() const;
236  void setCryptoKey(const unsigned int&);
237 
238  const unsigned int cryptoMode() const;
239  void setCryptoMode(const unsigned int&);
240 
241  const unsigned int cryptoSystem() const;
242  void setCryptoSystem(const unsigned int&);
243 
244  const unsigned int majorModulationType() const;
245  void setMajorModulationType(const unsigned int&);
246 
247  const unsigned int modulationSystemType() const;
248  void setModulationSystemType(const unsigned int&);
249 
250  const unsigned int detailedModulationType() const;
251  void setDetailedModulationType(const unsigned int&);
252 
253  const float frequencyBandwidth() const;
254  void setFrequencyBandwidth(const float&);
255 
256  const bool frequencyHopInUse() const;
257  void setFrequencyHopInUse(const bool&);
258 
259  const bool& pseudoNoiseInUse() const;
260  void setPseudoNoiseInUse(const bool&);
261 
262  const bool& timeHopInUse() const;
263  void setTimeHopInUse(const bool&);
264 
266  virtual void makeWritable();
267 
269  virtual void makeReadOnly();
270 
272  UInt64 globalId() const;
273 
274  Legion::WriteStateInstance writeStateInstance() override;
275  virtual void updateStateData(DtStateData*) override;
276 
277  void cleanupWriteState();
278 
279  void setPublishingOnLegionNetwork(bool b);
280 
281  protected:
283  LOM::WriteRadioTransmitterRepository myWriteRadioTransmitterRepository;
286  };
287 
290  {
291  public:
293 
295  const DtRadioTransmitterStateComponentData& frameState() const { return myData; };
296 
297  const DtUUID hostId() const;
298  const unsigned int transmitState() const;
299  const DtRadioEntityType radioEntityType() const;
300  const unsigned long long frequency() const;
301  const unsigned long long streamTag() const;
302  const unsigned long streamTagUpper() const;
303  const unsigned long streamTagLower() const;
304  const float power() const;
305  const DtVector& worldAntennaLoc() const;
306  const DtVector& relativeAntennaLoc() const;
307  const DtVector relativePosition() const;
308  const unsigned int inputSource() const;
309  const unsigned int& antennaPatternType() const;
310  const UInt64 radioId() const;
311  const unsigned int cryptoKey() const;
312  const unsigned int cryptoMode() const;
313  const unsigned int cryptoSystem() const;
314  const unsigned int detailedModulationType() const;
315  const float frequencyBandwidth() const;
316  const bool frequencyHopInUse() const;
317  const bool& pseudoNoiseInUse() const;
318  const bool& timeHopInUse() const;
319  const unsigned int majorModulationType() const;
320  const unsigned int modulationSystemType() const;
321  const char* modulationParams() const;
322  const unsigned char& modulationParamsSize() const;
323 
324  bool readComponentValid() const;
325  bool findReadComponent();
326  Legion::ReadStateInstance readStateInstance() const override;
327 
329  UInt64 globalId() const;
330  virtual void updateStateData(DtStateData*) override;
331 
332  protected:
335  {
336  myData = data;
337  }
338 
339  protected:
340  LOM::ReadRadioTransmitterRepository myReadRadioTransmitterRepository;
343  };
344 
348  {
349  public:
351 
352  bool isDoubleBuffered() { return true; };
353  const DtFrameStateInterface* currentFrameState() const { return &myCurrentFrameState; }
354  virtual DtFrameStateInterface* nextFrameState() { return &myNextFrameState; };
355  virtual const DtFrameStateInterface* nextFrameState() const { return &myNextFrameState; };
356 
358  {
359  if (!myFoundComponent)
360  {
361  myFoundComponent = myCurrentFrameState.findReadComponent();
362  }
363 
364  if (myNextFrameState.isWritable())
365  {
366  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
367  }
368 
369  myCurrentFrameState.emitComponentUpdated();
370  }
371 
373  {
374  myCurrentFrameState.updateStateData(sd);
375  myNextFrameState.updateStateData(sd);
376  }
377 
379  virtual bool forceAdvance();
380 
382  virtual void firstFrameAdvance() override;
383 
384  virtual void aboutToBeDeleted() override
385  {
387  myCurrentFrameState.aboutToBeDeleted();
388  myNextFrameState.aboutToBeDeleted();
389  }
390 
391  virtual void completeSetup() override;
392  virtual void removeAdditionalStateComponents() override;
393  virtual void setPublishingOnLegionNetwork(bool b) override;
394 
395  protected:
399  };
400 
404 }
Definition: radioTransmitterStateComponent.h:27
UUID is a unique ID wrapper class.
Definition: uuid.h:59
DtRadioTransmitterStateComponentCurrentFrame myCurrentFrameState
Definition: radioTransmitterStateComponent.h:396
Definition: radioTransmitterStateComponent.h:24
Definition: stateDataTypes.h:23
virtual void aboutToBeDeleted() override
Definition: radioTransmitterStateComponent.h:384
3) Define the current frame class. This will be used for read access.
Definition: radioTransmitterStateComponent.h:289
bool isDoubleBuffered()
Definition: radioTransmitterStateComponent.h:352
1) Define the interface class that will be used to represent the next and curent frames. The UNDEFINED_ macros are convenience macros that will define methods that throw exceptions (until they are implemented)
Definition: radioTransmitterStateComponent.h:139
CryptoSystem
Definition: radioStateTypes.h:18
DtRadioTransmitterStateComponentData & frameState()
Definition: radioTransmitterStateComponent.h:191
Definition: radioTransmitterStateComponent.h:19
const DtFrameStateInterface * currentFrameState() const
Definition: radioTransmitterStateComponent.h:353
virtual void setFrequency(unsigned long long)
Definition: radioTransmitterStateComponent.h:153
const DtRadioTransmitterStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: radioTransmitterStateComponent.h:295
virtual void setStreamTag(unsigned long long)
Definition: radioTransmitterStateComponent.h:163
Definition: stateComponent.h:266
virtual const DtFrameStateInterface * nextFrameState() const
Definition: radioTransmitterStateComponent.h:355
Definition: radioTransmitterStateComponent.h:30
ModulationSystemType
Definition: radioStateTypes.h:29
virtual DtFrameStateInterface * nextFrameState()
Definition: radioTransmitterStateComponent.h:354
Definition: radioTransmitterStateComponent.h:31
#define UNDEFINED_RETURNVALUE_ACCESSOR(ReturnType, Member)
Definition: doubleBufferedDataStorage.h:31
TransmitState
Definition: radioStateTypes.h:34
DtRadioTransmitterStateComponentNextFrame myNextFrameState
Definition: radioTransmitterStateComponent.h:397
Contains the DtUUID class declaration.
#define UNDEFINED_RETURNREF_ACCESSOR(ReturnType, Member)
Definition: doubleBufferedDataStorage.h:34
unsigned int myAntennaPatternType
Definition: radioTransmitterStateComponent.h:129
InputSource
Definition: radioStateTypes.h:20
2) Define the next frame class. This will be used for write access.
Definition: radioTransmitterStateComponent.h:182
char * myModulationParams
Definition: radioTransmitterStateComponent.h:124
Definition: radioTransmitterStateComponent.h:25
Definition: radioTransmitterStateComponent.h:23
UInt64 myRadioId
Definition: radioTransmitterStateComponent.h:134
LOM::WriteRadioTransmitterRepository myWriteRadioTransmitterRepository
Definition: radioTransmitterStateComponent.h:283
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:339
#define DEFINE_STATE_COMPONENT_TYPE(CreatedComponent)
Definition: stateComponent.h:228
const unsigned char & modulationParamsSize() const
Definition: radioTransmitterStateComponent.h:105
CryptoMode
Definition: radioStateTypes.h:17
bool myPseudoNoiseInUse
Definition: radioTransmitterStateComponent.h:131
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:379
void setModulationParams(const char *p, unsigned char l)
Definition: radioTransmitterStateComponent.h:107
#define UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(Type, Member, Set)
Definition: doubleBufferedDataStorage.h:53
DtVector myRelativeAntennaLoc
Definition: radioTransmitterStateComponent.h:128
unsigned long long UInt64
Definition: stateDataTypes.h:17
unsigned char myModulationParamsSize
Definition: radioTransmitterStateComponent.h:125
virtual void aboutToBeDeleted()
DtStateData * myStateData
Definition: radioTransmitterStateComponent.h:284
virtual ~DtRadioTransmitterStateComponentData()
Definition: radioTransmitterStateComponent.h:63
DtStateComponentCreator< DtRadioTransmitterStateComponentImplementation > DtRadioTransmitterStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: radioTransmitterStateComponent.h:403
DtVector myWorldAntennaLoc
Definition: radioTransmitterStateComponent.h:127
#define UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(Type, Member, Set)
Definition: doubleBufferedDataStorage.h:57
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Definition: doubleBufferedDataStorage.h:23
DtRadioTransmitterStateComponentData()
Definition: radioTransmitterStateComponent.h:35
bool myFoundComponent
Definition: radioTransmitterStateComponent.h:398
RadioInputSource
Definition: radioTransmitterStateComponent.h:21
bool myPublishingOnLegionNetwork
Definition: radioTransmitterStateComponent.h:282
Definition: radioTransmitterStateComponent.h:28
void updateStateData(DtStateData *sd)
Implement to update data storage to the new state data.
Definition: radioTransmitterStateComponent.h:372
DtRadioTransmitterStateComponentData & operator=(const DtRadioTransmitterStateComponentData &orig)
Definition: radioTransmitterStateComponent.h:71
virtual void setStreamTag(unsigned long u, unsigned long l)
Definition: radioTransmitterStateComponent.h:162
DT_DLL_VRVCORE double length(const makVrv::DtCoordinateSystem &, const std::vector< DtVector > &vertices)
Returns the total distance of a segmented line defined by the provided vector of vertices. Coordinates are in local database coordinates. The coordinate system is used to convert between the local database coordinates and geocentric. All distance is in 2D – the Z value is ignored.
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: radioTransmitterStateComponent.h:347
DtRadioTransmitterStateComponentData(const DtRadioTransmitterStateComponentData &orig)
Definition: radioTransmitterStateComponent.h:45
void advanceFrame(const DtRadioTransmitterStateComponentData &data)
Definition: radioTransmitterStateComponent.h:334
void updateDataStorage()
Implement to update data storage. Called from advanceFrame.
Definition: radioTransmitterStateComponent.h:357
#define DT_DLL_vrfStateData
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfStateDataDefines.h:26
DtRadioTransmitterStateComponentData myData
Definition: radioTransmitterStateComponent.h:342
DtRadioTransmitterStateComponentData myData
Definition: radioTransmitterStateComponent.h:285
Definition: radioTransmitterStateComponent.h:29
AntennaPatternType
Definition: radioStateTypes.h:15
Definition: radioTransmitterStateComponent.h:26
Contains the DtStateComponent class declaration.
const DtRadioTransmitterStateComponentData & frameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: radioTransmitterStateComponent.h:190
DtStateData * myStateData
Definition: radioTransmitterStateComponent.h:341
bool myTimeHopInUse
Definition: radioTransmitterStateComponent.h:132
This is a simple base class that will be used to return a pointer to current or next frame state...
Definition: stateComponent.h:291
LOM::ReadRadioTransmitterRepository myReadRadioTransmitterRepository
Definition: radioTransmitterStateComponent.h:340

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)