1 /*********************************************************************
2 Copyright 2013 Karl Jones
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
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.
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.
25 For Further Information Please Contact me at
27 http://p.sf.net/kdis/UserGuide
28 *********************************************************************/
30 /********************************************************************
32 DIS: (6) 1278.1A - 1998 & (7) 1278.1-2012
36 purpose: Identification Friend or Foe (IFF) PDU Layer 1.
37 Additional layers shall contain the following types of data:
41 Layer 1 - basic system data. Always included.
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.
50 Layers 3 - Mode 5 formats. The military Mode 5 system is the only system that currently uses Layer 3.
52 Layers 4 - Mode S formats. The civilian Mode S system is the only system that currently uses Layer 4.
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.
58 Layers 6 & 7 - Not defined. Reserved for future use.
60 Size: 480 bits / 60 octets
61 *********************************************************************/
65 #include "./../Header.h"
66 #include "./../../DataTypes/EntityIdentifier.h"
67 #include "./../../DataTypes/Vector.h"
68 #include "./../../DataTypes/SystemIdentifier.h"
69 #include "./../../DataTypes/FundamentalOperationalData.h"
73 #include "./../../DataTypes/LayerHeader.h"
74 #include "./../../DataTypes/IFF_Layer2.h"
77 #include "./../../DataTypes/IFF_Layer3Interrogator.h"
78 #include "./../../DataTypes/IFF_Layer3Transponder.h"
84 class KDIS_EXPORT IFF_PDU
: public Header
88 KDIS::DATA_TYPE::EntityIdentifier m_EmittingEntityID
;
90 KDIS::DATA_TYPE::EntityIdentifier m_EventID
;
92 KDIS::DATA_TYPE::Vector m_Location
;
94 KDIS::DATA_TYPE::SystemIdentifier m_SystemID
;
96 KUINT8 m_ui8SystemDesignator
; // DIS 7
98 KUINT8 m_ui8SystemSpecific
; // DIS 7
100 KDIS::DATA_TYPE::FundamentalOperationalData m_FOD
;
102 std::vector
<KDIS::DATA_TYPE::LyrHdrPtr
> m_vLayers
;
106 static const KUINT16 IFF_PDU_SIZE
= 60;
110 explicit IFF_PDU( const Header
& H
);
112 IFF_PDU( KDataStream
& stream
) ;
114 IFF_PDU( const Header
& H
, KDataStream
& stream
) ;
116 IFF_PDU( const KDIS::DATA_TYPE::EntityIdentifier
& EmittingID
, const KDIS::DATA_TYPE::EntityIdentifier
& EventID
, const KDIS::DATA_TYPE::Vector
& Location
,
117 const KDIS::DATA_TYPE::SystemIdentifier
& ID
, const KDIS::DATA_TYPE::FundamentalOperationalData
& FOD
);
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();
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();
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();
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();
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();
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;
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;
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;
210 //************************************
211 // FullName: KDIS::PDU::IFF_PDU::GetAsString
212 // Description: Returns a string representation of the PDU.
213 //************************************
214 virtual KString
GetAsString() const;
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 ) ;
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;
232 KBOOL
operator == ( const IFF_PDU
& Value
) const;
233 KBOOL
operator != ( const IFF_PDU
& Value
) const;
236 } // END namespace PDU
237 } // END namespace KDIS