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.
filesinksettings.cpp
Go to the documentation of this file.
1 // Copyright (C) 2016 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 #include "filesinksettings.h"
20 
22 {
24 }
25 
27 {
28  m_centerFrequency = 435000*1000;
29  m_sampleRate = 48000;
30  m_log2Interp = 0;
31 }
32 
33 QByteArray FileSinkSettings::serialize() const
34 {
35  SimpleSerializer s(1);
36 
37  s.writeU64(1, m_sampleRate);
38  s.writeU32(2, m_log2Interp);
39 
40  return s.final();
41 }
42 
43 bool FileSinkSettings::deserialize(const QByteArray& data)
44 {
45  SimpleDeserializer d(data);
46 
47  if (!d.isValid())
48  {
50  return false;
51  }
52 
53  if (d.getVersion() == 1)
54  {
55  d.readU64(1, &m_sampleRate, 48000);
56  d.readU32(2, &m_log2Interp, 0);
57  return true;
58  }
59  else
60  {
62  return false;
63  }
64 }
bool deserialize(const QByteArray &data)
bool readU32(quint32 id, quint32 *result, quint32 def=0) const
bool isValid() const
quint32 getVersion() const
bool readU64(quint32 id, quint64 *result, quint64 def=0) const
void writeU32(quint32 id, quint32 value)
QByteArray serialize() const
const QByteArray & final()
void writeU64(quint32 id, quint64 value)