SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
fcdprosettings.cpp
Go to the documentation of this file.
1 // Copyright (C) 2015 Edouard Griffiths, F4EXB //
3 // //
4 // This program is free software; you can redistribute it and/or modify //
5 // it under the terms of the GNU General Public License as published by //
6 // the Free Software Foundation as version 3 of the License, or //
7 // (at your option) any later version. //
8 // //
9 // This program is distributed in the hope that it will be useful, //
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
12 // GNU General Public License V3 for more details. //
13 // //
14 // You should have received a copy of the GNU General Public License //
15 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
17 
18 #include <QtGlobal>
19 #include "util/simpleserializer.h"
20 #include "fcdprosettings.h"
21 
23 {
25 }
26 
28 {
29  m_centerFrequency = 435000 * 1000;
30  m_dcBlock = false;
31  m_iqCorrection = false;
32  m_LOppmTenths = 0;
33  m_lnaGainIndex = 0;
34  m_rfFilterIndex = 0;
36  m_bandIndex = 0;
37  m_mixerGainIndex = 0;
40  m_modeIndex = 0;
41  m_gain1Index = 0;
42  m_rcFilterIndex = 0;
43  m_gain2Index = 0;
44  m_gain3Index = 0;
45  m_gain4Index = 0;
46  m_ifFilterIndex = 0;
47  m_gain5Index = 0;
48  m_gain6Index = 0;
49  m_log2Decim = 0;
51  m_transverterMode = false;
53  m_fileRecordName = "";
54  m_useReverseAPI = false;
55  m_reverseAPIAddress = "127.0.0.1";
56  m_reverseAPIPort = 8888;
58 }
59 
60 QByteArray FCDProSettings::serialize() const
61 {
62  SimpleSerializer s(1);
63 
64  s.writeBool(1, m_dcBlock);
66  s.writeS32(3, m_LOppmTenths);
70  s.writeS32(7, m_bandIndex);
74  s.writeS32(11, m_modeIndex);
75  s.writeS32(12, m_gain1Index);
77  s.writeS32(14, m_gain2Index);
78  s.writeS32(15, m_gain3Index);
79  s.writeS32(16, m_gain4Index);
81  s.writeS32(18, m_gain5Index);
82  s.writeS32(19, m_gain6Index);
83  s.writeU32(20, m_log2Decim);
84  s.writeS32(21, (int) m_fcPos);
91 
92  return s.final();
93 }
94 
95 bool FCDProSettings::deserialize(const QByteArray& data)
96 {
97  SimpleDeserializer d(data);
98 
99  if (!d.isValid())
100  {
101  resetToDefaults();
102  return false;
103  }
104 
105  if (d.getVersion() == 1)
106  {
107  int intval;
108  uint32_t uintval;
109 
110  d.readBool(1, &m_dcBlock, false);
111  d.readBool(2, &m_iqCorrection, false);
112  d.readS32(3, &m_LOppmTenths, 0);
113  d.readS32(4, &m_lnaGainIndex, 0);
114  d.readS32(5, &m_rfFilterIndex, 0);
115  d.readS32(6, &m_lnaEnhanceIndex, 0);
116  d.readS32(7, &m_bandIndex, 0);
117  d.readS32(8, &m_mixerGainIndex, 0);
118  d.readS32(9, &m_mixerFilterIndex, 0);
119  d.readS32(10, &m_biasCurrentIndex, 0);
120  d.readS32(11, &m_modeIndex, 0);
121  d.readS32(12, &m_gain1Index, 0);
122  d.readS32(13, &m_rcFilterIndex, 0);
123  d.readS32(14, &m_gain2Index, 0);
124  d.readS32(15, &m_gain3Index, 0);
125  d.readS32(16, &m_gain4Index, 0);
126  d.readS32(17, &m_ifFilterIndex, 0);
127  d.readS32(18, &m_gain5Index, 0);
128  d.readS32(19, &m_gain6Index, 0);
129  d.readU32(20, &m_log2Decim, 0);
130  d.readS32(21, &intval, 2);
131  m_fcPos = (fcPos_t) intval;
132  d.readBool(22, &m_transverterMode, false);
134  d.readBool(24, &m_useReverseAPI, false);
135  d.readString(25, &m_reverseAPIAddress, "127.0.0.1");
136  d.readU32(26, &uintval, 0);
137 
138  if ((uintval > 1023) && (uintval < 65535)) {
139  m_reverseAPIPort = uintval;
140  } else {
141  m_reverseAPIPort = 8888;
142  }
143 
144  d.readU32(27, &uintval, 0);
145  m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval;
146 
147  return true;
148  }
149  else
150  {
151  resetToDefaults();
152  return false;
153  }
154 }
uint16_t m_reverseAPIPort
qint32 m_lnaEnhanceIndex
qint32 m_mixerGainIndex
bool readS64(quint32 id, qint64 *result, qint64 def=0) const
quint32 m_log2Decim
bool readU32(quint32 id, quint32 *result, quint32 def=0) const
qint32 m_lnaGainIndex
bool readString(quint32 id, QString *result, const QString &def=QString::null) const
bool readBool(quint32 id, bool *result, bool def=false) const
qint32 m_ifFilterIndex
bool isValid() const
unsigned int uint32_t
Definition: rtptypes_win.h:46
qint64 m_transverterDeltaFrequency
uint16_t m_reverseAPIDeviceIndex
bool readS32(quint32 id, qint32 *result, qint32 def=0) const
QByteArray serialize() const
qint32 m_LOppmTenths
void writeS32(quint32 id, qint32 value)
quint32 getVersion() const
qint32 m_rfFilterIndex
qint32 m_mixerFilterIndex
void writeU32(quint32 id, quint32 value)
QString m_reverseAPIAddress
void writeBool(quint32 id, bool value)
QString m_fileRecordName
void writeS64(quint32 id, qint64 value)
qint32 m_rcFilterIndex
bool deserialize(const QByteArray &data)
void writeString(quint32 id, const QString &value)
const QByteArray & final()
quint64 m_centerFrequency
qint32 m_biasCurrentIndex