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.
Classes | Static Public Member Functions | Static Protected Attributes | List of all members
SampleSourceSerializer Class Reference

#include <samplesourceserializer.h>

Classes

struct  Data
 

Static Public Member Functions

static void writeSerializedData (const Data &data, QByteArray &serializedData)
 
static bool readSerializedData (const QByteArray &serializedData, Data &data)
 
static void setDefaults (Data &data)
 
static uint getSerializerVersion ()
 

Static Protected Attributes

static const uint m_version = 1
 

Detailed Description

Definition at line 24 of file samplesourceserializer.h.

Member Function Documentation

◆ getSerializerVersion()

static uint SampleSourceSerializer::getSerializerVersion ( )
inlinestatic

Definition at line 44 of file samplesourceserializer.h.

44 { return m_version; }

◆ readSerializedData()

bool SampleSourceSerializer::readSerializedData ( const QByteArray &  serializedData,
Data data 
)
static

Definition at line 40 of file samplesourceserializer.cpp.

References SimpleDeserializer::getVersion(), SimpleDeserializer::isValid(), SampleSourceSerializer::Data::m_bandwidth, SampleSourceSerializer::Data::m_correction, SampleSourceSerializer::Data::m_fcPosition, SampleSourceSerializer::Data::m_frequency, SampleSourceSerializer::Data::m_lnaGain, SampleSourceSerializer::Data::m_log2Decim, SampleSourceSerializer::Data::m_rate, SampleSourceSerializer::Data::m_RxGain1, SampleSourceSerializer::Data::m_RxGain2, SampleSourceSerializer::Data::m_RxGain3, m_version, SimpleDeserializer::readS32(), SimpleDeserializer::readU32(), SimpleDeserializer::readU64(), and setDefaults().

41 {
42  SimpleDeserializer d(serializedData);
43 
44  if (!d.isValid())
45  {
46  setDefaults(data);
47  return false;
48  }
49 
50  if (d.getVersion() == m_version)
51  {
52  d.readU64(1, &data.m_frequency, 0);
53  d.readS32(2, &data.m_correction, 0);
54  d.readS32(3, &data.m_rate, 0);
55  d.readU32(4, &data.m_log2Decim, 0);
56  d.readS32(5, &data.m_bandwidth, 0);
57  d.readS32(6, &data.m_fcPosition, 0);
58  d.readS32(7, &data.m_lnaGain, 0);
59  d.readS32(8, &data.m_RxGain1, 0);
60  d.readS32(9, &data.m_RxGain2, 0);
61  d.readS32(10, &data.m_RxGain3, 0);
62 
63  return true;
64  }
65  else
66  {
67  setDefaults(data);
68  return false;
69  }
70 }
static void setDefaults(Data &data)
+ Here is the call graph for this function:

◆ setDefaults()

void SampleSourceSerializer::setDefaults ( Data data)
static

Definition at line 72 of file samplesourceserializer.cpp.

References SampleSourceSerializer::Data::m_bandwidth, SampleSourceSerializer::Data::m_correction, SampleSourceSerializer::Data::m_fcPosition, SampleSourceSerializer::Data::m_frequency, SampleSourceSerializer::Data::m_lnaGain, SampleSourceSerializer::Data::m_log2Decim, SampleSourceSerializer::Data::m_rate, SampleSourceSerializer::Data::m_RxGain1, SampleSourceSerializer::Data::m_RxGain2, and SampleSourceSerializer::Data::m_RxGain3.

Referenced by readSerializedData().

73 {
74  data.m_frequency = 0;
75  data.m_correction = 0;
76  data.m_rate = 0;
77  data.m_log2Decim = 0;
78  data.m_bandwidth = 0;
79  data.m_fcPosition = 0;
80  data.m_lnaGain = 0;
81  data.m_RxGain1 = 0;
82  data.m_RxGain2 = 0;
83  data.m_RxGain3 = 0;
84 }
+ Here is the caller graph for this function:

◆ writeSerializedData()

void SampleSourceSerializer::writeSerializedData ( const Data data,
QByteArray &  serializedData 
)
static

Definition at line 22 of file samplesourceserializer.cpp.

References SimpleSerializer::final(), SampleSourceSerializer::Data::m_bandwidth, SampleSourceSerializer::Data::m_correction, SampleSourceSerializer::Data::m_fcPosition, SampleSourceSerializer::Data::m_frequency, SampleSourceSerializer::Data::m_lnaGain, SampleSourceSerializer::Data::m_log2Decim, SampleSourceSerializer::Data::m_rate, SampleSourceSerializer::Data::m_RxGain1, SampleSourceSerializer::Data::m_RxGain2, SampleSourceSerializer::Data::m_RxGain3, SimpleSerializer::writeS32(), SimpleSerializer::writeU32(), and SimpleSerializer::writeU64().

23 {
24  SimpleSerializer s(1);
25 
26  s.writeU64(1, data.m_frequency);
27  s.writeS32(2, data.m_correction);
28  s.writeS32(3, data.m_rate);
29  s.writeU32(4, data.m_log2Decim);
30  s.writeS32(5, data.m_bandwidth);
31  s.writeS32(6, data.m_fcPosition);
32  s.writeS32(7, data.m_lnaGain);
33  s.writeS32(8, data.m_RxGain1);
34  s.writeS32(9, data.m_RxGain2);
35  s.writeS32(10, data.m_RxGain3);
36 
37  serializedData = s.final();
38 }
+ Here is the call graph for this function:

Member Data Documentation

◆ m_version

const uint SampleSourceSerializer::m_version = 1
staticprotected

Definition at line 47 of file samplesourceserializer.h.

Referenced by readSerializedData().


The documentation for this class was generated from the following files: