2016-06-19 03:56:49 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
|
|
|
|
// //
|
|
|
|
// This program is free software; you can redistribute it and/or modify //
|
|
|
|
// it under the terms of the GNU General Public License as published by //
|
|
|
|
// the Free Software Foundation as version 3 of the License, or //
|
|
|
|
// //
|
|
|
|
// This program is distributed in the hope that it will be useful, //
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
|
|
// GNU General Public License V3 for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU General Public License //
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2017-06-09 07:42:33 -04:00
|
|
|
#ifndef INCLUDE_SDRDAEMONSOURCEGUI_H
|
|
|
|
#define INCLUDE_SDRDAEMONSOURCEGUI_H
|
2016-06-19 03:56:49 -04:00
|
|
|
|
2017-09-25 18:22:08 -04:00
|
|
|
#include <plugin/plugininstancegui.h>
|
2016-06-19 03:56:49 -04:00
|
|
|
#include <QTimer>
|
2017-09-03 11:26:32 -04:00
|
|
|
#include <QWidget>
|
2016-06-19 03:56:49 -04:00
|
|
|
#include <sys/time.h>
|
2017-09-16 16:23:31 -04:00
|
|
|
|
|
|
|
#include "util/messagequeue.h"
|
|
|
|
|
2017-06-09 07:58:27 -04:00
|
|
|
#include "sdrdaemonsourceinput.h"
|
2016-06-19 03:56:49 -04:00
|
|
|
|
2017-10-29 19:02:28 -04:00
|
|
|
class DeviceUISet;
|
2016-06-19 03:56:49 -04:00
|
|
|
|
|
|
|
namespace Ui {
|
2017-06-09 07:47:26 -04:00
|
|
|
class SDRdaemonSourceGui;
|
2016-06-19 03:56:49 -04:00
|
|
|
}
|
|
|
|
|
2017-09-25 18:22:08 -04:00
|
|
|
class SDRdaemonSourceGui : public QWidget, public PluginInstanceGUI {
|
2016-06-19 03:56:49 -04:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2017-10-29 19:45:23 -04:00
|
|
|
explicit SDRdaemonSourceGui(DeviceUISet *deviceUISet, QWidget* parent = 0);
|
2017-06-09 08:14:32 -04:00
|
|
|
virtual ~SDRdaemonSourceGui();
|
2017-09-16 04:45:08 -04:00
|
|
|
virtual void destroy();
|
2016-06-19 03:56:49 -04:00
|
|
|
|
|
|
|
void setName(const QString& name);
|
|
|
|
QString getName() const;
|
|
|
|
|
|
|
|
void resetToDefaults();
|
|
|
|
QByteArray serialize() const;
|
|
|
|
bool deserialize(const QByteArray& data);
|
|
|
|
virtual qint64 getCenterFrequency() const;
|
|
|
|
virtual void setCenterFrequency(qint64 centerFrequency);
|
2017-09-16 16:23:31 -04:00
|
|
|
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
|
2016-06-19 03:56:49 -04:00
|
|
|
virtual bool handleMessage(const Message& message);
|
|
|
|
|
|
|
|
private:
|
2017-06-09 07:47:26 -04:00
|
|
|
Ui::SDRdaemonSourceGui* ui;
|
2016-06-19 03:56:49 -04:00
|
|
|
|
2017-10-29 19:02:28 -04:00
|
|
|
DeviceUISet* m_deviceUISet;
|
2017-06-09 08:14:32 -04:00
|
|
|
SDRdaemonSourceSettings m_settings; //!< current settings
|
|
|
|
SDRdaemonSourceSettings m_controlSettings; //!< settings last sent to device via control port
|
2016-06-19 03:56:49 -04:00
|
|
|
QTimer m_updateTimer;
|
|
|
|
QTimer m_statusTimer;
|
2016-10-02 17:16:40 -04:00
|
|
|
DeviceSampleSource* m_sampleSource;
|
2016-06-19 03:56:49 -04:00
|
|
|
bool m_acquisition;
|
|
|
|
int m_deviceSampleRate;
|
|
|
|
quint64 m_deviceCenterFrequency; //!< Center frequency in device
|
|
|
|
int m_lastEngineState;
|
2017-09-16 16:23:31 -04:00
|
|
|
MessageQueue m_inputMessageQueue;
|
2016-06-19 03:56:49 -04:00
|
|
|
|
|
|
|
int m_sampleRate;
|
|
|
|
quint64 m_centerFrequency;
|
|
|
|
struct timeval m_startingTimeStamp;
|
2016-07-24 05:09:11 -04:00
|
|
|
int m_framesDecodingStatus;
|
2016-07-27 22:49:33 -04:00
|
|
|
bool m_allBlocksReceived;
|
2016-06-19 03:56:49 -04:00
|
|
|
float m_bufferLengthInSecs;
|
|
|
|
int32_t m_bufferGauge;
|
2016-07-17 18:39:35 -04:00
|
|
|
int m_minNbBlocks;
|
2016-07-27 12:49:17 -04:00
|
|
|
int m_minNbOriginalBlocks;
|
2016-07-17 18:39:35 -04:00
|
|
|
int m_maxNbRecovery;
|
2016-06-19 19:18:21 -04:00
|
|
|
float m_avgNbBlocks;
|
2016-07-27 12:49:17 -04:00
|
|
|
float m_avgNbOriginalBlocks;
|
2016-06-19 19:18:21 -04:00
|
|
|
float m_avgNbRecovery;
|
2016-07-24 05:09:11 -04:00
|
|
|
int m_nbOriginalBlocks;
|
|
|
|
int m_nbFECBlocks;
|
2016-06-19 19:18:21 -04:00
|
|
|
|
2016-06-19 03:56:49 -04:00
|
|
|
int m_samplesCount;
|
|
|
|
std::size_t m_tickCount;
|
|
|
|
|
|
|
|
QString m_address;
|
|
|
|
QString m_remoteAddress;
|
|
|
|
quint16 m_dataPort;
|
|
|
|
quint16 m_controlPort;
|
|
|
|
bool m_addressEdited;
|
|
|
|
bool m_dataPortEdited;
|
|
|
|
bool m_initSendConfiguration;
|
|
|
|
int m_sender;
|
2017-06-08 09:31:24 -04:00
|
|
|
|
|
|
|
uint32_t m_countUnrecoverable;
|
|
|
|
uint32_t m_countRecovered;
|
|
|
|
QTime m_eventsTime;
|
|
|
|
|
|
|
|
bool m_doApplySettings;
|
2017-06-07 20:06:36 -04:00
|
|
|
bool m_forceSettings;
|
2017-06-08 17:35:52 -04:00
|
|
|
double m_txDelay;
|
2016-06-19 03:56:49 -04:00
|
|
|
|
|
|
|
bool m_dcBlock;
|
|
|
|
bool m_iqCorrection;
|
|
|
|
|
2016-07-27 23:57:59 -04:00
|
|
|
QPalette m_paletteGreenText;
|
|
|
|
QPalette m_paletteWhiteText;
|
|
|
|
|
2017-06-07 20:06:36 -04:00
|
|
|
void blockApplySettings(bool block);
|
2016-06-19 03:56:49 -04:00
|
|
|
void displaySettings();
|
|
|
|
void displayTime();
|
2017-06-07 20:06:36 -04:00
|
|
|
void sendControl(bool force = false);
|
|
|
|
void sendSettings();
|
2016-06-19 03:56:49 -04:00
|
|
|
void configureUDPLink();
|
|
|
|
void configureAutoCorrections();
|
|
|
|
void updateWithAcquisition();
|
|
|
|
void updateWithStreamData();
|
|
|
|
void updateWithStreamTime();
|
|
|
|
void updateSampleRateAndFrequency();
|
2017-06-08 17:35:52 -04:00
|
|
|
void updateTxDelay();
|
2017-06-08 09:31:24 -04:00
|
|
|
void displayEventCounts();
|
|
|
|
void displayEventTimer();
|
2016-06-19 03:56:49 -04:00
|
|
|
|
|
|
|
private slots:
|
2017-09-16 19:23:54 -04:00
|
|
|
void handleInputMessages();
|
2016-06-19 03:56:49 -04:00
|
|
|
void on_applyButton_clicked(bool checked);
|
|
|
|
void on_dcOffset_toggled(bool checked);
|
|
|
|
void on_iqImbalance_toggled(bool checked);
|
2017-06-07 18:21:46 -04:00
|
|
|
void on_address_returnPressed();
|
|
|
|
void on_dataPort_returnPressed();
|
|
|
|
void on_controlPort_returnPressed();
|
2016-06-19 03:56:49 -04:00
|
|
|
void on_sendButton_clicked(bool checked);
|
2017-06-08 19:03:56 -04:00
|
|
|
void on_freq_changed(quint64 value);
|
2017-06-08 18:43:06 -04:00
|
|
|
void on_sampleRate_changed(quint64 value);
|
2017-06-07 18:21:46 -04:00
|
|
|
void on_specificParms_returnPressed();
|
2016-06-19 03:56:49 -04:00
|
|
|
void on_decim_currentIndexChanged(int index);
|
|
|
|
void on_fcPos_currentIndexChanged(int index);
|
|
|
|
void on_startStop_toggled(bool checked);
|
|
|
|
void on_record_toggled(bool checked);
|
2017-06-08 09:31:24 -04:00
|
|
|
void on_eventCountsReset_clicked(bool checked);
|
2017-06-08 17:35:52 -04:00
|
|
|
void on_txDelay_valueChanged(int value);
|
2017-06-08 18:21:05 -04:00
|
|
|
void on_nbFECBlocks_valueChanged(int value);
|
2017-06-07 20:06:36 -04:00
|
|
|
void updateHardware();
|
2016-06-19 03:56:49 -04:00
|
|
|
void updateStatus();
|
|
|
|
void tick();
|
|
|
|
};
|
|
|
|
|
2017-06-09 07:42:33 -04:00
|
|
|
#endif // INCLUDE_SDRDAEMONSOURCEGUI_H
|