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.
chanalyzersettings.cpp
Go to the documentation of this file.
1 // Copyright (C) 2018 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 <QColor>
19 
20 #include "dsp/dspengine.h"
21 #include "util/simpleserializer.h"
22 #include "settings/serializable.h"
23 
24 #include "chanalyzersettings.h"
25 
27  m_channelMarker(0),
28  m_spectrumGUI(0),
29  m_scopeGUI(0)
30 {
32 }
33 
35 {
36  m_frequency = 0;
37  m_downSample = false;
38  m_downSampleRate = 0;
39  m_bandwidth = 5000;
40  m_lowCutoff = 300;
41  m_spanLog2 = 0;
42  m_ssb = false;
43  m_pll = false;
44  m_fll = false;
45  m_rrc = false;
46  m_rrcRolloff = 35; // 0.35
47  m_pllPskOrder = 1;
49  m_rgbColor = QColor(128, 128, 128).rgb();
50  m_title = "Channel Analyzer";
51 }
52 
54 {
55  SimpleSerializer s(1);
56 
57  s.writeS32(1, m_frequency);
58  s.writeS32(2, m_bandwidth);
60  s.writeU32(4, m_rgbColor);
61  s.writeS32(5, m_lowCutoff);
62  s.writeS32(6, m_spanLog2);
63  s.writeBool(7, m_ssb);
65  s.writeBool(9, m_downSample);
67  s.writeBool(11, m_pll);
68  s.writeBool(12, m_fll);
69  s.writeU32(13, m_pllPskOrder);
70  s.writeS32(14, (int) m_inputType);
71  s.writeString(15, m_title);
72  s.writeBool(16, m_rrc);
73  s.writeU32(17, m_rrcRolloff);
74 
75  return s.final();
76 }
77 
78 bool ChannelAnalyzerSettings::deserialize(const QByteArray& data)
79 {
80  SimpleDeserializer d(data);
81 
82  if(!d.isValid())
83  {
85  return false;
86  }
87 
88  if(d.getVersion() == 1)
89  {
90  QByteArray bytetmp;
91  int tmp;
92 
93  d.readS32(1, &m_frequency, 0);
94  d.readS32(2, &m_bandwidth, 5000);
95 
96  if (m_spectrumGUI) {
97  d.readBlob(3, &bytetmp);
98  m_spectrumGUI->deserialize(bytetmp);
99  }
100 
101  d.readU32(4, &m_rgbColor);
102  d.readS32(5, &m_lowCutoff, 3);
103  d.readS32(6, &m_spanLog2, 0);
104  d.readBool(7, &m_ssb, false);
105 
106  if (m_scopeGUI) {
107  d.readBlob(8, &bytetmp);
108  m_scopeGUI->deserialize(bytetmp);
109  }
110 
111  d.readBool(9, &m_downSample, false);
112  d.readU32(10, &m_downSampleRate, 2000U);
113  d.readBool(11, &m_pll, false);
114  d.readBool(12, &m_fll, false);
115  d.readU32(13, &m_pllPskOrder, 1);
116  d.readS32(14, &tmp, 0);
117  m_inputType = (InputType) tmp;
118  d.readString(15, &m_title, "Channel Analyzer");
119  d.readBool(16, &m_rrc, false);
120  d.readU32(17, &m_rrcRolloff, 35);
121 
122  return true;
123  }
124  else
125  {
126  resetToDefaults();
127  return false;
128  }
129 }
void writeBlob(quint32 id, const QByteArray &value)
bool deserialize(const QByteArray &data)
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
bool readS32(quint32 id, qint32 *result, qint32 def=0) const
bool readBlob(quint32 id, QByteArray *result, const QByteArray &def=QByteArray()) const
quint32 m_rrcRolloff
in 100ths
QByteArray serialize() const
void writeS32(quint32 id, qint32 value)
quint32 getVersion() const
virtual bool deserialize(const QByteArray &data)=0
void writeU32(quint32 id, quint32 value)
virtual QByteArray serialize() const =0
void writeBool(quint32 id, bool value)
void writeString(quint32 id, const QString &value)
const QByteArray & final()