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.
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
FileInputSettings Struct Reference

#include <fileinputsettings.h>

Public Member Functions

 FileInputSettings ()
 
 ~FileInputSettings ()
 
void resetToDefaults ()
 
QByteArray serialize () const
 
bool deserialize (const QByteArray &data)
 

Static Public Member Functions

static int getAccelerationIndex (int averaging)
 
static int getAccelerationValue (int averagingIndex)
 

Public Attributes

quint64 m_centerFrequency
 
qint32 m_sampleRate
 
QString m_fileName
 
quint32 m_accelerationFactor
 
bool m_loop
 
bool m_useReverseAPI
 
QString m_reverseAPIAddress
 
uint16_t m_reverseAPIPort
 
uint16_t m_reverseAPIDeviceIndex
 

Static Public Attributes

static const unsigned int m_accelerationMaxScale = 2
 Max power of 10 multiplier to 2,5,10 base ex: 2 -> 2,5,10,20,50,100,200,500,1000. More...
 

Detailed Description

Definition at line 24 of file fileinputsettings.h.

Constructor & Destructor Documentation

◆ FileInputSettings()

FileInputSettings::FileInputSettings ( )

Definition at line 24 of file fileinputsettings.cpp.

References resetToDefaults().

25 {
27 }
+ Here is the call graph for this function:

◆ ~FileInputSettings()

FileInputSettings::~FileInputSettings ( )
inline

Definition at line 38 of file fileinputsettings.h.

References deserialize(), getAccelerationIndex(), getAccelerationValue(), resetToDefaults(), and serialize().

38 {}
+ Here is the call graph for this function:

Member Function Documentation

◆ deserialize()

bool FileInputSettings::deserialize ( const QByteArray &  data)

Definition at line 56 of file fileinputsettings.cpp.

References SimpleDeserializer::getVersion(), SimpleDeserializer::isValid(), m_accelerationFactor, m_fileName, m_loop, m_reverseAPIAddress, m_reverseAPIDeviceIndex, m_reverseAPIPort, m_useReverseAPI, SimpleDeserializer::readBool(), SimpleDeserializer::readString(), SimpleDeserializer::readU32(), and resetToDefaults().

Referenced by FileInputGUI::deserialize(), FileInput::deserialize(), and ~FileInputSettings().

57 {
58  SimpleDeserializer d(data);
59 
60  if(!d.isValid()) {
62  return false;
63  }
64 
65  if (d.getVersion() == 1)
66  {
67  uint32_t uintval;
68 
69  d.readString(1, &m_fileName, "./test.sdriq");
70  d.readU32(2, &m_accelerationFactor, 1);
71  d.readBool(3, &m_loop, true);
72  d.readBool(4, &m_useReverseAPI, false);
73  d.readString(5, &m_reverseAPIAddress, "127.0.0.1");
74  d.readU32(6, &uintval, 0);
75 
76  if ((uintval > 1023) && (uintval < 65535)) {
77  m_reverseAPIPort = uintval;
78  } else {
79  m_reverseAPIPort = 8888;
80  }
81 
82  d.readU32(7, &uintval, 0);
83  m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval;
84 
85  return true;
86  }
87  else
88  {
90  return false;
91  }
92 }
uint16_t m_reverseAPIDeviceIndex
unsigned int uint32_t
Definition: rtptypes_win.h:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAccelerationIndex()

int FileInputSettings::getAccelerationIndex ( int  averaging)
static

Definition at line 94 of file fileinputsettings.cpp.

References i, and m_accelerationMaxScale.

Referenced by FileInputGUI::displaySettings(), and ~FileInputSettings().

95 {
96  if (accelerationValue <= 1) {
97  return 0;
98  }
99 
100  int v = accelerationValue;
101  int j = 0;
102 
103  for (int i = 0; i <= accelerationValue; i++)
104  {
105  if (v < 20)
106  {
107  if (v < 2) {
108  j = 0;
109  } else if (v < 5) {
110  j = 1;
111  } else if (v < 10) {
112  j = 2;
113  } else {
114  j = 3;
115  }
116 
117  return 3*i + j;
118  }
119 
120  v /= 10;
121  }
122 
123  return 3*m_accelerationMaxScale + 3;
124 }
int32_t i
Definition: decimators.h:244
static const unsigned int m_accelerationMaxScale
Max power of 10 multiplier to 2,5,10 base ex: 2 -> 2,5,10,20,50,100,200,500,1000. ...
+ Here is the caller graph for this function:

◆ getAccelerationValue()

int FileInputSettings::getAccelerationValue ( int  averagingIndex)
static

Definition at line 126 of file fileinputsettings.cpp.

References m_accelerationMaxScale.

Referenced by FileInputGUI::on_acceleration_currentIndexChanged(), and ~FileInputSettings().

127 {
128  if (accelerationIndex <= 0) {
129  return 1;
130  }
131 
132  unsigned int v = accelerationIndex - 1;
133  int m = pow(10.0, v/3 > m_accelerationMaxScale ? m_accelerationMaxScale : v/3);
134  int x = 1;
135 
136  if (v % 3 == 0) {
137  x = 2;
138  } else if (v % 3 == 1) {
139  x = 5;
140  } else if (v % 3 == 2) {
141  x = 10;
142  }
143 
144  return x * m;
145 }
static const unsigned int m_accelerationMaxScale
Max power of 10 multiplier to 2,5,10 base ex: 2 -> 2,5,10,20,50,100,200,500,1000. ...
+ Here is the caller graph for this function:

◆ resetToDefaults()

void FileInputSettings::resetToDefaults ( )

Definition at line 29 of file fileinputsettings.cpp.

References m_accelerationFactor, m_centerFrequency, m_fileName, m_loop, m_reverseAPIAddress, m_reverseAPIDeviceIndex, m_reverseAPIPort, m_sampleRate, and m_useReverseAPI.

Referenced by deserialize(), FileInput::deserialize(), FileInputSettings(), FileInputGUI::resetToDefaults(), and ~FileInputSettings().

30 {
31  m_centerFrequency = 435000000;
32  m_sampleRate = 48000;
33  m_fileName = "./test.sdriq";
35  m_loop = true;
36  m_useReverseAPI = false;
37  m_reverseAPIAddress = "127.0.0.1";
38  m_reverseAPIPort = 8888;
40 }
uint16_t m_reverseAPIDeviceIndex
+ Here is the caller graph for this function:

◆ serialize()

QByteArray FileInputSettings::serialize ( ) const

Definition at line 42 of file fileinputsettings.cpp.

References SimpleSerializer::final(), m_accelerationFactor, m_fileName, m_loop, m_reverseAPIAddress, m_reverseAPIDeviceIndex, m_reverseAPIPort, m_useReverseAPI, SimpleSerializer::writeBool(), SimpleSerializer::writeString(), and SimpleSerializer::writeU32().

Referenced by FileInputGUI::serialize(), FileInput::serialize(), and ~FileInputSettings().

43 {
44  SimpleSerializer s(1);
45  s.writeString(1, m_fileName);
46  s.writeU32(2, m_accelerationFactor);
47  s.writeBool(3, m_loop);
48  s.writeBool(4, m_useReverseAPI);
49  s.writeString(5, m_reverseAPIAddress);
50  s.writeU32(6, m_reverseAPIPort);
51  s.writeU32(7, m_reverseAPIDeviceIndex);
52 
53  return s.final();
54 }
uint16_t m_reverseAPIDeviceIndex
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_accelerationFactor

quint32 FileInputSettings::m_accelerationFactor

◆ m_accelerationMaxScale

const unsigned int FileInputSettings::m_accelerationMaxScale = 2
static

Max power of 10 multiplier to 2,5,10 base ex: 2 -> 2,5,10,20,50,100,200,500,1000.

Definition at line 35 of file fileinputsettings.h.

Referenced by getAccelerationIndex(), getAccelerationValue(), and FileInputGUI::setAccelerationCombo().

◆ m_centerFrequency

quint64 FileInputSettings::m_centerFrequency

◆ m_fileName

QString FileInputSettings::m_fileName

◆ m_loop

bool FileInputSettings::m_loop

◆ m_reverseAPIAddress

QString FileInputSettings::m_reverseAPIAddress

◆ m_reverseAPIDeviceIndex

uint16_t FileInputSettings::m_reverseAPIDeviceIndex

◆ m_reverseAPIPort

uint16_t FileInputSettings::m_reverseAPIPort

◆ m_sampleRate

qint32 FileInputSettings::m_sampleRate

Definition at line 26 of file fileinputsettings.h.

Referenced by FileInput::init(), and resetToDefaults().

◆ m_useReverseAPI

bool FileInputSettings::m_useReverseAPI

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