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
BFMDemodSettings Struct Reference

#include <bfmdemodsettings.h>

+ Collaboration diagram for BFMDemodSettings:

Public Member Functions

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

Static Public Member Functions

static int getRFBW (int index)
 
static int getRFBWIndex (int rfbw)
 

Public Attributes

qint64 m_inputFrequencyOffset
 
Real m_rfBandwidth
 
Real m_afBandwidth
 
Real m_volume
 
Real m_squelch
 
bool m_audioStereo
 
bool m_lsbStereo
 
bool m_showPilot
 
bool m_rdsActive
 
quint32 m_rgbColor
 
QString m_title
 
QString m_audioDeviceName
 
bool m_useReverseAPI
 
QString m_reverseAPIAddress
 
uint16_t m_reverseAPIPort
 
uint16_t m_reverseAPIDeviceIndex
 
uint16_t m_reverseAPIChannelIndex
 
Serializablem_channelMarker
 
Serializablem_spectrumGUI
 

Static Public Attributes

static const int m_nbRFBW = 9
 
static const int m_rfBW []
 

Detailed Description

Definition at line 25 of file bfmdemodsettings.h.

Constructor & Destructor Documentation

◆ BFMDemodSettings()

BFMDemodSettings::BFMDemodSettings ( )

Definition at line 31 of file bfmdemodsettings.cpp.

References resetToDefaults().

31  :
32  m_channelMarker(0),
33  m_spectrumGUI(0)
34 {
36 }
Serializable * m_channelMarker
Serializable * m_spectrumGUI
+ Here is the call graph for this function:

Member Function Documentation

◆ deserialize()

bool BFMDemodSettings::deserialize ( const QByteArray &  data)

Definition at line 91 of file bfmdemodsettings.cpp.

References Serializable::deserialize(), getRFBW(), SimpleDeserializer::getVersion(), SimpleDeserializer::isValid(), m_afBandwidth, m_audioDeviceName, m_audioStereo, m_channelMarker, AudioDeviceManager::m_defaultDeviceName, m_inputFrequencyOffset, m_lsbStereo, m_reverseAPIAddress, m_reverseAPIChannelIndex, m_reverseAPIDeviceIndex, m_reverseAPIPort, m_rfBandwidth, m_rgbColor, m_spectrumGUI, m_squelch, m_title, m_useReverseAPI, m_volume, SimpleDeserializer::readBlob(), SimpleDeserializer::readBool(), SimpleDeserializer::readS32(), SimpleDeserializer::readString(), SimpleDeserializer::readU32(), and resetToDefaults().

Referenced by BFMDemodGUI::deserialize(), BFMDemod::deserialize(), and setSpectrumGUI().

92 {
93  SimpleDeserializer d(data);
94 
95  if(!d.isValid())
96  {
98  return false;
99  }
100 
101  if(d.getVersion() == 1)
102  {
103  QByteArray bytetmp;
104  qint32 tmp;
105  uint32_t utmp;
106  QString strtmp;
107 
108  d.readS32(1, &tmp, 0);
110  d.readS32(2, &tmp, 4);
111  m_rfBandwidth = getRFBW(tmp);
112  d.readS32(3, &tmp, 3);
113  m_afBandwidth = tmp * 1000.0;
114  d.readS32(4, &tmp, 20);
115  m_volume = tmp * 0.1;
116  d.readS32(5, &tmp, -60);
117  m_squelch = tmp;
118  d.readU32(7, &m_rgbColor);
119 
120  d.readBlob(8, &bytetmp);
121 
122  if (m_spectrumGUI) {
123  m_spectrumGUI->deserialize(bytetmp);
124  }
125 
126  d.readBool(9, &m_audioStereo, false);
127  d.readBool(10, &m_lsbStereo, false);
128 
129  d.readBlob(11, &bytetmp);
130 
131  if (m_channelMarker) {
132  m_channelMarker->deserialize(bytetmp);
133  }
134 
135  d.readString(12, &m_title, "Broadcast FM Demod");
137  d.readBool(14, &m_useReverseAPI, false);
138  d.readString(15, &m_reverseAPIAddress, "127.0.0.1");
139  d.readU32(16, &utmp, 0);
140 
141  if ((utmp > 1023) && (utmp < 65535)) {
142  m_reverseAPIPort = utmp;
143  } else {
144  m_reverseAPIPort = 8888;
145  }
146 
147  d.readU32(17, &utmp, 0);
148  m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp;
149  d.readU32(18, &utmp, 0);
150  m_reverseAPIChannelIndex = utmp > 99 ? 99 : utmp;
151 
152  return true;
153  }
154  else
155  {
156  resetToDefaults();
157  return false;
158  }
159 }
static const QString m_defaultDeviceName
QString m_reverseAPIAddress
uint16_t m_reverseAPIChannelIndex
qint64 m_inputFrequencyOffset
Serializable * m_channelMarker
uint16_t m_reverseAPIDeviceIndex
unsigned int uint32_t
Definition: rtptypes_win.h:46
static int getRFBW(int index)
uint16_t m_reverseAPIPort
virtual bool deserialize(const QByteArray &data)=0
Serializable * m_spectrumGUI
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRFBW()

