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.
limesdroutputsettings.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 "util/simpleserializer.h"
19 
20 #include "limesdroutputsettings.h"
21 
23 {
25 }
26 
28 {
29  m_centerFrequency = 435000*1000;
30  m_devSampleRate = 5000000;
31  m_log2HardInterp = 3;
32  m_log2SoftInterp = 0;
33  m_lpfBW = 5.5e6f;
34  m_lpfFIREnable = false;
35  m_lpfFIRBW = 2.5e6f;
36  m_gain = 4;
37  m_ncoEnable = false;
38  m_ncoFrequency = 0;
40  m_extClock = false;
41  m_extClockFreq = 10000000; // 10 MHz
42  m_transverterMode = false;
44  m_gpioDir = 0;
45  m_gpioPins = 0;
46  m_useReverseAPI = false;
47  m_reverseAPIAddress = "127.0.0.1";
48  m_reverseAPIPort = 8888;
50 }
51 
53 {
54  SimpleSerializer s(1);
55 
59  s.writeFloat(7, m_lpfBW);
61  s.writeFloat(9, m_lpfFIRBW);
62  s.writeU32(10, m_gain);
63  s.writeBool(11, m_ncoEnable);
64  s.writeS32(12, m_ncoFrequency);
65  s.writeS32(13, (int) m_antennaPath);
66  s.writeBool(14, m_extClock);
67  s.writeU32(15, m_extClockFreq);
70  s.writeU32(18, m_gpioDir);
71  s.writeU32(19, m_gpioPins);
76 
77  return s.final();
78 }
79 
80 bool LimeSDROutputSettings::deserialize(const QByteArray& data)
81 {
82  SimpleDeserializer d(data);
83 
84  if (!d.isValid())
85  {
87  return false;
88  }
89 
90  if (d.getVersion() == 1)
91  {
92  int intval;
93  uint32_t uintval;
94 
95  d.readS32(1, &m_devSampleRate, 5000000);
96  d.readU32(2, &m_log2HardInterp, 2);
97  d.readU32(5, &m_log2SoftInterp, 0);
98  d.readFloat(7, &m_lpfBW, 1.5e6);
99  d.readBool(8, &m_lpfFIREnable, false);
100  d.readFloat(9, &m_lpfFIRBW, 1.5e6);
101  d.readU32(10, &m_gain, 4);
102  d.readBool(11, &m_ncoEnable, false);
103  d.readS32(12, &m_ncoFrequency, 0);
104  d.readS32(13, &intval, 0);
105  m_antennaPath = (PathRFE) intval;
106  d.readBool(14, &m_extClock, false);
107  d.readU32(15, &m_extClockFreq, 10000000);
108  d.readBool(16, &m_transverterMode, false);
110  d.readU32(18, &uintval, 0);
111  m_gpioDir = uintval & 0xFF;
112  d.readU32(19, &uintval, 0);
113  m_gpioPins = uintval & 0xFF;
114  d.readBool(20, &m_useReverseAPI, false);
115  d.readString(21, &m_reverseAPIAddress, "127.0.0.1");
116  d.readU32(22, &uintval, 0);
117 
118  if ((uintval > 1023) && (uintval < 65535)) {
119  m_reverseAPIPort = uintval;
120  } else {
121  m_reverseAPIPort = 8888;
122  }
123 
124  d.readU32(23, &uintval, 0);
125  m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval;
126 
127  return true;
128  }
129  else
130  {
131  resetToDefaults();
132  return false;
133  }
134 
135 }
136 
137 
int m_ncoFrequency
Actual NCO frequency (the resulting frequency with mixing is displayed)
bool readFloat(quint32 id, float *result, float def=0) const
bool readS64(quint32 id, qint64 *result, qint64 def=0) const
uint32_t m_extClockFreq
Frequency (Hz) of external clock source.
void writeFloat(quint32 id, float value)
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
bool deserialize(const QByteArray &data)
bool m_ncoEnable
Enable TSP NCO and mixing.
QByteArray serialize() const
void writeS32(quint32 id, qint32 value)
quint32 getVersion() const
uint8_t m_gpioPins
GPIO pins to write; LSB first.
void writeU32(quint32 id, quint32 value)
uint8_t m_gpioDir
GPIO pin direction LSB first; 0 input, 1 output.
void writeBool(quint32 id, bool value)
void writeS64(quint32 id, qint64 value)
bool m_extClock
True if external clock source.
bool m_lpfFIREnable
Enable LMS digital lowpass FIR filters.
uint32_t m_gain
Optimally distributed gain (dB)
float m_lpfBW
LMS amalog lowpass filter bandwidth (Hz)
float m_lpfFIRBW
LMS digital lowpass FIR filters bandwidth (Hz)
void writeString(quint32 id, const QString &value)
const QByteArray & final()