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

#include <nfmdemodsettings.h>

+ Collaboration diagram for NFMDemodSettings:

Public Member Functions

 NFMDemodSettings ()
 
void resetToDefaults ()
 
void setChannelMarker (Serializable *channelMarker)
 
QByteArray serialize () const
 
bool deserialize (const QByteArray &data)
 

Static Public Member Functions

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

Public Attributes

int32_t m_inputFrequencyOffset
 
Real m_rfBandwidth
 
Real m_afBandwidth
 
int m_fmDeviation
 
int m_squelchGate
 
bool m_deltaSquelch
 
Real m_squelch
 deci-Bels More...
 
Real m_volume
 
bool m_ctcssOn
 
bool m_audioMute
 
int m_ctcssIndex
 
quint32 m_rgbColor
 
QString m_title
 
QString m_audioDeviceName
 
bool m_highPass
 
bool m_useReverseAPI
 
QString m_reverseAPIAddress
 
uint16_t m_reverseAPIPort
 
uint16_t m_reverseAPIDeviceIndex
 
uint16_t m_reverseAPIChannelIndex
 
Serializablem_channelMarker
 

Static Public Attributes

static const int m_nbRfBW = 9
 
static const int m_rfBW []
 
static const int m_fmDev []
 

Detailed Description

Definition at line 25 of file nfmdemodsettings.h.

Constructor & Destructor Documentation

◆ NFMDemodSettings()

NFMDemodSettings::NFMDemodSettings ( )

Definition at line 34 of file nfmdemodsettings.cpp.

References resetToDefaults().

34  :
36 {
38 }
Serializable * m_channelMarker
+ Here is the call graph for this function:

Member Function Documentation

◆ deserialize()

bool NFMDemodSettings::deserialize ( const QByteArray &  data)

Definition at line 95 of file nfmdemodsettings.cpp.

References Serializable::deserialize(), getFMDev(), getRFBW(), SimpleDeserializer::getVersion(), SimpleDeserializer::isValid(), m_afBandwidth, m_audioDeviceName, m_audioMute, m_channelMarker, m_ctcssIndex, m_ctcssOn, AudioDeviceManager::m_defaultDeviceName, m_deltaSquelch, m_fmDeviation, m_highPass, m_inputFrequencyOffset, m_reverseAPIAddress, m_reverseAPIChannelIndex, m_reverseAPIDeviceIndex, m_reverseAPIPort, m_rfBandwidth, m_rgbColor, m_squelch, m_squelchGate, m_title, m_useReverseAPI, m_volume, SimpleDeserializer::readBlob(), SimpleDeserializer::readBool(), SimpleDeserializer::readS32(), SimpleDeserializer::readString(), SimpleDeserializer::readU32(), and resetToDefaults().

Referenced by NFMDemodGUI::deserialize(), NFMDemod::deserialize(), and setChannelMarker().