int BFMDemodSettings::getRFBW ( int  index)
static

Definition at line 161 of file bfmdemodsettings.cpp.

References m_nbRFBW, and m_rfBW.

Referenced by deserialize(), BFMDemodGUI::on_rfBW_valueChanged(), resetToDefaults(), and setSpectrumGUI().

162 {
163  if (index < 0) {
164  return m_rfBW[0];
165  } else if (index < m_nbRFBW) {
166  return m_rfBW[index];
167  } else {
168  return m_rfBW[m_nbRFBW-1];
169  }
170 }
static const int m_nbRFBW
static const int m_rfBW[]
+ Here is the caller graph for this function:

◆ getRFBWIndex()

int BFMDemodSettings::getRFBWIndex ( int  rfbw)
static

Definition at line 172 of file bfmdemodsettings.cpp.

References i, m_nbRFBW, and m_rfBW.

Referenced by BFMDemodGUI::displaySettings(), serialize(), and setSpectrumGUI().

173 {
174  for (int i = 0; i < m_nbRFBW; i++)
175  {
176  if (rfbw <= m_rfBW[i])
177  {
178  return i;
179  }
180  }
181 
182  return m_nbRFBW-1;
183 }
static const int m_nbRFBW
int32_t i
Definition: decimators.h:244
static const int m_rfBW[]
+ Here is the caller graph for this function:

◆ resetToDefaults()

void BFMDemodSettings::resetToDefaults ( )

Definition at line 38 of file bfmdemodsettings.cpp.

References getRFBW(), m_afBandwidth, m_audioDeviceName, m_audioStereo, AudioDeviceManager::m_defaultDeviceName, m_inputFrequencyOffset, m_lsbStereo, m_rdsActive, m_reverseAPIAddress, m_reverseAPIChannelIndex, m_reverseAPIDeviceIndex, m_reverseAPIPort, m_rfBandwidth, m_rgbColor, m_showPilot, m_squelch, m_title, m_useReverseAPI, and m_volume.

Referenced by BFMDemodSettings(), deserialize(), BFMDemod::deserialize(), and BFMDemodGUI::resetToDefaults().

39 {
42  m_afBandwidth = 15000;
43  m_volume = 2.0;
44  m_squelch = -60.0;
45  m_audioStereo = false;
46  m_lsbStereo = false;
47  m_showPilot = false;
48  m_rdsActive = false;
49  m_rgbColor = QColor(80, 120, 228).rgb();
50  m_title = "Broadcast FM Demod";
52  m_useReverseAPI = false;
53  m_reverseAPIAddress = "127.0.0.1";
54  m_reverseAPIPort = 8888;
57 }
static const QString m_defaultDeviceName
QString m_reverseAPIAddress
uint16_t m_reverseAPIChannelIndex
qint64 m_inputFrequencyOffset
uint16_t m_reverseAPIDeviceIndex
static int getRFBW(int index)
uint16_t m_reverseAPIPort
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serialize()

QByteArray BFMDemodSettings::serialize ( ) const

Definition at line 59 of file bfmdemodsettings.cpp.

References SimpleSerializer::final(), getRFBWIndex(), m_afBandwidth, m_audioDeviceName, m_audioStereo, m_channelMarker, m_inputFrequencyOffset, m_lsbStereo, m_reverseAPIAddress, m_reverseAPIChannelIndex, m_reverseAPIDeviceIndex, m_reverseAPIPort, m_rfBandwidth, m_rgbColor, m_spectrumGUI, m_squelch, m_title, m_useReverseAPI, m_volume, Serializable::serialize(), SimpleSerializer::writeBlob(), SimpleSerializer::writeBool(), SimpleSerializer::writeS32(), SimpleSerializer::writeString(), and SimpleSerializer::writeU32().

Referenced by BFMDemodGUI::serialize(), BFMDemod::serialize(), and setSpectrumGUI().

