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 Types | Public Member Functions | Public Attributes | List of all members
UDPSourceSettings Struct Reference

#include <udpsourcesettings.h>

+ Collaboration diagram for UDPSourceSettings:

Public Types

enum  SampleFormat {
  FormatSnLE, FormatNFM, FormatLSB, FormatUSB,
  FormatAM, FormatNone
}
 

Public Member Functions

 UDPSourceSettings ()
 
void resetToDefaults ()
 
void setChannelMarker (Serializable *channelMarker)
 
void setSpectrumGUI (Serializable *spectrumGUI)
 
QByteArray serialize () const
 
bool deserialize (const QByteArray &data)
 

Public Attributes

SampleFormat m_sampleFormat
 
Real m_inputSampleRate
 
qint64 m_inputFrequencyOffset
 
Real m_rfBandwidth
 
Real m_lowCutoff
 
int m_fmDeviation
 
Real m_amModFactor
 
bool m_channelMute
 
Real m_gainIn
 
Real m_gainOut
 
Real m_squelch
 squared magnitude More...
 
Real m_squelchGate
 seconds More...
 
bool m_squelchEnabled
 
bool m_autoRWBalance
 
bool m_stereoInput
 
quint32 m_rgbColor
 
QString m_udpAddress
 
uint16_t m_udpPort
 
QString m_title
 
bool m_useReverseAPI
 
QString m_reverseAPIAddress
 
uint16_t m_reverseAPIPort
 
uint16_t m_reverseAPIDeviceIndex
 
uint16_t m_reverseAPIChannelIndex
 
Serializablem_channelMarker
 
Serializablem_spectrumGUI
 

Detailed Description

Definition at line 29 of file udpsourcesettings.h.

Member Enumeration Documentation

◆ SampleFormat

Constructor & Destructor Documentation

◆ UDPSourceSettings()

UDPSourceSettings::UDPSourceSettings ( )

Definition at line 26 of file udpsourcesettings.cpp.

References resetToDefaults().

26  :
27  m_channelMarker(0),
28  m_spectrumGUI(0)
29 {
31 }
Serializable * m_spectrumGUI
Serializable * m_channelMarker
+ Here is the call graph for this function:

Member Function Documentation

◆ deserialize()

bool UDPSourceSettings::deserialize ( const QByteArray &  data)

Definition at line 97 of file udpsourcesettings.cpp.

References Serializable::deserialize(), FormatNone, SimpleDeserializer::getVersion(), SimpleDeserializer::isValid(), m_amModFactor, m_autoRWBalance, m_channelMarker, m_fmDeviation, m_gainIn, m_gainOut, m_inputFrequencyOffset, m_inputSampleRate, m_reverseAPIAddress, m_reverseAPIChannelIndex, m_reverseAPIDeviceIndex, m_reverseAPIPort, m_rfBandwidth, m_sampleFormat, m_spectrumGUI, m_squelch, m_squelchEnabled, m_squelchGate, m_stereoInput, m_title, m_udpAddress, m_udpPort, m_useReverseAPI, SimpleDeserializer::readBlob(), SimpleDeserializer::readBool(), SimpleDeserializer::readReal(), SimpleDeserializer::readS32(), SimpleDeserializer::readString(), SimpleDeserializer::readU32(), and resetToDefaults().

Referenced by UDPSourceGUI::deserialize(), UDPSource::deserialize(), and setSpectrumGUI().

98 {
99  SimpleDeserializer d(data);
100 
101  if (!d.isValid())
102  {
103  resetToDefaults();
104  return false;
105  }
106 
107  if (d.getVersion() == 1)
108  {
109  QByteArray bytetmp;
110  QString strtmp;
111  qint32 s32tmp;
112  quint32 u32tmp;
113 
114  if (m_channelMarker)
115  {
116  d.readBlob(6, &bytetmp);
117  m_channelMarker->deserialize(bytetmp);
118  }
119 
120  d.readS32(2, &s32tmp, 0);
121  m_inputFrequencyOffset = s32tmp;
122 
123  d.readS32(3, &s32tmp, 0);
124 
125  if (s32tmp < (int) FormatNone) {
126  m_sampleFormat = (SampleFormat) s32tmp;
127  } else {
128  m_sampleFormat = (SampleFormat) ((int) FormatNone - 1);
129  }
130 
131  d.readReal(4, &m_inputSampleRate, 48000);
132  d.readReal(5, &m_rfBandwidth, 32000);
133 
134  if (m_spectrumGUI)
135  {
136  d.readBlob(7, &bytetmp);
137  m_spectrumGUI->deserialize(bytetmp);
138  }
139 
140  d.readS32(10, &s32tmp, 10);
141  m_gainOut = s32tmp / 10.0;
142 
143  d.readS32(11, &m_fmDeviation, 2500);
144  d.readReal(12, &m_amModFactor, 0.95);
145  d.readBool(13, &m_stereoInput, false);
146 
147  d.readS32(14, &s32tmp, -60);
148  m_squelch = s32tmp * 1.0;
149  m_squelchEnabled = (s32tmp != -100);
150 
151  d.readS32(15, &s32tmp, 5);
152  m_squelchGate = s32tmp / 100.0;
153 
154  d.readBool(16, &m_autoRWBalance, true);
155 
156  d.readS32(17, &s32tmp, 10);
157  m_gainIn = s32tmp / 10.0;
158 
159  d.readString(18, &m_udpAddress, "127.0.0.1");
160  d.readU32(19, &u32tmp, 9998);
161 
162  if ((u32tmp > 1024) & (u32tmp < 65538)) {
163  m_udpPort = u32tmp;
164  } else {
165  m_udpPort = 9998;
166  }
167 
168  d.readString(20, &m_title, "UDP Sample Sink");
169 
170  d.readBool(21, &m_useReverseAPI, false);
171  d.readString(22, &m_reverseAPIAddress, "127.0.0.1");
172  d.readU32(23, &u32tmp, 0);
173 
174  if ((u32tmp > 1023) && (u32tmp < 65535)) {
175  m_reverseAPIPort = u32tmp;
176  } else {
177  m_reverseAPIPort = 8888;
178  }
179 
180  d.readU32(24, &u32tmp, 0);
181  m_reverseAPIDeviceIndex = u32tmp > 99 ? 99 : u32tmp;
182  d.readU32(25, &u32tmp, 0);
183  m_reverseAPIChannelIndex = u32tmp > 99 ? 99 : u32tmp;
184 
185  return true;
186  }
187  else
188  {
189  resetToDefaults();
190  return false;
191  }
192 }
Real m_squelch
squared magnitude
virtual bool deserialize(const QByteArray &data)=0
uint16_t m_reverseAPIDeviceIndex
uint16_t m_reverseAPIChannelIndex
Real m_squelchGate
seconds
SampleFormat m_sampleFormat
Serializable * m_spectrumGUI
Serializable * m_channelMarker
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetToDefaults()

void UDPSourceSettings::resetToDefaults ( )

Definition at line 33 of file udpsourcesettings.cpp.

References FormatSnLE, m_amModFactor, m_autoRWBalance, m_channelMute, m_fmDeviation, m_gainIn, m_gainOut, m_inputFrequencyOffset, m_inputSampleRate, m_lowCutoff, m_reverseAPIAddress, m_reverseAPIChannelIndex, m_reverseAPIDeviceIndex, m_reverseAPIPort, m_rfBandwidth, m_rgbColor, m_sampleFormat, m_squelch, m_squelchEnabled, m_squelchGate, m_stereoInput, m_title, m_udpAddress, m_udpPort, and m_useReverseAPI.

Referenced by deserialize(), UDPSource::deserialize(), UDPSourceGUI::resetToDefaults(), and UDPSourceSettings().

34 {
36  m_inputSampleRate = 48000;
38  m_rfBandwidth = 12500;
39  m_lowCutoff = 0.0f;
40  m_fmDeviation = 2500;
41  m_amModFactor = 0.95;
42  m_channelMute = false;
43  m_gainIn = 1.0;
44  m_gainOut = 1.0;
45  m_squelch = -60.0;
46  m_squelchGate = 0.05;
47  m_autoRWBalance = true;
48  m_stereoInput = false;
49  m_squelchEnabled = true;
50  m_udpAddress = "127.0.0.1";
51  m_udpPort = 9998;
52  m_rgbColor = QColor(225, 25, 99).rgb();
53  m_title = "UDP Sample Source";
54  m_useReverseAPI = false;
55  m_reverseAPIAddress = "127.0.0.1";
56  m_reverseAPIPort = 8888;
59 }
Real m_squelch
squared magnitude
uint16_t m_reverseAPIDeviceIndex
uint16_t m_reverseAPIChannelIndex
Real m_squelchGate
seconds
SampleFormat m_sampleFormat
+ Here is the caller graph for this function:

◆ serialize()

QByteArray UDPSourceSettings::serialize ( ) const

Definition at line 61 of file udpsourcesettings.cpp.

References SimpleSerializer::final(), m_amModFactor, m_autoRWBalance, m_channelMarker, m_fmDeviation, m_gainIn, m_gainOut, m_inputFrequencyOffset, m_inputSampleRate, m_reverseAPIAddress, m_reverseAPIChannelIndex, m_reverseAPIDeviceIndex, m_reverseAPIPort, m_rfBandwidth, m_sampleFormat, m_spectrumGUI, m_squelch, m_squelchGate, m_stereoInput, m_title, m_udpAddress, m_udpPort, m_useReverseAPI, Serializable::serialize(), SimpleSerializer::writeBlob(), SimpleSerializer::writeBool(), SimpleSerializer::writeReal(), SimpleSerializer::writeS32(), SimpleSerializer::writeString(), and SimpleSerializer::writeU32().

Referenced by UDPSourceGUI::serialize(), UDPSource::serialize(), and setSpectrumGUI().

62 {
63  SimpleSerializer s(1);
64  s.writeS32(2, m_inputFrequencyOffset);
65  s.writeS32(3, (int) m_sampleFormat);
66  s.writeReal(4, m_inputSampleRate);
67  s.writeReal(5, m_rfBandwidth);
68 
69  if (m_channelMarker) {
70  s.writeBlob(6, m_channelMarker->serialize());
71  }
72 
73  if (m_spectrumGUI) {
74  s.writeBlob(7, m_spectrumGUI->serialize());
75  }
76 
77  s.writeS32(10, roundf(m_gainOut * 10.0));
78  s.writeS32(11, m_fmDeviation);
79  s.writeReal(12, m_amModFactor);
80  s.writeBool(13, m_stereoInput);
81  s.writeS32(14, roundf(m_squelch));
82  s.writeS32(15, roundf(m_squelchGate * 100.0));
83  s.writeBool(16, m_autoRWBalance);
84  s.writeS32(17, roundf(m_gainIn * 10.0));
85  s.writeString(18, m_udpAddress);
86  s.writeU32(19, m_udpPort);
87  s.writeString(20, m_title);
88  s.writeBool(21, m_useReverseAPI);
89  s.writeString(22, m_reverseAPIAddress);
90  s.writeU32(23, m_reverseAPIPort);
91  s.writeU32(24, m_reverseAPIDeviceIndex);
92  s.writeU32(25, m_reverseAPIChannelIndex);
93 
94  return s.final();
95 }
Real m_squelch
squared magnitude
uint16_t m_reverseAPIDeviceIndex
uint16_t m_reverseAPIChannelIndex
virtual QByteArray serialize() const =0
Real m_squelchGate
seconds
SampleFormat m_sampleFormat
Serializable * m_spectrumGUI
Serializable * m_channelMarker
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setChannelMarker()

void UDPSourceSettings::setChannelMarker ( Serializable channelMarker)
inline

Definition at line 73 of file udpsourcesettings.h.

73 { m_channelMarker = channelMarker; }
Serializable * m_channelMarker

◆ setSpectrumGUI()

void UDPSourceSettings::setSpectrumGUI ( Serializable spectrumGUI)
inline

Definition at line 74 of file udpsourcesettings.h.

References deserialize(), and serialize().

74 { m_spectrumGUI = spectrumGUI; }
Serializable * m_spectrumGUI
+ Here is the call graph for this function:

Member Data Documentation

◆ m_amModFactor

Real UDPSourceSettings::m_amModFactor

◆ m_autoRWBalance

bool UDPSourceSettings::m_autoRWBalance

◆ m_channelMarker

Serializable* UDPSourceSettings::m_channelMarker

Definition at line 68 of file udpsourcesettings.h.

Referenced by deserialize(), and serialize().

◆ m_channelMute

bool UDPSourceSettings::m_channelMute

◆ m_fmDeviation

int UDPSourceSettings::m_fmDeviation

◆ m_gainIn

Real UDPSourceSettings::m_gainIn

◆ m_gainOut

Real UDPSourceSettings::m_gainOut

◆ m_inputFrequencyOffset

qint64 UDPSourceSettings::m_inputFrequencyOffset

◆ m_inputSampleRate

Real UDPSourceSettings::m_inputSampleRate

◆ m_lowCutoff

Real UDPSourceSettings::m_lowCutoff

◆ m_reverseAPIAddress

QString UDPSourceSettings::m_reverseAPIAddress

◆ m_reverseAPIChannelIndex

uint16_t UDPSourceSettings::m_reverseAPIChannelIndex

◆ m_reverseAPIDeviceIndex

uint16_t UDPSourceSettings::m_reverseAPIDeviceIndex

◆ m_reverseAPIPort

uint16_t UDPSourceSettings::m_reverseAPIPort

◆ m_rfBandwidth

Real UDPSourceSettings::m_rfBandwidth

◆ m_rgbColor

quint32 UDPSourceSettings::m_rgbColor

◆ m_sampleFormat

SampleFormat UDPSourceSettings::m_sampleFormat

◆ m_spectrumGUI

Serializable* UDPSourceSettings::m_spectrumGUI

Definition at line 69 of file udpsourcesettings.h.

Referenced by deserialize(), and serialize().

◆ m_squelch

Real UDPSourceSettings::m_squelch

◆ m_squelchEnabled

bool UDPSourceSettings::m_squelchEnabled

◆ m_squelchGate

Real UDPSourceSettings::m_squelchGate

◆ m_stereoInput

bool UDPSourceSettings::m_stereoInput

◆ m_title

QString UDPSourceSettings::m_title

◆ m_udpAddress

QString UDPSourceSettings::m_udpAddress

◆ m_udpPort

uint16_t UDPSourceSettings::m_udpPort

◆ m_useReverseAPI

bool UDPSourceSettings::m_useReverseAPI

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