96 {
97  SimpleDeserializer d(data);
98 
99  if (!d.isValid())
100  {
101  resetToDefaults();
102  return false;
103  }
104 
105  if (d.getVersion() == 1)
106  {
107  QByteArray bytetmp;
108  qint32 tmp;
109  uint32_t utmp;
110 
111  if (m_channelMarker)
112  {
113  d.readBlob(13, &bytetmp);
114  m_channelMarker->deserialize(bytetmp);
115  }
116 
117  d.readS32(1, &tmp, 0);
119  d.readS32(2, &tmp, 4);
120  m_rfBandwidth = getRFBW(tmp);
121  m_fmDeviation = getFMDev(tmp);
122  d.readS32(3, &tmp, 3);
123  m_afBandwidth = tmp * 1000.0;
124  d.readS32(4, &tmp, 20);
125  m_volume = tmp / 10.0;
126  d.readS32(5, &tmp, -30);
127  m_squelch = (tmp < -100 ? tmp/10 : tmp) * 1.0;
128  d.readBool(6, &m_highPass, true);
129  d.readU32(7, &m_rgbColor, QColor(255, 0, 0).rgb());
130  d.readS32(8, &m_ctcssIndex, 0);
131  d.readBool(9, &m_ctcssOn, false);
132  d.readBool(10, &m_audioMute, false);
133  d.readS32(11, &m_squelchGate, 5);
134  d.readBool(12, &m_deltaSquelch, false);
135  d.readString(14, &m_title, "NFM Demodulator");
137  d.readBool(16, &m_useReverseAPI, false);
138  d.readString(17, &m_reverseAPIAddress, "127.0.0.1");
139  d.readU32(18, &utmp, 0);
140 
141  if ((utmp > 1023) && (utmp < 65535)) {
142  m_reverseAPIPort = utmp;
143  } else {
144  m_reverseAPIPort = 8888;
145  }
146 
147  d.readU32(19, &utmp, 0);
148  m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp;
149  d.readU32(20, &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
uint16_t m_reverseAPIPort
static int getFMDev(int index)
static int getRFBW(int index)
Real m_squelch
deci-Bels
unsigned int uint32_t
Definition: rtptypes_win.h:46
QString m_reverseAPIAddress
uint16_t m_reverseAPIChannelIndex
Serializable * m_channelMarker
virtual bool deserialize(const QByteArray &data)=0
uint16_t m_reverseAPIDeviceIndex
int32_t m_inputFrequencyOffset
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFMDev()

int NFMDemodSettings::getFMDev ( int  index)
static

Definition at line 172 of file nfmdemodsettings.cpp.

References m_fmDev, and m_nbRfBW.

Referenced by deserialize(), NFMDemodGUI::on_rfBW_currentIndexChanged(), and setChannelMarker().

173 {
174  if (index < 0) {
175  return m_fmDev[0];
176  } else if (index < m_nbRfBW) {
177  return m_fmDev[index];
178  } else {
179  return m_fmDev[m_nbRfBW-1];
180  }
181 }
static const int m_fmDev[]
static const int m_nbRfBW
+ Here is the caller graph for this function:

◆ getRFBW()

int NFMDemodSettings::getRFBW ( int  index)
static

Definition at line 161 of file nfmdemodsettings.cpp.

References m_nbRfBW, and m_rfBW.

Referenced by deserialize(), NFMDemodGUI::NFMDemodGUI(), NFMDemodGUI::on_rfBW_currentIndexChanged(), and setChannelMarker().

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_rfBW[]
static const int m_nbRfBW
+ Here is the caller graph for this function:

◆ getRFBWIndex()

int NFMDemodSettings::getRFBWIndex ( int  rfbw)
static

Definition at line 183 of file nfmdemodsettings.cpp.

References i, m_nbRfBW, and m_rfBW.

Referenced by NFMDemodGUI::displaySettings(), serialize(), and setChannelMarker().

184 {
185  for (int i = 0; i < m_nbRfBW; i++)
186  {
187  if (rfbw <= m_rfBW[i])
188  {
189  return i;
190  }
191  }
192 
193  return m_nbRfBW-1;
194 }
static const int m_rfBW[]
int32_t i
Definition: decimators.h:244
static const int m_nbRfBW
+ Here is the caller graph for this function:

◆ resetToDefaults()

void NFMDemodSettings::resetToDefaults ( )

Definition at line 40 of file nfmdemodsettings.cpp.

References m_afBandwidth, m_audioDeviceName, m_audioMute, m_ctcssIndex, m_ctcssOn, AudioDeviceManager::m_defaultDeviceName, m_deltaSquelch, m_fmDeviation, m_highPass, m_inputFrequencyOffset, m_reverseAPIAddress, m_reverseAPIChannelIndex, m_reverseAPIDeviceIndex, m_reverseAPIPort, m_rfBandwidth, m_rgbColor, m_squelch, m_squelchGate, m_title, m_useReverseAPI, and m_volume.

Referenced by deserialize(), NFMDemod::deserialize(), NFMDemodSettings(), and NFMDemodGUI::resetToDefaults().

41 {
43  m_rfBandwidth = 12500;
44  m_afBandwidth = 3000;
45  m_fmDeviation = 2000;
46  m_squelchGate = 5; // 10s of ms at 48000 Hz sample rate. Corresponds to 2400 for AGC attack
47  m_deltaSquelch = false;
48  m_squelch = -30.0;
49  m_volume = 1.0;
50  m_ctcssOn = false;
51  m_audioMute = false;
52  m_ctcssIndex = 0;
53  m_rgbColor = QColor(255, 0, 0).rgb();
54  m_title = "NFM Demodulator";
56  m_highPass = true;
57  m_useReverseAPI = false;
58  m_reverseAPIAddress = "127.0.0.1";
59  m_reverseAPIPort = 8888;
62 }
static const QString m_defaultDeviceName
uint16_t m_reverseAPIPort
Real m_squelch
deci-Bels
QString m_reverseAPIAddress
uint16_t m_reverseAPIChannelIndex
uint16_t m_reverseAPIDeviceIndex
int32_t m_inputFrequencyOffset
+ Here is the caller graph for this function:

◆ serialize()

QByteArray NFMDemodSettings::serialize ( ) const

Definition at line 64 of file nfmdemodsettings.cpp.

References SimpleSerializer::final(), getRFBWIndex(), m_afBandwidth, m_audioDeviceName, m_audioMute, m_channelMarker, m_ctcssIndex, m_ctcssOn, m_deltaSquelch, m_highPass, m_inputFrequencyOffset, m_reverseAPIAddress, m_reverseAPIChannelIndex, m_reverseAPIDeviceIndex, m_reverseAPIPort, m_rfBandwidth, m_rgbColor, m_squelch, m_squelchGate, m_title, m_useReverseAPI, m_volume, Serializable::serialize(), SimpleSerializer::writeBlob(), SimpleSerializer::writeBool(), SimpleSerializer::writeS32(), SimpleSerializer::writeString(), and SimpleSerializer::writeU32().

Referenced by NFMDemodGUI::serialize(), NFMDemod::serialize(), and setChannelMarker().

65 {
66  SimpleSerializer s(1);
67  s.writeS32(1, m_inputFrequencyOffset);
68  s.writeS32(2, getRFBWIndex(m_rfBandwidth));
69  s.writeS32(3, m_afBandwidth/1000.0);
70  s.writeS32(4, m_volume*10.0);
71  s.writeS32(5, static_cast<int>(m_squelch));
72  s.writeBool(6, m_highPass);
73  s.writeU32(7, m_rgbColor);
74  s.writeS32(8, m_ctcssIndex);
75  s.writeBool(9, m_ctcssOn);
76  s.writeBool(10, m_audioMute);
77  s.writeS32(11, m_squelchGate);
78  s.writeBool(12, m_deltaSquelch);
79 
80  if (m_channelMarker) {
81  s.writeBlob(13, m_channelMarker->serialize());
82  }
83 
84  s.writeString(14, m_title);
85  s.writeString(15, m_audioDeviceName);
86  s.writeBool(16, m_useReverseAPI);
87  s.writeString(17, m_reverseAPIAddress);
88  s.writeU32(18, m_reverseAPIPort);
89  s.writeU32(19, m_reverseAPIDeviceIndex);
90  s.writeU32(20, m_reverseAPIChannelIndex);
91 
92  return s.final();
93 }
uint16_t m_reverseAPIPort
Real m_squelch
deci-Bels
static int getRFBWIndex(int rfbw)
QString m_reverseAPIAddress
uint16_t m_reverseAPIChannelIndex
Serializable * m_channelMarker
uint16_t m_reverseAPIDeviceIndex
virtual QByteArray serialize() const =0
int32_t m_inputFrequencyOffset
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setChannelMarker()

void NFMDemodSettings::setChannelMarker ( Serializable channelMarker)
inline

Definition at line 56 of file nfmdemodsettings.h.

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

Referenced by NFMDemodGUI::NFMDemodGUI().

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

Member Data Documentation

◆ m_afBandwidth

Real NFMDemodSettings::m_afBandwidth

◆ m_audioDeviceName

QString NFMDemodSettings::m_audioDeviceName

◆ m_audioMute

bool NFMDemodSettings::m_audioMute

◆ m_channelMarker

Serializable* NFMDemodSettings::m_channelMarker

Definition at line 52 of file nfmdemodsettings.h.

Referenced by deserialize(), and serialize().

◆ m_ctcssIndex

int NFMDemodSettings::m_ctcssIndex

◆ m_ctcssOn

bool NFMDemodSettings::m_ctcssOn

◆ m_deltaSquelch

bool NFMDemodSettings::m_deltaSquelch

◆ m_fmDev

const int NFMDemodSettings::m_fmDev
static
Initial value:
= {
2000, 2500, 3330, 4000, 5000, 6000, 8000, 10000, 16000
}

Definition at line 29 of file nfmdemodsettings.h.

Referenced by getFMDev().

◆ m_fmDeviation

int NFMDemodSettings::m_fmDeviation

◆ m_highPass

bool NFMDemodSettings::m_highPass

◆ m_inputFrequencyOffset

int32_t NFMDemodSettings::m_inputFrequencyOffset

◆ m_nbRfBW

const int NFMDemodSettings::m_nbRfBW = 9
static

Definition at line 27 of file nfmdemodsettings.h.

Referenced by getFMDev(), getRFBW(), getRFBWIndex(), and NFMDemodGUI::NFMDemodGUI().

◆ m_reverseAPIAddress

QString NFMDemodSettings::m_reverseAPIAddress

◆ m_reverseAPIChannelIndex

uint16_t NFMDemodSettings::m_reverseAPIChannelIndex

◆ m_reverseAPIDeviceIndex

uint16_t NFMDemodSettings::m_reverseAPIDeviceIndex

◆ m_reverseAPIPort

uint16_t NFMDemodSettings::m_reverseAPIPort

◆ m_rfBandwidth

Real NFMDemodSettings::m_rfBandwidth

◆ m_rfBW

const int NFMDemodSettings::m_rfBW
static
Initial value:
= {
5000, 6250, 8330, 10000, 12500, 15000, 20000, 25000, 40000
}

Definition at line 28 of file nfmdemodsettings.h.

Referenced by getRFBW(), and getRFBWIndex().

◆ m_rgbColor

quint32 NFMDemodSettings::m_rgbColor

◆ m_squelch

Real NFMDemodSettings::m_squelch

◆ m_squelchGate

int NFMDemodSettings::m_squelchGate

◆ m_title

QString NFMDemodSettings::m_title

◆ m_useReverseAPI

bool NFMDemodSettings::m_useReverseAPI

◆ m_volume

Real NFMDemodSettings::m_volume

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