60 {
61  SimpleSerializer s(1);
62  s.writeS32(1, m_inputFrequencyOffset);
63  s.writeS32(2, getRFBWIndex(m_rfBandwidth));
64  s.writeS32(3, m_afBandwidth/1000.0);
65  s.writeS32(4, m_volume*10.0);
66  s.writeS32(5, m_squelch);
67  s.writeU32(7, m_rgbColor);
68 
69  if (m_spectrumGUI) {
70  s.writeBlob(8, m_spectrumGUI->serialize());
71  }
72 
73  s.writeBool(9, m_audioStereo);
74  s.writeBool(10, m_lsbStereo);
75 
76  if (m_channelMarker) {
77  s.writeBlob(11, m_channelMarker->serialize());
78  }
79 
80  s.writeString(12, m_title);
81  s.writeString(13, m_audioDeviceName);
82  s.writeBool(14, m_useReverseAPI);
83  s.writeString(15, m_reverseAPIAddress);
84  s.writeU32(16, m_reverseAPIPort);
85  s.writeU32(17, m_reverseAPIDeviceIndex);
86  s.writeU32(18, m_reverseAPIChannelIndex);
87 
88  return s.final();
89 }
QString m_reverseAPIAddress
uint16_t m_reverseAPIChannelIndex
qint64 m_inputFrequencyOffset
static int getRFBWIndex(int rfbw)
Serializable * m_channelMarker
uint16_t m_reverseAPIDeviceIndex
uint16_t m_reverseAPIPort
Serializable * m_spectrumGUI
virtual QByteArray serialize() const =0
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setChannelMarker()

void BFMDemodSettings::setChannelMarker ( Serializable channelMarker)
inline

Definition at line 53 of file bfmdemodsettings.h.

Referenced by BFMDemodGUI::BFMDemodGUI().

53 { m_channelMarker = channelMarker; }
Serializable * m_channelMarker
+ Here is the caller graph for this function:

◆ setSpectrumGUI()

void BFMDemodSettings::setSpectrumGUI ( Serializable spectrumGUI)
inline

Definition at line 54 of file bfmdemodsettings.h.

References deserialize(), getRFBW(), getRFBWIndex(), and serialize().

Referenced by BFMDemodGUI::BFMDemodGUI().

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

Member Data Documentation

◆ m_afBandwidth

Real BFMDemodSettings::m_afBandwidth

◆ m_audioDeviceName

QString BFMDemodSettings::m_audioDeviceName

◆ m_audioStereo

bool BFMDemodSettings::m_audioStereo

◆ m_channelMarker

Serializable* BFMDemodSettings::m_channelMarker

Definition at line 45 of file bfmdemodsettings.h.

Referenced by deserialize(), and serialize().

◆ m_inputFrequencyOffset

qint64 BFMDemodSettings::m_inputFrequencyOffset

◆ m_lsbStereo

bool BFMDemodSettings::m_lsbStereo

◆ m_nbRFBW

const int BFMDemodSettings::m_nbRFBW = 9
static

Definition at line 48 of file bfmdemodsettings.h.

Referenced by getRFBW(), and getRFBWIndex().

◆ m_rdsActive

bool BFMDemodSettings::m_rdsActive

◆ m_reverseAPIAddress

QString BFMDemodSettings::m_reverseAPIAddress

◆ m_reverseAPIChannelIndex

uint16_t BFMDemodSettings::m_reverseAPIChannelIndex

◆ m_reverseAPIDeviceIndex

uint16_t BFMDemodSettings::m_reverseAPIDeviceIndex

◆ m_reverseAPIPort

uint16_t BFMDemodSettings::m_reverseAPIPort

◆ m_rfBandwidth

Real BFMDemodSettings::m_rfBandwidth

◆ m_rfBW

const int BFMDemodSettings::m_rfBW
static
Initial value:
= {
80000, 100000, 120000, 140000, 160000, 180000, 200000, 220000, 250000
}

Definition at line 49 of file bfmdemodsettings.h.

Referenced by getRFBW(), and getRFBWIndex().

◆ m_rgbColor

quint32 BFMDemodSettings::m_rgbColor

◆ m_showPilot

bool BFMDemodSettings::m_showPilot

◆ m_spectrumGUI

Serializable* BFMDemodSettings::m_spectrumGUI

Definition at line 46 of file bfmdemodsettings.h.

Referenced by deserialize(), and serialize().

◆ m_squelch

Real BFMDemodSettings::m_squelch

◆ m_title

QString BFMDemodSettings::m_title

◆ m_useReverseAPI

bool BFMDemodSettings::m_useReverseAPI

◆ m_volume

Real BFMDemodSettings::m_volume

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