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 | Private Slots | Private Member Functions | Private Attributes | List of all members
LoRaDemodGUI Class Reference

#include <lorademodgui.h>

+ Inheritance diagram for LoRaDemodGUI:
+ Collaboration diagram for LoRaDemodGUI:

Public Member Functions

virtual void destroy ()
 
void setName (const QString &name)
 
QString getName () const
 
virtual qint64 getCenterFrequency () const
 
virtual void setCenterFrequency (qint64 centerFrequency)
 
void resetToDefaults ()
 
QByteArray serialize () const
 
bool deserialize (const QByteArray &data)
 
virtual MessageQueuegetInputMessageQueue ()
 
virtual bool handleMessage (const Message &message)
 
- Public Member Functions inherited from RollupWidget
 RollupWidget (QWidget *parent=NULL)
 
void setTitleColor (const QColor &c)
 
void setHighlighted (bool highlighted)
 
- Public Member Functions inherited from PluginInstanceGUI
 PluginInstanceGUI ()
 
virtual ~PluginInstanceGUI ()
 

Static Public Member Functions

static LoRaDemodGUIcreate (PluginAPI *pluginAPI, DeviceUISet *deviceAPI, BasebandSampleSink *rxChannel)
 

Private Slots

void viewChanged ()
 
void on_BW_valueChanged (int value)
 
void on_Spread_valueChanged (int value)
 
void onWidgetRolled (QWidget *widget, bool rollDown)
 

Private Member Functions

 LoRaDemodGUI (PluginAPI *pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget *parent=0)
 
virtual ~LoRaDemodGUI ()
 
void blockApplySettings (bool block)
 
void applySettings (bool force=false)
 
void displaySettings ()
 

Private Attributes

Ui::LoRaDemodGUI * ui
 
PluginAPIm_pluginAPI
 
DeviceUISetm_deviceUISet
 
ChannelMarker m_channelMarker
 
LoRaDemodSettings m_settings
 
bool m_doApplySettings
 
LoRaDemodm_LoRaDemod
 
SpectrumVism_spectrumVis
 
MessageQueue m_inputMessageQueue
 

Additional Inherited Members

- Signals inherited from RollupWidget
void widgetRolled (QWidget *widget, bool rollDown)
 
- Protected Types inherited from RollupWidget
enum  { VersionMarker = 0xff }
 
enum  ContextMenuType { ContextMenuNone, ContextMenuChannelSettings, ContextMenuStreamSettings }
 
- Protected Member Functions inherited from RollupWidget
int arrangeRollups ()
 
QByteArray saveState (int version=0) const
 
bool restoreState (const QByteArray &state, int version=0)
 
void paintEvent (QPaintEvent *)
 
int paintRollup (QWidget *rollup, int pos, QPainter *p, bool last, const QColor &frame)
 
void resizeEvent (QResizeEvent *size)
 
void mousePressEvent (QMouseEvent *event)
 
bool event (QEvent *event)
 
bool eventFilter (QObject *object, QEvent *event)
 
void resetContextMenuType ()
 
void setStreamIndicator (const QString &indicator)
 
- Protected Attributes inherited from RollupWidget
QColor m_titleColor
 
QColor m_titleTextColor
 
bool m_highlighted
 
ContextMenuType m_contextMenuType
 
QString m_streamIndicator
 

Detailed Description

Definition at line 21 of file lorademodgui.h.

Constructor & Destructor Documentation

◆ LoRaDemodGUI()

LoRaDemodGUI::LoRaDemodGUI ( PluginAPI pluginAPI,
DeviceUISet deviceUISet,
BasebandSampleSink rxChannel,
QWidget *  parent = 0 
)
explicitprivate

Definition at line 111 of file lorademodgui.cpp.

