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.
remoteoutputgui.h
Go to the documentation of this file.
1 // Copyright (C) 2017 Edouard Griffiths, F4EXB //
3 // //
4 // This program is free software; you can redistribute it and/or modify //
5 // it under the terms of the GNU General Public License as published by //
6 // the Free Software Foundation as version 3 of the License, or //
7 // (at your option) any later version. //
8 // //
9 // This program is distributed in the hope that it will be useful, //
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
12 // GNU General Public License V3 for more details. //
13 // //
14 // You should have received a copy of the GNU General Public License //
15 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
17 
18 #ifndef INCLUDE_REMOTEOUTPUTGUI_H
19 #define INCLUDE_REMOTEOUTPUTGUI_H
20 
21 #include <stdint.h>
22 
23 #include <QTimer>
24 #include <QTime>
25 #include <QWidget>
26 #include <QNetworkRequest>
27 
29 #include "util/messagequeue.h"
30 #include "util/limitedcounter.h"
31 
32 #include "remoteoutput.h"
33 #include "remoteoutputsettings.h"
34 
35 class QNetworkAccessManager;
36 class QNetworkReply;
37 class QJsonObject;
38 class DeviceSampleSink;
39 class DeviceUISet;
40 
41 namespace Ui {
42  class RemoteOutputGui;
43 }
44 
46 public:
47  RemoteOutputExpAvg(float alpha) :
48  m_alpha(alpha),
49  m_start(true),
50  m_s(0)
51  {}
52  int put(int y)
53  {
54  if (m_start) {
55  m_start = false;
56  m_s = y;
57  } else {
58  m_s = m_alpha*y + (1.0-m_alpha)*m_s;
59  }
60  return roundf(m_s);
61  }
62  void reset() {
63  m_start = true;
64  }
65 
66 private:
67  float m_alpha;
68  bool m_start;
69  float m_s;
70 };
71 
72 class RemoteOutputSinkGui : public QWidget, public PluginInstanceGUI {
73  Q_OBJECT
74 
75 public:
76  explicit RemoteOutputSinkGui(DeviceUISet *deviceUISet, QWidget* parent = 0);
77  virtual ~RemoteOutputSinkGui();
78  virtual void destroy();
79 
80  void setName(const QString& name);
81  QString getName() const;
82 
83  void resetToDefaults();
84  virtual qint64 getCenterFrequency() const { return m_deviceCenterFrequency; }
85  virtual void setCenterFrequency(qint64 centerFrequency) { (void) centerFrequency; }
86  QByteArray serialize() const;
87  bool deserialize(const QByteArray& data);
88  virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
89  virtual bool handleMessage(const Message& message);
90 
91 private:
92  Ui::RemoteOutputGui* ui;
93 
97  QTimer m_updateTimer;
98  QTimer m_statusTimer;
108 
116  QTime m_time;
117 
121 
123 
124  QNetworkAccessManager *m_networkManager;
125  QNetworkRequest m_networkRequest;
126 
127  void blockApplySettings(bool block);
128  void displaySettings();
129  void displayTime();
130  void sendControl(bool force = false);
131  void sendSettings();
132  void updateSampleRate();
133  void updateTxDelayTooltip();
134  void displayEventCounts();
135  void displayEventStatus(int recoverableCount, int unrecoverableCount);
136  void displayEventTimer();
137  void analyzeApiReply(const QJsonObject& jsonObject);
138 
139 private slots:
140  void handleInputMessages();
141  void on_sampleRate_changed(quint64 value);
142  void on_txDelay_valueChanged(int value);
143  void on_nbFECBlocks_valueChanged(int value);
144  void on_deviceIndex_returnPressed();
145  void on_channelIndex_returnPressed();
146  void on_apiAddress_returnPressed();
147  void on_apiPort_returnPressed();
148  void on_dataAddress_returnPressed();
149  void on_dataPort_returnPressed();
150  void on_apiApplyButton_clicked(bool checked);
151  void on_dataApplyButton_clicked(bool checked);
152  void on_startStop_toggled(bool checked);
153  void on_eventCountsReset_clicked(bool checked);
154  void updateHardware();
155  void updateStatus();
156  void tick();
157  void networkManagerFinished(QNetworkReply *reply);
158  void openDeviceSettingsDialog(const QPoint& p);
159 };
160 
161 #endif // INCLUDE_REMOTEOUTPUTGUI_H
virtual void setCenterFrequency(qint64 centerFrequency)
virtual qint64 getCenterFrequency() const
RemoteOutputSettings m_settings
current settings
unsigned int uint32_t
Definition: rtptypes_win.h:46
RemoteOutputSettings m_controlSettings
settings last sent to device via control port
MessageQueue m_inputMessageQueue
std::size_t m_nbSinceLastFlowCheck
QNetworkRequest m_networkRequest
RemoteOutputExpAvg(float alpha)
DeviceSampleSink * m_deviceSampleSink
uint32_t m_lastCountUnrecoverable
quint64 m_deviceCenterFrequency
Center frequency in device.
DeviceUISet * m_deviceUISet
virtual MessageQueue * getInputMessageQueue()
Ui::RemoteOutputGui * ui
QNetworkAccessManager * m_networkManager
unsigned __int64 uint64_t
Definition: rtptypes_win.h:48