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.
fcdproplussettings.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 "fcdproplussettings.h"
21 
23 {
25 }
26 
28 {
29  m_centerFrequency = 435000000;
30  m_rangeLow = true;
31  m_lnaGain = true;
32  m_biasT = false;
33  m_ifGain = 0;
34  m_mixGain = 0;
35  m_rfFilterIndex = 0;
36  m_ifFilterIndex = 0;
37  m_LOppmTenths = 0;
38  m_log2Decim = 0;
40  m_dcBlock = false;
41  m_iqImbalance = false;
42  m_transverterMode = false;
44  m_fileRecordName = "";
45  m_useReverseAPI = false;
46  m_reverseAPIAddress = "127.0.0.1";
47  m_reverseAPIPort = 8888;
49 }
50 
52 {
53  SimpleSerializer s(1);
54 
55  s.writeBool(1, m_biasT);
56  s.writeBool(2, m_rangeLow);
57  s.writeBool(3, m_mixGain);
60  s.writeU32(6, m_log2Decim);
61  s.writeS32(7, (int) m_fcPos);
62  s.writeBool(8, m_dcBlock);
64  s.writeS32(10, m_LOppmTenths);
65  s.writeU32(11, m_ifGain);
72 
73  return s.final();
74 }
75 
76 bool FCDProPlusSettings::deserialize(const QByteArray& data)
77 {
78  SimpleDeserializer d(data);
79 
80  if (!d.isValid())
81  {
83  return false;
84  }
85 
86  if (d.getVersion() == 1)
87  {
88  int intval;
89  uint32_t uintval;
90 
91  d.readBool(1, &m_biasT, false);
92  d.readBool(2, &m_rangeLow, false);
93  d.readBool(3, &m_mixGain, true);
94  d.readS32(4, &m_ifFilterIndex, 0);
95  d.readS32(5, &m_rfFilterIndex, 0);
96  d.readU32(6, &m_log2Decim, 0);
97  d.readS32(7, &intval, 2);
98  m_fcPos = (fcPos_t) intval;
99  d.readBool(8, &m_dcBlock, false);
100  d.readBool(9, &m_iqImbalance, false);
101  d.readS32(10, &m_LOppmTenths, 0);
102  d.readU32(11, &m_ifGain, 0);
103  d.readBool(12, &m_transverterMode, false);
105  d.readBool(14, &m_useReverseAPI, false);
106  d.readString(15, &m_reverseAPIAddress, "127.0.0.1");
107  d.readU32(16, &uintval, 0);
108 
109  if ((uintval > 1023) && (uintval < 65535)) {
110  m_reverseAPIPort = uintval;
111  } else {
112  m_reverseAPIPort = 8888;
113  }
114 
115  d.readU32(17, &uintval, 0);
116  m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval;
117  return true;
118  }
119  else
120  {
121  resetToDefaults();
122  return false;
123  }
124 }
125 
bool readS64(quint32 id, qint64 *result, qint64 def=0) const
QByteArray serialize() const
bool readU32(quint32 id, quint32 *result, quint32 def=0) const
bool readString(quint32 id, QString *result, const QString &def=QString::null) const
bool readBool(quint32 id, bool *result, bool def=false) const
bool isValid() const
unsigned int uint32_t
Definition: rtptypes_win.h:46
bool readS32(quint32 id, qint32 *result, qint32 def=0) const
void writeS32(quint32 id, qint32 value)
bool deserialize(const QByteArray &data)
quint32 getVersion() const
void writeU32(quint32 id, quint32 value)
void writeBool(quint32 id, bool value)
void writeS64(quint32 id, qint64 value)
void writeString(quint32 id, const QString &value)
const QByteArray & final()
uint16_t m_reverseAPIDeviceIndex