References DeviceUISet::addChannelMarker(), DeviceUISet::addRollupWidget(), applySettings(), displaySettings(), BasebandSampleSink::getInputMessageQueue(), LoRaDemod::m_channelIdURI, m_channelMarker, m_deviceUISet, m_LoRaDemod, m_settings, m_spectrumVis, onWidgetRolled(), DeviceUISet::registerRxChannelInstance(), SDR_RX_SCALEF, LoRaDemodSettings::setChannelMarker(), ChannelMarker::setMovable(), LoRaDemodSettings::setSpectrumGUI(), LoRaDemod::setSpectrumSink(), ChannelMarker::setVisible(), ui, viewChanged(), and RollupWidget::widgetRolled().

Referenced by create().

111  :
112  RollupWidget(parent),
113  ui(new Ui::LoRaDemodGUI),
114  m_pluginAPI(pluginAPI),
115  m_deviceUISet(deviceUISet),
116  m_channelMarker(this),
117  m_doApplySettings(true)
118 {
119  ui->setupUi(this);
120  setAttribute(Qt::WA_DeleteOnClose, true);
121  connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
122 
123  m_spectrumVis = new SpectrumVis(SDR_RX_SCALEF, ui->glSpectrum);
124  m_LoRaDemod = (LoRaDemod*) rxChannel; //new LoRaDemod(m_deviceUISet->m_deviceSourceAPI);
126 
127  ui->glSpectrum->setCenterFrequency(16000);
128  ui->glSpectrum->setSampleRate(32000);
129  ui->glSpectrum->setDisplayWaterfall(true);
130  ui->glSpectrum->setDisplayMaxHold(true);
131 
134 
135  connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(viewChanged()));
136 
140 
141  ui->spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, ui->glSpectrum);
142 
144  m_settings.setSpectrumGUI(ui->spectrumGUI);
145 
146  displaySettings();
147  applySettings(true);
148 }
DeviceUISet * m_deviceUISet
Definition: lorademodgui.h:48
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
LoRaDemod * m_LoRaDemod
Definition: lorademodgui.h:53
void applySettings(bool force=false)
void addChannelMarker(ChannelMarker *channelMarker)
Add channel marker to spectrum.
Definition: deviceuiset.cpp:72
void setSpectrumGUI(Serializable *spectrumGUI)
#define SDR_RX_SCALEF
Definition: dsptypes.h:33
bool m_doApplySettings
Definition: lorademodgui.h:51
void setChannelMarker(Serializable *channelMarker)
RollupWidget(QWidget *parent=NULL)
Definition: rollupwidget.cpp:7
void viewChanged()
LoRaDemodSettings m_settings
Definition: lorademodgui.h:50
void setMovable(bool movable)
Definition: channelmarker.h:66
void onWidgetRolled(QWidget *widget, bool rollDown)
void registerRxChannelInstance(const QString &channelName, PluginInstanceGUI *pluginGUI)
Definition: deviceuiset.cpp:82
void addRollupWidget(QWidget *widget)
Add rollup widget to channel window.
Definition: deviceuiset.cpp:77
ChannelMarker m_channelMarker
Definition: lorademodgui.h:49
void setSpectrumSink(BasebandSampleSink *sampleSink)
Definition: lorademod.h:95
Ui::LoRaDemodGUI * ui
Definition: lorademodgui.h:46
static const QString m_channelIdURI
Definition: lorademod.h:119
void setVisible(bool visible)
void widgetRolled(QWidget *widget, bool rollDown)
SpectrumVis * m_spectrumVis
Definition: lorademodgui.h:54
void displaySettings()
PluginAPI * m_pluginAPI
Definition: lorademodgui.h:47
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~LoRaDemodGUI()

LoRaDemodGUI::~LoRaDemodGUI ( )
privatevirtual

Definition at line 150 of file lorademodgui.cpp.

References m_deviceUISet, m_LoRaDemod, m_spectrumVis, DeviceUISet::removeRxChannelInstance(), and ui.

151 {
153  delete m_LoRaDemod; // TODO: check this: when the GUI closes it has to delete the demodulator
154  delete m_spectrumVis;
155  delete ui;
156 }
DeviceUISet * m_deviceUISet
Definition: lorademodgui.h:48
LoRaDemod * m_LoRaDemod
Definition: lorademodgui.h:53
void removeRxChannelInstance(PluginInstanceGUI *pluginGUI)
Definition: deviceuiset.cpp:94
Ui::LoRaDemodGUI * ui
Definition: lorademodgui.h:46
SpectrumVis * m_spectrumVis
Definition: lorademodgui.h:54
+ Here is the call graph for this function:

Member Function Documentation

◆ applySettings()

void LoRaDemodGUI::applySettings ( bool  force = false)
private

Definition at line 163 of file lorademodgui.cpp.

References LoRaDemodSettings::bandwidths, LoRaDemod::MsgConfigureLoRaDemod::create(), LoRaDemod::MsgConfigureChannelizer::create(), ChannelMarker::getCenterFrequency(), ChannelMarker::getColor(), BasebandSampleSink::getInputMessageQueue(), LoRaDemodSettings::m_bandwidthIndex, m_channelMarker, m_doApplySettings, m_LoRaDemod, m_settings, MessageQueue::push(), and RollupWidget::setTitleColor().

Referenced by deserialize(), LoRaDemodGUI(), on_BW_valueChanged(), resetToDefaults(), setCenterFrequency(), and viewChanged().

164 {
165  if (m_doApplySettings)
166  {
168 
172  m_LoRaDemod->getInputMessageQueue()->push(channelConfigMsg);
173 
176  }
177 }
int getCenterFrequency() const
Definition: channelmarker.h:42
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
LoRaDemod * m_LoRaDemod
Definition: lorademodgui.h:53
static const int bandwidths[]
static MsgConfigureLoRaDemod * create(const LoRaDemodSettings &settings, bool force)
Definition: lorademod.h:53
bool m_doApplySettings
Definition: lorademodgui.h:51
LoRaDemodSettings m_settings
Definition: lorademodgui.h:50
void setTitleColor(const QColor &c)
static MsgConfigureChannelizer * create(int sampleRate, int centerFrequency)
Definition: lorademod.h:76
ChannelMarker m_channelMarker
Definition: lorademodgui.h:49
const QColor & getColor() const
Definition: channelmarker.h:64
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ blockApplySettings()

void LoRaDemodGUI::blockApplySettings ( bool  block)
private

Definition at line 158 of file lorademodgui.cpp.

References m_doApplySettings.

Referenced by displaySettings().

159 {
160  m_doApplySettings = !block;
161 }
bool m_doApplySettings
Definition: lorademodgui.h:51
+ Here is the caller graph for this function:

◆ create()

LoRaDemodGUI * LoRaDemodGUI::create ( PluginAPI pluginAPI,
DeviceUISet deviceAPI,
BasebandSampleSink rxChannel 
)
static

Definition at line 17 of file lorademodgui.cpp.

References LoRaDemodGUI().

Referenced by LoRaPlugin::createRxChannelGUI().

18 {
19  LoRaDemodGUI* gui = new LoRaDemodGUI(pluginAPI, deviceUISet, rxChannel);
20  return gui;
21 }
LoRaDemodGUI(PluginAPI *pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget *parent=0)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deserialize()

bool LoRaDemodGUI::deserialize ( const QByteArray &  data)
virtual

Implements PluginInstanceGUI.

Definition at line 60 of file lorademodgui.cpp.

References applySettings(), LoRaDemodSettings::deserialize(), displaySettings(), m_settings, and resetToDefaults().

61 {
62  if(m_settings.deserialize(data)) {
64  applySettings(true);
65  return true;
66  } else {
68  return false;
69  }
70 }
void applySettings(bool force=false)
void resetToDefaults()
bool deserialize(const QByteArray &data)
LoRaDemodSettings m_settings
Definition: lorademodgui.h:50
void displaySettings()
+ Here is the call graph for this function:

◆ destroy()

void LoRaDemodGUI::destroy ( )
virtual

Implements PluginInstanceGUI.

Definition at line 23 of file lorademodgui.cpp.

24 {
25  delete this;
26 }

◆ displaySettings()

void LoRaDemodGUI::displaySettings ( )
private

