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.
plugins
samplesink
filesink
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
21
FileSinkSettings::FileSinkSettings
()
22
{
23
resetToDefaults
();
24
}
25
26
void
FileSinkSettings::resetToDefaults
()
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
{
49
resetToDefaults
();
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
{
61
resetToDefaults
();
62
return
false
;
63
}
64
}
FileSinkSettings::m_log2Interp
quint32 m_log2Interp
Definition:
filesinksettings.h:26
SimpleDeserializer
Definition:
simpleserializer.h:51
FileSinkSettings::deserialize
bool deserialize(const QByteArray &data)
Definition:
filesinksettings.cpp:43
FileSinkSettings::FileSinkSettings
FileSinkSettings()
Definition:
filesinksettings.cpp:21
SimpleDeserializer::readU32
bool readU32(quint32 id, quint32 *result, quint32 def=0) const
Definition:
simpleserializer.cpp:350
FileSinkSettings::resetToDefaults
void resetToDefaults()
Definition:
filesinksettings.cpp:26
SimpleDeserializer::isValid
bool isValid() const
Definition:
simpleserializer.h:66
SimpleSerializer
Definition:
simpleserializer.h:9
SimpleDeserializer::getVersion
quint32 getVersion() const
Definition:
simpleserializer.h:67
SimpleDeserializer::readU64
bool readU64(quint32 id, quint64 *result, quint64 def=0) const
Definition:
simpleserializer.cpp:402
SimpleSerializer::writeU32
void writeU32(quint32 id, quint32 value)
Definition:
simpleserializer.cpp:71
FileSinkSettings::serialize
QByteArray serialize() const
Definition:
filesinksettings.cpp:33
FileSinkSettings::m_sampleRate
quint64 m_sampleRate
Definition:
filesinksettings.h:25
FileSinkSettings::m_centerFrequency
quint64 m_centerFrequency
Definition:
filesinksettings.h:24
SimpleSerializer::final
const QByteArray & final()
Definition:
simpleserializer.cpp:257
filesinksettings.h
SimpleSerializer::writeU64
void writeU64(quint32 id, quint64 value)
Definition:
simpleserializer.cpp:133
simpleserializer.h
Generated on Fri Aug 2 2019 17:56:31 for SDRAngel by
1.8.13