KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Transmitter_PDU.h
Go to the documentation of this file.
1 /*********************************************************************
2 Copyright 2013 Karl Jones
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7 
8 1. Redistributions of source code must retain the above copyright notice, this
9  list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright notice,
11  this list of conditions and the following disclaimer in the documentation
12  and/or other materials provided with the distribution.
13 
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 
25 For Further Information Please Contact me at
26 Karljj1@yahoo.com
27 http://p.sf.net/kdis/UserGuide
28 *********************************************************************/
29 
30 /********************************************************************
31  class: Transmitter_PDU
32  DIS: (5) 1278.1 - 1995
33  created: 21/10/2008
34  author: Karl Jones
35 
36  purpose: Used to communicate the state of a particular radio
37  transmitter or simple intercom.
38 
39  size: 832 bits / 104 octets - min size
40 *********************************************************************/
41 
42 #pragma once
43 
45 #include "./../../DataTypes/RadioEntityType.h"
46 #include "./../../DataTypes/AntennaLocation.h"
47 #include "./../../DataTypes/ModulationType.h"
48 #include "./../../DataTypes/CryptoSystem.h"
49 #include <vector>
50 
51 namespace KDIS {
52 namespace PDU {
53 
55 {
56 protected:
57 
59 
61 
63 
65 
67 
69 
71 
73 
75 
77 
79 
81 
83 
85 
87 
88  std::vector<KOCTET> m_vModulationParams;
89 
90  std::vector<KOCTET> m_vAntennaPattern;
91 
92 public:
93 
94  static const KUINT16 TRANSMITTER_PDU_SIZE = 104; // Min Size
95 
97 
98  Transmitter_PDU( KDataStream & stream ) throw( KException );
99 
100  Transmitter_PDU( const Header & H, KDataStream & stream ) throw( KException );
101 
104  KFLOAT32 FreqBW, KFLOAT32 Power, const KDIS::DATA_TYPE::ModulationType & MT,
105  const KDIS::DATA_TYPE::CryptoSystem & CS, const KOCTET * ModulationParams,
106  KUINT8 ModulationParamsLength, const KOCTET * AntennaPattern,
107  KUINT16 AntennaPatternLength );
108 
109  virtual ~Transmitter_PDU();
110 
111  //************************************
112  // FullName: KDIS::PDU::Transmitter_PDU::SetRadioEntityType
113  // KDIS::PDU::Transmitter_PDU::GetRadioEntityType
114  //!Description: Radio Entity Type
115  // Parameter: const RadioEntityType & Type
116  //************************************
117  void SetRadioEntityType( const KDIS::DATA_TYPE::RadioEntityType & Type );
118  const KDIS::DATA_TYPE::RadioEntityType & GetRadioEntityType() const;
119  KDIS::DATA_TYPE::RadioEntityType & GetRadioEntityType();
120 
121  //************************************
122  // FullName: KDIS::PDU::Transmitter_PDU::SetTransmitState
123  // KDIS::PDU::Transmitter_PDU::GetTransmitState
124  //!Description: Radio Transmit State, on or off.
125  // Parameter: TransmitState TS
126  //************************************
127  void SetTransmitState( KDIS::DATA_TYPE::ENUMS::TransmitState TS );
128  KDIS::DATA_TYPE::ENUMS::TransmitState GetTransmitState() const;
129 
130  //************************************
131  // FullName: KDIS::PDU::Transmitter_PDU::SetInputSource
132  // KDIS::PDU::Transmitter_PDU::GetInputSource
133  //!Description: Source of the radio in relation to the entity.
134  // Parameter: RadioInputSource IS
135  //************************************
136  void SetInputSource( KDIS::DATA_TYPE::ENUMS::RadioInputSource IS );
137  KDIS::DATA_TYPE::ENUMS::RadioInputSource GetInputSource() const;
138 
139  //************************************
140  // FullName: KDIS::PDU::Transmitter_PDU::SetAntennaLocation
141  // KDIS::PDU::Transmitter_PDU::GetAntennaLocation
142  //!Description: Location of the Antenna in world coordinates
143  //! and entity coordinates.
144  // Parameter: const AntennaLocation AL
145  //************************************
146  void SetAntennaLocation( const KDIS::DATA_TYPE::AntennaLocation & AL );
147  const KDIS::DATA_TYPE::AntennaLocation & GetAntennaLocation() const;
148  KDIS::DATA_TYPE::AntennaLocation & GetAntennaLocation();
149 
150  //************************************
151  // FullName: KDIS::PDU::Transmitter_PDU::SetAntennaPatternType
152  // KDIS::PDU::Transmitter_PDU::GetAntennaPatternType
153  //!Description: Type of representation used for radiation pattern
154  //! from antenna.
155  // Parameter: AntennaPatternType APT
156  //************************************
157  void SetAntennaPatternType( KDIS::DATA_TYPE::ENUMS::AntennaPatternType APT );
158  KDIS::DATA_TYPE::ENUMS::AntennaPatternType GetAntennaPatternType() const;
159 
160  //************************************
161  // FullName: KDIS::PDU::Transmitter_PDU::GetAntennaPatternLength
162  //!Description: Length of Antenna pattern parameters in
163  //! octets. Antenna Parameters must end on a 64 bit
164  //! boundary, so this value will be a multiple of 8.
165  //************************************
166  KUINT16 GetAntennaPatternLength() const;
167 
168  //************************************
169  // FullName: KDIS::PDU::Transmitter_PDU::SetFrequency
170  // KDIS::PDU::Transmitter_PDU::GetFrequency
171  //!Description: Center frequency of radio transmission in hertz.
172  // Parameter: KUINT64 F, void
173  //************************************
174  void SetFrequency( KUINT64 F );
175  KUINT64 GetFrequency() const;
176 
177  //************************************
178  // FullName: KDIS::PDU::Transmitter_PDU::SetTransmitFrequencyBandWidth
179  // KDIS::PDU::Transmitter_PDU::GetTransmitFrequencyBandWidth
180  //!Description: Band Width
181  // Parameter: KFLOAT32 TFBW, void
182  //************************************
183  void SetTransmitFrequencyBandWidth( KFLOAT32 TFBW );
184  KFLOAT32 GetTransmitFrequencyBandWidth() const;
185 
186  //************************************
187  // FullName: KDIS::PDU::Transmitter_PDU::SetPower
188  // KDIS::PDU::Transmitter_PDU::GetPower
189  //!Description: Power in decibel-milliwatts
190  // Parameter: KFLOAT32 P
191  //************************************
192  void SetPower( KFLOAT32 P );
193  KFLOAT32 GetPower() const;
194 
195  //************************************
196  // FullName: KDIS::PDU::Transmitter_PDU::SetModulationType
197  // KDIS::PDU::Transmitter_PDU::GetModulationType
198  //!Description: Modulation Type
199  // Parameter: const ModulationType & MT
200  //************************************
201  void SetModulationType( const KDIS::DATA_TYPE::ModulationType & MT );
202  const KDIS::DATA_TYPE::ModulationType & GetModulationType() const;
203  KDIS::DATA_TYPE::ModulationType & GetModulationType();
204 
205  //************************************
206  // FullName: KDIS::PDU::Transmitter_PDU::SetCryptoSystem
207  // KDIS::PDU::Transmitter_PDU::GetCryptoSystem
208  //!Description: Identifies the crypto equipment and key
209  //! used in a transmission .
210  // Parameter: const CryptoSystem & CS
211  //************************************
212  void SetCryptoSystem( const KDIS::DATA_TYPE::CryptoSystem & CS );
213  const KDIS::DATA_TYPE::CryptoSystem & GetCryptoSystem() const;
214  KDIS::DATA_TYPE::CryptoSystem & GetCryptoSystem();
215 
216  //************************************
217  // FullName: KDIS::PDU::Transmitter_PDU::GetLengthOfModulationParameters
218  //!Description: Returns length in octets of the modulation parameters
219  //! field. modulation parameters must end on a
220  //! 64 bit parameter so this value will be a
221  //! multiple of 8.
222  //************************************
223  KUINT8 GetLengthOfModulationParameters() const;
224 
225  //************************************
226  // FullName: KDIS::PDU::Transmitter_PDU::SetModulationParameters
227  // KDIS::PDU::Transmitter_PDU::GetModulationParameters
228  //!Description: Modulation parameter are interpreted in various ways so
229  //! a buffer is taken/returned. set function will add
230  //! padding if the size is not a multiple of 8.
231  //! copy data over.
232  // Parameter: KOCTET * MP - buffer for writing/reading
233  // Parameter: KUINT8 Length - size of buffer.
234  //************************************
235  void SetModulationParameters( const KOCTET * MP, KUINT8 Length );
236  void GetModulationParameters( KOCTET * MP, KUINT8 Length ) const throw( KException );
237 
238  //************************************
239  // FullName: KDIS::PDU::Transmitter_PDU::SetAntennaPattern
240  // KDIS::PDU::Transmitter_PDU::GetAntennaPattern
241  //!Description: For omni-direction this field is 0, for the other 2
242  //! types the size varies. set function will add
243  //! padding if the size is not a multiple of 8.
244  //! copy data over.
245  // Parameter: KOCTET * MP - buffer for writing/reading
246  // Parameter: KUINT8 Length - size of buffer.
247  //************************************
248  void SetAntennaPattern( const KOCTET * AP, KUINT16 Length );
249  void GetAntennaPattern( KOCTET * AP, KUINT16 Length ) const throw( KException );
250 
251  //************************************
252  // FullName: KDIS::PDU::Transmitter_PDU::GetAsString
253  //!Description: Returns a string representation of the PDU.
254  //************************************
255  virtual KString GetAsString() const;
256 
257  //************************************
258  // FullName: KDIS::PDU::Transmitter_PDU::Decode
259  //!Description: Convert From Network Data.
260  // Parameter: KDataStream & stream
261  // Parameter: bool ignoreHeader = false - Decode the header from the stream?
262  //************************************
263  virtual void Decode( KDataStream & stream, bool ignoreHeader = false ) throw( KException );
264 
265  //************************************
266  // FullName: KDIS::PDU::Transmitter_PDU::Encode
267  //!Description: Convert To Network Data.
268  // Parameter: KDataStream & stream
269  //************************************
270  virtual KDataStream Encode() const;
271  virtual void Encode( KDataStream & stream ) const;
272 
273  KBOOL operator == ( const Transmitter_PDU & Value ) const;
274  KBOOL operator != ( const Transmitter_PDU & Value ) const;
275 };
276 
277 } // END namespace PDU
278 } // END namespace KDIS
279 
Definition: Radio_Communications_Header.h:48
KUINT8 m_ui8LengthOfModulationParam
Definition: Transmitter_PDU.h:82
KUINT8 m_ui8TransmitterState
Definition: Transmitter_PDU.h:60
unsigned short int KUINT16
Definition: KDefines.h:101
KDIS::DATA_TYPE::RadioEntityType m_RadioEntityType
Definition: Transmitter_PDU.h:58
float KFLOAT32
Definition: KDefines.h:113
RadioInputSource
Definition: EnumRadio.h:73
KUINT16 m_ui16Padding1
Definition: Transmitter_PDU.h:64
KUINT16 m_ui16Padding2
Definition: Transmitter_PDU.h:84
KUINT16 m_ui16AntennaPatternType
Definition: Transmitter_PDU.h:68
KUINT8 m_ui8InputSource
Definition: Transmitter_PDU.h:62
TransmitState
Definition: EnumRadio.h:53
Definition: KDefines.h:182
KDIS::DATA_TYPE::ModulationType m_ModulationType
Definition: Transmitter_PDU.h:78
Definition: KDataStream.h:48
std::vector< KOCTET > m_vAntennaPattern
Definition: Transmitter_PDU.h:90
KUINT64 m_ui64Freq
Definition: Transmitter_PDU.h:72
unsigned long long KUINT64
Definition: KDefines.h:105
bool KBOOL
Definition: KDefines.h:119
Definition: Transmitter_PDU.h:54
KFLOAT32 m_f32TransmitFreqBW
Definition: Transmitter_PDU.h:74
std::string KString
Definition: KDefines.h:116
KFLOAT32 m_f32Power
Definition: Transmitter_PDU.h:76
Definition: RadioEntityType.h:46
KUINT16 m_ui16AntennaPatternLength
Definition: Transmitter_PDU.h:70
Definition: AntennaLocation.h:50
Definition: Header7.h:142
KDIS::DATA_TYPE::CryptoSystem m_CryptoSystem
Definition: Transmitter_PDU.h:80
unsigned char KUINT8
Definition: KDefines.h:99
char KOCTET
Definition: KDefines.h:108
std::vector< KOCTET > m_vModulationParams
Definition: Transmitter_PDU.h:88
Definition: CryptoSystem.h:46
#define KDIS_EXPORT
Definition: KDefines.h:82
KDIS::DATA_TYPE::AntennaLocation m_AntennaLocation
Definition: Transmitter_PDU.h:66
AntennaPatternType
Definition: EnumRadio.h:100
KUINT8 m_ui8Padding3
Definition: Transmitter_PDU.h:86
Definition: ModulationType.h:47