Definition at line 179 of file lorademodgui.cpp.

References arg(), LoRaDemodSettings::bandwidths, blockApplySettings(), LoRaDemodSettings::m_bandwidthIndex, m_channelMarker, LoRaDemodSettings::m_rgbColor, m_settings, ChannelMarker::setBandwidth(), ChannelMarker::setCenterFrequency(), ChannelMarker::setColor(), RollupWidget::setTitleColor(), and ui.

Referenced by deserialize(), LoRaDemodGUI(), and resetToDefaults().

180 {
182 
183  m_channelMarker.blockSignals(true);
188  m_channelMarker.blockSignals(false);
189 
190  blockApplySettings(true);
191  ui->BWText->setText(QString("%1 Hz").arg(thisBW));
192  ui->BW->setValue(m_settings.m_bandwidthIndex);
193  blockApplySettings(false);
194 }
void blockApplySettings(bool block)
static const int bandwidths[]
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
LoRaDemodSettings m_settings
Definition: lorademodgui.h:50
void setTitleColor(const QColor &c)
ChannelMarker m_channelMarker
Definition: lorademodgui.h:49
Ui::LoRaDemodGUI * ui
Definition: lorademodgui.h:46
void setColor(const QColor &color)
void setBandwidth(int bandwidth)
void setCenterFrequency(int centerFrequency)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCenterFrequency()

qint64 LoRaDemodGUI::getCenterFrequency ( ) const
virtual

Implements PluginInstanceGUI.

Definition at line 38 of file lorademodgui.cpp.

References ChannelMarker::getCenterFrequency(), and m_channelMarker.

38  {
40 }
int getCenterFrequency() const
Definition: channelmarker.h:42
ChannelMarker m_channelMarker
Definition: lorademodgui.h:49
+ Here is the call graph for this function:

◆ getInputMessageQueue()

virtual MessageQueue* LoRaDemodGUI::getInputMessageQueue ( )
inlinevirtual

Implements PluginInstanceGUI.

Definition at line 36 of file lorademodgui.h.

36 { return &m_inputMessageQueue; }
MessageQueue m_inputMessageQueue
Definition: lorademodgui.h:55

◆ getName()

QString LoRaDemodGUI::getName ( ) const
virtual

Implements PluginInstanceGUI.

Definition at line 33 of file lorademodgui.cpp.

34 {
35  return objectName();
36 }

◆ handleMessage()

bool LoRaDemodGUI::handleMessage ( const Message message)
virtual

Implements PluginInstanceGUI.

Definition at line 72 of file lorademodgui.cpp.

73 {
74  (void) message;
75  return false;
76 }

◆ on_BW_valueChanged

void LoRaDemodGUI::on_BW_valueChanged ( int  value)
privateslot

Definition at line 83 of file lorademodgui.cpp.

References applySettings(), arg(), LoRaDemodSettings::bandwidths, LoRaDemodSettings::m_bandwidthIndex, m_channelMarker, m_settings, LoRaDemodSettings::nb_bandwidths, ChannelMarker::setBandwidth(), and ui.

84 {
85  if (value < 0) {
87  } else if (value < LoRaDemodSettings::nb_bandwidths) {
89  } else {
91  }
92 
93  int thisBW = LoRaDemodSettings::bandwidths[value];
94  ui->BWText->setText(QString("%1 Hz").arg(thisBW));
96 
97  applySettings();
98 }
void applySettings(bool force=false)
static const int bandwidths[]
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
static const int nb_bandwidths
LoRaDemodSettings m_settings
Definition: lorademodgui.h:50
ChannelMarker m_channelMarker
Definition: lorademodgui.h:49
Ui::LoRaDemodGUI * ui
Definition: lorademodgui.h:46
void setBandwidth(int bandwidth)
+ Here is the call graph for this function:

◆ on_Spread_valueChanged

void LoRaDemodGUI::on_Spread_valueChanged ( int  value)
privateslot

Definition at line 100 of file lorademodgui.cpp.

101 {
102  (void) value;
103 }

◆ onWidgetRolled

