chore: KDIS datatypes
[KDIS.git] / KDIS / DataTypes / ModulationType.h
blob7ceb436e301977889d32d94cfb7c725011c8f69c
1 /*********************************************************************
2 Copyright 2013 Karl Jones
3 All rights reserved.
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
26 Karljj1@yahoo.com
27 http://p.sf.net/kdis/UserGuide
28 *********************************************************************/
30 /********************************************************************
31 class: ModulationType
32 created: 21/10/2008
33 author: Karl Jones
35 purpose: Contains information about the type of modulation used for
36 a radio transmission.
37 size: 64 bits / 8 octets
38 *********************************************************************/
40 #pragma once
42 #include "./DataTypeBase.h"
44 namespace KDIS {
45 namespace DATA_TYPE {
47 class KDIS_EXPORT ModulationType : public DataTypeBase
49 protected:
51 union
53 struct
55 KUINT16 m_ui16FreqHop : 1;
56 KUINT16 m_ui16PseudoNoise : 1;
57 KUINT16 m_ui16TimeHop : 1;
58 // Bits 3 - 15 TBD
60 KUINT16 m_ui16SpreadSpectrum;
63 KUINT16 m_ui16MajorModulationType;
65 KUINT16 m_ui16Detail;
67 KUINT16 m_ui16System;
69 public:
71 static const KUINT16 MODULATION_TYPE_SIZE = 8;
73 ModulationType();
75 ModulationType( KDataStream & stream );
77 ModulationType( KBOOL FreqHop, KBOOL PseudoNoise, KBOOL TimeHop,
78 KUINT16 MajorModulation, KUINT16 Detail,
79 KUINT16 System );
81 virtual ~ModulationType();
83 //************************************
84 // FullName: KDIS::DATA_TYPE::ModulationType::SetSpreadSpectrum
85 // KDIS::DATA_TYPE::ModulationType::GetSpreadSpectrum
86 // Description: Spread Spectrum Boolean array.
87 // Parameter: KUINT16 SS, void
88 //************************************
89 void SetSpreadSpectrum( KUINT16 SS );
90 KUINT16 GetSpreadSpectrum() const;
92 //************************************
93 // FullName: KDIS::DATA_TYPE::ModulationType::SetFrequencyHop
94 // KDIS::DATA_TYPE::ModulationType::GetFrequencyHop
95 // Description: Spread Spectrum Boolean array value 0.
96 // Parameter: KBOOL FH, void
97 //************************************
98 void SetFrequencyHop( KBOOL FH );
99 KBOOL GetFrequencyHop() const;
101 //************************************
102 // FullName: KDIS::DATA_TYPE::ModulationType::SetPseudoNoise
103 // KDIS::DATA_TYPE::ModulationType::GetPseudoNoise
104 // Description: Spread Spectrum Boolean array value 1.
105 // Parameter: KBOOL PN, void
106 //************************************
107 void SetPseudoNoise( KBOOL PN );
108 KBOOL GetPseudoNoise() const;
110 //************************************
111 // FullName: KDIS::DATA_TYPE::ModulationType::SetTimeHop
112 // KDIS::DATA_TYPE::ModulationType::GetTimeHop
113 // Description: Spread Spectrum Boolean array value 2.
114 // Parameter: KBOOL TH, void
115 //************************************
116 void SetTimeHop( KBOOL TH );
117 KBOOL GetTimeHop() const;
119 //************************************
120 // FullName: KDIS::DATA_TYPE::ModulationType::GetMajorModulation
121 // Description: Major classification of the modulation type.
122 // Note: This value is set automatically from the SetDetails function.
123 //************************************
124 KDIS::DATA_TYPE::ENUMS::RadioMajorModulation GetMajorModulation() const;
126 //************************************
127 // FullName: KDIS::DATA_TYPE::ModulationType::GetMajorModulation
128 // Description: Determines major modulation param.
129 // Provides details information.
130 // Parameter: <various>
131 //************************************
132 void SetDetail( KDIS::DATA_TYPE::ENUMS::DetailAmplitude A );
133 void SetDetail( KDIS::DATA_TYPE::ENUMS::DetailAmplitudeAndAngle AA );
134 void SetDetail( KDIS::DATA_TYPE::ENUMS::DetailAngle A );
135 void SetDetail( KDIS::DATA_TYPE::ENUMS::DetailCombination C );
136 void SetDetail( KDIS::DATA_TYPE::ENUMS::DetailPulse P );
137 void SetDetail( KDIS::DATA_TYPE::ENUMS::DetailUnmodulated U );
138 void SetDetail( KDIS::DATA_TYPE::ENUMS::DetailCarrierPhaseShift CPS );
139 KUINT16 GetDetail() const;
141 //************************************
142 // FullName: KDIS::DATA_TYPE::ModulationType::SetSystem
143 // KDIS::DATA_TYPE::ModulationType::GetSystem
144 // Description: Specifies the interpretation of the
145 // modulation parameter field(s).
146 // Parameter: ModulationSystem S
147 //************************************
148 void SetSystem( KDIS::DATA_TYPE::ENUMS::ModulationSystem S );
149 KDIS::DATA_TYPE::ENUMS::ModulationSystem GetSystem() const;
151 //************************************
152 // FullName: KDIS::DATA_TYPE::ModulationType::GetAsString
153 // Description: Returns a string representation
154 //************************************
155 virtual KString GetAsString() const;
157 //************************************
158 // FullName: KDIS::DATA_TYPE::ModulationType::Decode
159 // Description: Convert From Network Data.
160 // Parameter: KDataStream & stream
161 //************************************
162 virtual void Decode( KDataStream & stream ) ;
164 //************************************
165 // FullName: KDIS::DATA_TYPE::ModulationType::Encode
166 // Description: Convert To Network Data.
167 // Parameter: KDataStream & stream
168 //************************************
169 virtual KDataStream Encode() const;
170 virtual void Encode( KDataStream & stream ) const;
172 KBOOL operator == ( const ModulationType & Value ) const;
173 KBOOL operator != ( const ModulationType & Value ) const;
176 } // END namespace DATA_TYPES
177 } // END namespace KDIS