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.
lorademodsettings.cpp
Go to the documentation of this file.
1 #include "lorademodsettings.h"
2 
3 #include <QColor>
4 
5 #include "dsp/dspengine.h"
8 #include "lorademodsettings.h"
9 
10 const int LoRaDemodSettings::bandwidths[] = {7813,15625,20833,31250,62500};
12 
14  m_centerFrequency(0),
15  m_channelMarker(0),
16  m_spectrumGUI(0)
17 {
19 }
20 
22 {
23  m_bandwidthIndex = 0;
24  m_spread = 0;
25  m_rgbColor = QColor(255, 0, 255).rgb();
26  m_title = "LoRa Demodulator";
27 }
28 
29 QByteArray LoRaDemodSettings::serialize() const
30 {
31  SimpleSerializer s(1);
34  s.writeS32(3, m_spread);
35 
36  if (m_spectrumGUI) {
38  }
39 
40  if (m_channelMarker) {
42  }
43 
44  s.writeString(6, m_title);
45 
46  return s.final();
47 }
48 
49 bool LoRaDemodSettings::deserialize(const QByteArray& data)
50 {
51  SimpleDeserializer d(data);
52 
53  if(!d.isValid())
54  {
56  return false;
57  }
58 
59  if(d.getVersion() == 1)
60  {
61  QByteArray bytetmp;
62 
63  d.readS32(1, &m_centerFrequency, 0);
64  d.readS32(2, &m_bandwidthIndex, 0);
65  d.readS32(3, &m_spread, 0);
66 
67  if (m_spectrumGUI) {
68  d.readBlob(4, &bytetmp);
69  m_spectrumGUI->deserialize(bytetmp);
70  }
71 
72  if (m_channelMarker) {
73  d.readBlob(5, &bytetmp);
74  m_channelMarker->deserialize(bytetmp);
75  }
76 
77  d.readString(6, &m_title, "LoRa Demodulator");
78 
79  return true;
80  }
81  else
82  {
84  return false;
85  }
86 }
Serializable * m_channelMarker
void writeBlob(quint32 id, const QByteArray &value)
static const int bandwidths[]
Serializable * m_spectrumGUI
bool readString(quint32 id, QString *result, const QString &def=QString::null) const
bool deserialize(const QByteArray &data)
bool isValid() const
static const int nb_bandwidths
bool readS32(quint32 id, qint32 *result, qint32 def=0) const
bool readBlob(quint32 id, QByteArray *result, const QByteArray &def=QByteArray()) const
void writeS32(quint32 id, qint32 value)
quint32 getVersion() const
virtual bool deserialize(const QByteArray &data)=0
virtual QByteArray serialize() const =0
QByteArray serialize() const
void writeString(quint32 id, const QString &value)
const QByteArray & final()