void LoRaDemodGUI::onWidgetRolled ( QWidget *  widget,
bool  rollDown 
)
privateslot

Definition at line 105 of file lorademodgui.cpp.

Referenced by LoRaDemodGUI().

106 {
107  (void) widget;
108  (void) rollDown;
109 }
+ Here is the caller graph for this function:

◆ resetToDefaults()

void LoRaDemodGUI::resetToDefaults ( )
virtual

Implements PluginInstanceGUI.

Definition at line 48 of file lorademodgui.cpp.

References applySettings(), displaySettings(), m_settings, and LoRaDemodSettings::resetToDefaults().

Referenced by deserialize().

49 {
52  applySettings(true);
53 }
void applySettings(bool force=false)
LoRaDemodSettings m_settings
Definition: lorademodgui.h:50
void displaySettings()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serialize()

QByteArray LoRaDemodGUI::serialize ( ) const
virtual

Implements PluginInstanceGUI.

Definition at line 55 of file lorademodgui.cpp.

References m_settings, and LoRaDemodSettings::serialize().

56 {
57  return m_settings.serialize();
58 }
LoRaDemodSettings m_settings
Definition: lorademodgui.h:50
QByteArray serialize() const
+ Here is the call graph for this function:

◆ setCenterFrequency()

void LoRaDemodGUI::setCenterFrequency ( qint64  centerFrequency)
virtual

Implements PluginInstanceGUI.

Definition at line 42 of file lorademodgui.cpp.

References applySettings(), m_channelMarker, and ChannelMarker::setCenterFrequency().

43 {
44  m_channelMarker.setCenterFrequency(centerFrequency);
45  applySettings();
46 }
void applySettings(bool force=false)
ChannelMarker m_channelMarker
Definition: lorademodgui.h:49
void setCenterFrequency(int centerFrequency)
+ Here is the call graph for this function:

◆ setName()

void LoRaDemodGUI::setName ( const QString &  name)
virtual

Implements PluginInstanceGUI.

Definition at line 28 of file lorademodgui.cpp.

29 {
30  setObjectName(name);
31 }

◆ viewChanged

void LoRaDemodGUI::viewChanged ( )
privateslot

Definition at line 78 of file lorademodgui.cpp.

References applySettings().

Referenced by LoRaDemodGUI().

79 {
80  applySettings();
81 }
void applySettings(bool force=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_channelMarker

ChannelMarker LoRaDemodGUI::m_channelMarker
private

◆ m_deviceUISet

DeviceUISet* LoRaDemodGUI::m_deviceUISet
private

Definition at line 48 of file lorademodgui.h.

Referenced by LoRaDemodGUI(), and ~LoRaDemodGUI().

◆ m_doApplySettings

bool LoRaDemodGUI::m_doApplySettings
private

Definition at line 51 of file lorademodgui.h.

Referenced by applySettings(), and blockApplySettings().

◆ m_inputMessageQueue

MessageQueue LoRaDemodGUI::m_inputMessageQueue
private

Definition at line 55 of file lorademodgui.h.

◆ m_LoRaDemod

LoRaDemod* LoRaDemodGUI::m_LoRaDemod
private

Definition at line 53 of file lorademodgui.h.

Referenced by applySettings(), LoRaDemodGUI(), and ~LoRaDemodGUI().

◆ m_pluginAPI

PluginAPI* LoRaDemodGUI::m_pluginAPI
private

Definition at line 47 of file lorademodgui.h.

◆ m_settings

LoRaDemodSettings LoRaDemodGUI::m_settings
private

◆ m_spectrumVis

SpectrumVis* LoRaDemodGUI::m_spectrumVis
private

Definition at line 54 of file lorademodgui.h.

Referenced by LoRaDemodGUI(), and ~LoRaDemodGUI().

◆ ui

Ui::LoRaDemodGUI* LoRaDemodGUI::ui
private

Definition at line 46 of file lorademodgui.h.

Referenced by displaySettings(), LoRaDemodGUI(), on_BW_valueChanged(), and ~LoRaDemodGUI().


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