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.
plutosdroutputsettings.cpp
Go to the documentation of this file.
1 // Copyright (C) 2017 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 "plutosdroutputsettings.h"
21 
22 
24 {
26 }
27 
29 {
30  m_centerFrequency = 435000 * 1000;
31  m_LOppmTenths = 0;
32  m_log2Interp = 0;
33  m_devSampleRate = 2500 * 1000;
34  m_lpfBW = 1500000;
35  m_lpfFIREnable = false;
36  m_lpfFIRBW = 500000U;
38  m_lpfFIRGain = 0;
39  m_att = -50;
41  m_transverterMode = false;
43  m_useReverseAPI = false;
44  m_reverseAPIAddress = "127.0.0.1";
45  m_reverseAPIPort = 8888;
47 }
48 
50 {
51  SimpleSerializer s(1);
52 
53  s.writeS32(1, m_LOppmTenths);
54  s.writeS32(2, m_lpfFIRGain);
56  s.writeU32(4, m_log2Interp);
57  s.writeU32(9, m_lpfBW);
59  s.writeU32(11, m_lpfFIRBW);
61  s.writeS32(13, m_att);
62  s.writeS32(14, (int) m_antennaPath);
69 
70  return s.final();
71 }
72 
73 bool PlutoSDROutputSettings::deserialize(const QByteArray& data)
74 {
75  SimpleDeserializer d(data);
76 
77  if (!d.isValid())
78  {
80  return false;
81  }
82 
83  if (d.getVersion() == 1)
84  {
85  int intval;
86  uint32_t uintval;
87 
88  d.readS32(1, &m_LOppmTenths, 0);
89  d.readS32(2, &m_lpfFIRGain, 0);
90  d.readU32(3, &uintval, 0);
91  if (uintval > 2) {
93  } else {
94  m_lpfFIRlog2Interp = uintval;
95  }
96  d.readU32(4, &m_log2Interp, 0);
97  d.readU32(9, &m_lpfBW, 1500000);
98  d.readBool(10, &m_lpfFIREnable, false);
99  d.readU32(11, &m_lpfFIRBW, 500000U);
100  d.readU64(12, &m_devSampleRate, 1536000U);
101  d.readS32(13, &m_att, -50);
102  d.readS32(14, &intval, 0);
103  if ((intval >= 0) && (intval < (int) RFPATH_END)) {
104  m_antennaPath = (RFPath) intval;
105  } else {
107  }
108  d.readBool(15, &m_transverterMode, false);
110  d.readBool(17, &m_useReverseAPI, false);
111  d.readString(18, &m_reverseAPIAddress, "127.0.0.1");
112  d.readU32(19, &uintval, 0);
113 
114  if ((uintval > 1023) && (uintval < 65535)) {
115  m_reverseAPIPort = uintval;
116  } else {
117  m_reverseAPIPort = 8888;
118  }
119 
120  d.readU32(20, &uintval, 0);
121  m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval;
122 
123  return true;
124  }
125  else
126  {
127  resetToDefaults();
128  return false;
129  }
130 }
131 
133 {
134  switch(path)
135  {
136  case RFPATH_A:
137  s = "A";
138  break;
139  case RFPATH_B:
140  s = "B";
141  break;
142  default:
143  s = "A";
144  break;
145  }
146 }
qint32 m_LOppmTenths
XO correction.
bool readS64(quint32 id, qint64 *result, qint64 def=0) const
qint32 m_att
"hardware" attenuation in dB fourths
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
quint32 m_lpfBW
analog lowpass filter bandwidth (Hz)
bool readS32(quint32 id, qint32 *result, qint32 def=0) const
bool deserialize(const QByteArray &data)
bool m_lpfFIREnable
enable digital lowpass FIR filter
static void translateRFPath(RFPath path, QString &s)
void writeS32(quint32 id, qint32 value)
quint32 getVersion() const
bool readU64(quint32 id, quint64 *result, quint64 def=0) const
quint32 m_lpfFIRlog2Interp
digital lowpass FIR filter log2 of interpolation factor (0..2)
void writeU32(quint32 id, quint32 value)
quint64 m_devSampleRate
Host interface sample rate.
void writeBool(quint32 id, bool value)
void writeS64(quint32 id, qint64 value)
void writeString(quint32 id, const QString &value)
const QByteArray & final()
int m_lpfFIRGain
digital lowpass FIR filter gain (dB)
quint32 m_lpfFIRBW
digital lowpass FIR filter bandwidth (Hz)
void writeU64(quint32 id, quint64 value)