KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Header7.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: Header7
32  DIS: (7) 1278.1 - 200x draft 15
33  created: 03/02/2011
34  author: Karl Jones
35 
36  purpose: Provides access to the PDU status field introduced in the DIS 7 standard.
37 
38  This field is used to indicate status information that either:
39  (1) affects the processing of this specific PDU as a whole
40  without regard to any specific data field in the PDU.
41  (2) provides information related to the interpretation of
42  one or more data fields or their content.
43  (3) provides information that affects the processing of an
44  entity, other object or environmental process associated with this PDU.
45 
46  Note: Some of these fields are specific to certain PDU, the
47  following shows the PDU status associated with each PDU Type:
48 
49  -- PDU Type -- -- PDU status associated --
50  1 Entity State TEI LVC CEI
51  2 Fire LVC CEI FTI
52  3 Detonation LVC CEI DTI
53  4 Collision CEI
54  5 Service Request CEI
55  6 Resupply Offer CEI
56  7 Resupply Received CEI
57  8 Resupply Cancel CEI
58  9 Repair Complete CEI
59  10 Repair Response CEI
60  11 Create Entity CEI
61  12 Remove Entity CEI
62  13 Start Resume CEI
63  14 Stop Freeze CEI
64  15 Acknowledge CEI
65  16 Action Request CEI
66  17 Action Response CEI
67  18 Data Query CEI
68  19 Set Data CEI
69  20 Data CEI
70  21 Event Report CEI
71  22 Message CEI
72  23 Electromagnetic Emission TEI LVC CEI
73  24 Designator TEI LVC CEI
74  25 Transmitter TEI LVC CEI RAI
75  26 Signal TEI LVC CEI RAI
76  27 Receiver TEI LVC CEI RAI
77  28 IFF ATC NAVAIDS TEI LVC CEI SM
78  29 UnderwaterAcoustic CEI
79  30 SupplementalEmission EntityState CEI
80  31 IntercomSignal TEI LVC CEI IAI
81  32 IntercomControl TEI LVC CEI IAI
82  33 AggregateState CEI
83  34 IsGroupOf CEI
84  35 TransferControl CEI
85  36 IsPartOf CEI
86  37 MinefieldState CEI
87  38 MinefieldQuery CEI
88  39 MinefieldData CEI
89  40 MinefieldResponseNAK CEI
90  41 EnvironmentalProcess TEI LVC CEI
91  42 GriddedData CEI
92  43 PointObjectState CEI
93  44 LinearObjectState CEI
94  45 ArealObjectState CEI
95  46 TSPI CEI
96  47 Appearance CEI
97  48 ArticulatedParts CEI
98  49 LEFire CEI
99  50 LEDetonation CEI
100  51 CreateEntity R CEI
101  52 RemoveEntity R CEI
102  53 Start Resume R CEI
103  54 Stop Freeze R CEI
104  55 Acknowledge R CEI
105  56 ActionRequest R CEI
106  57 ActionResponse R CEI
107  58 DataQuery R CEI
108  59 SetData R CEI
109  60 Data R CEI
110  61 EventReport R CEI
111  62 Comment R CEI
112  63 Record R CEI
113  64 SetRecord R CEI
114  65 RecordQuery R CEI
115  66 Collision Elastic CEI
116  67 EntityStateUpdate TEI LVC CEI
117  68 DirectedEnergyFire LVC CEI
118  69 DirectedEnergyDamageStatus LVC CEI
119  70 IO Action LVC CEI
120  71 IO Report LVC CEI
121  72 Attribute
122 
123  Legend: CEI - Coupled Extension Indicator
124  TEI - Transferred Entity Indicator
125  LVC - LVC Indicator
126  FTI - Fire Type Indicator
127  DTI - Detonation Type Indicator
128  RAI - Radio Attached Indicator
129  IAI - Intercom Attached Indicator
130  SM - Simulation Mode
131 
132  size: Same as Header6
133 *********************************************************************/
134 
135 #pragma once
136 
137 #include "./Header6.h"
138 
139 namespace KDIS {
140 namespace PDU {
141 
143 {
144 protected:
145 
146  union
147  {
148  struct
149  {
150  KUINT8 m_ui8PDUStatusTEI : 1; // Bit 0.
151  KUINT8 m_ui8PDUStatusLVC : 2; // Bits 1-2.
152  KUINT8 m_ui8PDUStatusCEI : 1; // Bit 3.
153 
154  union
155  {
156  struct
157  {
158  KUINT8 m_ui8PDUStatusFTI : 1; // Bit 4.
159  KUINT8 m_ui8PDUStatusBit5 : 1; // Bit 5.
160  };
161 
162  KUINT8 m_ui8PDUStatusDTI_RAI_IAI : 2; // Bits 4-5. Could be used for DTI, RAI or IAI.
163  };
164 
165  KUINT8 m_ui8PDUStatusBit6 : 1; // Bit 6. Unused.
166  KUINT8 m_ui8PDUStatusSM : 1; // Bit 7.
167  };
168 
170 
171  } m_PDUStatusUnion;
172 
173 public:
174 
175  Header7();
176 
177  Header7( KDataStream & stream ) throw( KException );
178 
181 
182  virtual ~Header7();
183 
184  //************************************
185  // FullName: KDIS::PDU::Header7::SetPDUStatus
186  // KDIS::PDU::Header7::GetPDUStatus
187  //!Description: The entire PDU status field.
188  // Parameter: KUINT8 S
189  //************************************
190  void SetPDUStatus( KUINT8 S );
191  KUINT8 GetPDUStatus() const;
192 
193  //************************************
194  // FullName: KDIS::PDU::Header7::SetPDUStatusCEI
195  // KDIS::PDU::Header7::GetPDUStatusCEI
196  //!Description: Indicates whether the PDU is Coupled true(1)
197  //! or Not Coupled false(0) with an Attribute PDU.
198  //!PDU: Applies to all PDU's(1-71) except the Attribute PDU.
199  // Parameter: KBOOL TEI
200  //************************************
201  void SetPDUStatusCEI( KBOOL CEI );
202  KBOOL GetPDUStatusCEI() const;
203 
204  //************************************
205  // FullName: KDIS::PDU::Header7::SetPDUStatusTEI
206  // KDIS::PDU::Header7::GetPDUStatusTEI
207  //!Description: Identifies whether the Simulation Address of the Entity ID contained
208  //! in this PDU is the owner of the entity.
209  //! false(0) = no difference. The Simulation Address of the Entity ID is the owner of Indicator.
210  //! true(1) = difference. The Simulation Address of the Entity ID is not the owner of this entity.
211  //!PDU: See Header7 description to see which PDU's use this field.
212  // Parameter: KBOOL TEI
213  //************************************
214  void SetPDUStatusTEI( KBOOL TEI );
215  KBOOL GetPDUStatusTEI() const;
216 
217  //************************************
218  // FullName: KDIS::DATA_TYPE::Header7::SetPDUStatusLVC
219  // KDIS::DATA_TYPE::Header7::GetPDUStatusLVC
220  //!Description: Indicates whether the data contained in this PDU is related to a
221  //! live(1), virtual(2) or constructive(3) entity. If the LVC designation is not
222  //! able to be determined, this field shall be set to No Statement(0).
223  // For more information on LVC try the Wikipedia page:
224  //! http://en.wikipedia.org/wiki/Live,_Virtual,_and_Constructive
225  //!PDU: See Header7 description to see which PDU's use this field.
226  // Parameter: LVCIndicator LVC
227  //************************************
228  void SetPDUStatusLVC( KDIS::DATA_TYPE::ENUMS::LVCIndicator LVC );
229  KDIS::DATA_TYPE::ENUMS::LVCIndicator GetPDUStatusLVC() const;
230 
231  //************************************
232  // FullName: KDIS::DATA_TYPE::Header7::SetPDUStatusFTI
233  // KDIS::DATA_TYPE::Header7::GetPDUStatusFTI
234  //!Description: Indicates whether the type of object fired was
235  //! a Munition false(0) or an Expendable true(1).
236  //!PDU: Fire(2)
237  // Parameter: KBOOL FTI
238  //************************************
239  void SetPDUStatusFTI( KBOOL FTI );
240  KBOOL GetPDUStatusFTI() const;
241 
242  //************************************
243  // FullName: KDIS::DATA_TYPE::Header7::SetPDUStatusDTI
244  // KDIS::DATA_TYPE::Header7::GetPDUStatusDTI
245  //!Description: Indicates whether the type of object that detonated,
246  //! exploded or burst was a Munition (0), Expendable (1),
247  //! or Non-Munition Explosion (2).
248  //!PDU: Detonation(3)
249  // Parameter: DetonationType DTI
250  //************************************
251  void SetPDUStatusDTI( KDIS::DATA_TYPE::ENUMS::DetonationType DTI );
252  KDIS::DATA_TYPE::ENUMS::DetonationType GetPDUStatusDTI() const;
253 
254  //************************************
255  // FullName: KDIS::DATA_TYPE::Header7::SetPDUStatusRAI
256  // KDIS::DATA_TYPE::Header7::GetPDUStatusRAI
257  //!Description: Used to indicate whether the radio transmitter or receiver
258  //! is attached to an entity or object as follows: No Statement(0),
259  //! Unattached (1) and Attached (2).
260  //!PDU: Transmitter(25), Signal(26), Receiver(27)
261  // Parameter: AttachedIndicator RAI
262  //************************************
263  void SetPDUStatusRAI( KDIS::DATA_TYPE::ENUMS::AttachedIndicator RAI );
264  KDIS::DATA_TYPE::ENUMS::AttachedIndicator GetPDUStatusRAI() const;
265 
266  //************************************
267  // FullName: KDIS::DATA_TYPE::Header7::SetPDUStatusIAI
268  // KDIS::DATA_TYPE::Header7::GetPDUStatusIAI
269  //!Description: Used to indicate whether the intercom is attached to an entity or
270  //! object as follows: No Statement(0), Unattached (1) and Attached (2).
271  //!PDU: IntercomSignal(31), IntercomControl(32)
272  // Parameter: AttachedIndicator IAI
273  //************************************
274  void SetPDUStatusIAI( KDIS::DATA_TYPE::ENUMS::AttachedIndicator RAI );
275  KDIS::DATA_TYPE::ENUMS::AttachedIndicator GetPDUStatusIAI() const;
276 
277  //************************************
278  // FullName: KDIS::PDU::Header7::SetPDUStatusSM
279  // KDIS::PDU::Header7::GetPDUStatusSM
280  //!Description: Indicates whether the Simulation Mode field of the Change/Options record
281  //! for this IFF PDU is set to Regeneration false(0) or Interactive true(1).
282  //!PDU: IFF ATC NAVAIDS(28)
283  // Parameter: KBOOL SM
284  //************************************
285  void SetPDUStatusSM( KBOOL SM );
286  KBOOL GetPDUStatusSM() const;
287 
288  //************************************
289  // FullName: KDIS::PDU::Header7::GetAsString
290  //!Description: Returns a string representation of the PDU.
291  //************************************
292  virtual KString GetAsString() const;
293 
294  //************************************
295  // FullName: KDIS::PDU::Header7::Decode
296  //!Description: Convert From Network Data.
297  // Parameter: KDataStream & stream
298  // Parameter: bool ignoreHeader = false - Decode the header from the stream?
299  //************************************
300  virtual void Decode( KDataStream & stream, bool ignoreHeader = false ) throw( KException );
301 
302  //************************************
303  // FullName: KDIS::PDU::Header7::Encode
304  //!Description: Convert To Network Data.
305  // Parameter: KDataStream & stream
306  //************************************
307  virtual KDataStream Encode() const;
308  virtual void Encode( KDataStream & stream ) const;
309 
310  KBOOL operator == ( const Header7 & Value ) const;
311  KBOOL operator != ( const Header7 & Value ) const;
312 };
313 
314 } // END namespace PDU
315 } // END namespace KDIS
316 
unsigned short int KUINT16
Definition: KDefines.h:101
AttachedIndicator
Definition: EnumRadio.h:559
Definition: EnumEntityManagement.h:362
LVCIndicator
Definition: EnumHeader.h:236
ProtocolVersion
Definition: EnumHeader.h:53
Definition: KDefines.h:182
Definition: KDataStream.h:48
bool KBOOL
Definition: KDefines.h:119
std::string KString
Definition: KDefines.h:116
PDUType
Definition: EnumHeader.h:79
Definition: Header7.h:142
unsigned char KUINT8
Definition: KDefines.h:99
ProtocolFamily
Definition: EnumHeader.h:174
#define KDIS_EXPORT
Definition: KDefines.h:82
KUINT8 m_ui8PDUStatus
Definition: Header7.h:169
DetonationType
Definition: EnumBurstDescriptor.h:281
Definition: TimeStamp.h:68
Definition: Header6.h:55