KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IFF_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: IFF_PDU
32  DIS: (6) 1278.1A - 1998 & (7) 1278.1-2012
33  updated: 20/09/2013
34  author: Karl Jones
35 
36  purpose: Identification Friend or Foe (IFF) PDU Layer 1.
37  Additional layers shall contain the following types of data:
38 
39  // DIS 6 //
40 
41  Layer 1 - basic system data. Always included.
42 
43  Layer 2 - This layer is used for basic emissions data when required to support
44  simulations that need detailed IFF electromagnetic characteristics.
45  The field formats of the two Operational Parameter fields and the
46  System-Specific Data field may vary depending on the system type.
47 
48  // DIS 7 //
49 
50  Layers 3 - Mode 5 formats. The military Mode 5 system is the only system that currently uses Layer 3.
51 
52  Layers 4 - Mode S formats. The civilian Mode S system is the only system that currently uses Layer 4.
53 
54  Layers 5 - data communications. Optional layer. This layer is used to extend a layer that does
55  not have a standard variable record section (i.e., Layers1 and 2) and to support the
56  emulation of real-world transponder and interrogator data link messages.
57 
58  Layers 6 & 7 - Not defined. Reserved for future use.
59 
60  Size: 480 bits / 60 octets
61 *********************************************************************/
62 
63 #pragma once
64 
65 #include "./../Header.h"
66 #include "./../../DataTypes/EntityIdentifier.h"
67 #include "./../../DataTypes/Vector.h"
68 #include "./../../DataTypes/SystemIdentifier.h"
69 #include "./../../DataTypes/FundamentalOperationalData.h"
70 
71 // Layers
72 #include <vector>
73 #include "./../../DataTypes/LayerHeader.h"
74 #include "./../../DataTypes/IFF_Layer2.h"
75 
76 #if DIS_VERSION > 6
77 #include "./../../DataTypes/IFF_Layer3Interrogator.h"
78 #include "./../../DataTypes/IFF_Layer3Transponder.h"
79 #endif
80 
81 namespace KDIS {
82 namespace PDU {
83 
84 class KDIS_EXPORT IFF_PDU : public Header
85 {
86 protected:
87 
89 
91 
93 
95 
97 
99 
101 
102  std::vector<KDIS::DATA_TYPE::LyrHdrPtr> m_vLayers;
103 
104 public:
105 
106  static const KUINT16 IFF_PDU_SIZE = 60;
107 
108  IFF_PDU();
109 
110  IFF_PDU( const Header & H );
111 
112  IFF_PDU( KDataStream & stream ) throw( KException );
113 
114  IFF_PDU( const Header & H, KDataStream & stream ) throw( KException );
115 
116  IFF_PDU( const KDIS::DATA_TYPE::EntityIdentifier & EmittingID, const KDIS::DATA_TYPE::EntityIdentifier & EventID, const KDIS::DATA_TYPE::Vector & Location,
118 
119  virtual ~IFF_PDU();
120 
121  //************************************
122  // FullName: KDIS::PDU::IFF_PDU::SetEmittingEntityID
123  // KDIS::PDU::IFF_PDU::GetEmittingEntityID
124  //!Description: Emitting Entity ID.
125  // Parameter: const EntityIdentifier & ID
126  //************************************
127  void SetEmittingEntityID ( const KDIS::DATA_TYPE::EntityIdentifier & ID );
128  const KDIS::DATA_TYPE::EntityIdentifier & GetEmittingEntityID() const;
129  KDIS::DATA_TYPE::EntityIdentifier & GetEmittingEntityID();
130 
131  //************************************
132  // FullName: KDIS::PDU::IFF_PDU::SetEventID
133  // KDIS::PDU::IFF_PDU::GetEventID
134  //!Description: Event ID. For associated events.
135  // Parameter: const EntityIdentifier & ID
136  //************************************
137  void SetEventID( const KDIS::DATA_TYPE::EntityIdentifier & ID );
138  const KDIS::DATA_TYPE::EntityIdentifier & GetEventID() const;
139  KDIS::DATA_TYPE::EntityIdentifier & GetEventID();
140 
141  //************************************
142  // FullName: KDIS::PDU::IFF_PDU::SetLocation
143  // KDIS::PDU::IFF_PDU::GetLocation
144  //!Description: Location of the emitting system relative to
145  //! the emitting entity's coordinate system.
146  //! Represented as a Entity Coordinate Vector
147  // Parameter: const Vector & L
148  //************************************
149  void SetLocation( const KDIS::DATA_TYPE::Vector & L );
150  const KDIS::DATA_TYPE::Vector & GetLocation() const;
151  KDIS::DATA_TYPE::Vector & GetLocation();
152 
153  //************************************
154  // FullName: KDIS::PDU::IFF_PDU::SetSystemIdentifier
155  // KDIS::PDU::IFF_PDU::GetSystemIdentifier
156  //!Description: Identifies the emitting system.
157  // Parameter: const SystemIdentifier & ID
158  //************************************
159  void SetSystemIdentifier( const KDIS::DATA_TYPE::SystemIdentifier & ID );
160  const KDIS::DATA_TYPE::SystemIdentifier & GetSystemIdentifier() const;
161  KDIS::DATA_TYPE::SystemIdentifier & GetSystemIdentifier();
162 
163  //************************************
164  // FullName: KDIS::PDU::IFF_PDU::SetFundamentalOperationalData
165  // KDIS::PDU::IFF_PDU::GetFundamentalOperationalData
166  //!Description: Identifies certain basic operational data for an emitting system.
167  // Parameter: const FundamentalOperationalData & FOD
168  //************************************
169  void SetFundamentalOperationalData( const KDIS::DATA_TYPE::FundamentalOperationalData & FOD );
170  const KDIS::DATA_TYPE::FundamentalOperationalData & GetFundamentalOperationalData() const;
171  KDIS::DATA_TYPE::FundamentalOperationalData & GetFundamentalOperationalData();
172 
173  #if DIS_VERSION > 6
174 
175  //************************************
176  // FullName: KDIS::PDU::IFF_PDU::SetSystemDesignator
177  // KDIS::PDU::IFF_PDU::GetSystemDesignator
178  //!Description: A unique decimal number assigned to this interrogator or transponder
179  //! to distinguish it from multiple interrogators or transponders that are
180  //! associated with the same entity.
181  // Parameter: KUINT8 SD
182  //************************************
183  void SetSystemDesignator ( KUINT8 SD );
184  KUINT8 GetSystemDesignator() const;
185 
186  //************************************
187  // FullName: KDIS::PDU::IFF_PDU::SetSystemSpecificData
188  // KDIS::PDU::IFF_PDU::GetSystemSpecificData
189  //!Description: This is a variable format field whose meaning is defined for each specific system.
190  // Parameter: KUINT8 SSD
191  //************************************
192  void SetSystemSpecificData ( KUINT8 SSD );
193  KUINT8 GetSystemSpecificData() const;
194 
195  #endif
196 
197  //************************************
198  // FullName: KDIS::DATA_TYPE::IFF_Layer2::AddLayer
199  // KDIS::DATA_TYPE::IFF_Layer2::SetLayers
200  // KDIS::DATA_TYPE::IFF_Layer2::GetLayers
201  // KDIS::DATA_TYPE::IFF_Layer2::ClearLayers
202  //!Description: Any additional layers attached to this IFF PDU.
203  // Parameter: const KDIS::DATA_TYPE::LyrHdrPtr L, const vector<KDIS::DATA_TYPE::LyrHdrPtr> & L
204  //************************************
205  void AddLayer( const KDIS::DATA_TYPE::LyrHdrPtr & L );
206  void SetLayers( const std::vector<KDIS::DATA_TYPE::LyrHdrPtr> & L );
207  const std::vector<KDIS::DATA_TYPE::LyrHdrPtr> & GetLayers() const;
208  void ClearLayers();
209 
210  //************************************
211  // FullName: KDIS::PDU::IFF_PDU::GetAsString
212  //!Description: Returns a string representation of the PDU.
213  //************************************
214  virtual KString GetAsString() const;
215 
216  //************************************
217  // FullName: KDIS::PDU::IFF_PDU::Decode
218  //!Description: Convert From Network Data.
219  // Parameter: KDataStream & stream
220  // Parameter: bool ignoreHeader = false - Decode the header from the stream?
221  //************************************
222  virtual void Decode( KDataStream & stream, bool ignoreHeader = false ) throw( KException );
223 
224  //************************************
225  // FullName: KDIS::PDU::IFF_PDU::Encode
226  //!Description: Convert To Network Data.
227  // Parameter: KDataStream & stream
228  //************************************
229  virtual KDataStream Encode() const;
230  virtual void Encode( KDataStream & stream ) const;
231 
232  KBOOL operator == ( const IFF_PDU & Value ) const;
233  KBOOL operator != ( const IFF_PDU & Value ) const;
234 };
235 
236 } // END namespace PDU
237 } // END namespace KDIS
KDIS::DATA_TYPE::EntityIdentifier m_EmittingEntityID
Definition: IFF_PDU.h:88
KDIS::DATA_TYPE::SystemIdentifier m_SystemID
Definition: IFF_PDU.h:94
KDIS::DATA_TYPE::Vector m_Location
Definition: IFF_PDU.h:92
unsigned short int KUINT16
Definition: KDefines.h:101
Definition: SystemIdentifier.h:48
KUINT8 m_ui8SystemDesignator
Definition: IFF_PDU.h:96
KDIS::DATA_TYPE::EntityIdentifier m_EventID
Definition: IFF_PDU.h:90
Definition: Vector.h:71
Definition: KDefines.h:182
Definition: KDataStream.h:48
bool KBOOL
Definition: KDefines.h:119
std::vector< KDIS::DATA_TYPE::LyrHdrPtr > m_vLayers
Definition: IFF_PDU.h:102
std::string KString
Definition: KDefines.h:116
Definition: EntityIdentifier.h:49
Definition: Header7.h:142
unsigned char KUINT8
Definition: KDefines.h:99
#define KDIS_EXPORT
Definition: KDefines.h:82
KDIS::DATA_TYPE::FundamentalOperationalData m_FOD
Definition: IFF_PDU.h:100
KUINT8 m_ui8SystemSpecific
Definition: IFF_PDU.h:98
Definition: KRef_Ptr.h:73
Definition: FundamentalOperationalData.h:51
Definition: IFF_PDU.h:84