2015-08-02 19:04:20 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) 2015 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/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef INCLUDE_FILESOURCEGUI_H
|
|
|
|
#define INCLUDE_FILESOURCEGUI_H
|
|
|
|
|
2017-09-25 18:22:08 -04:00
|
|
|
#include <plugin/plugininstancegui.h>
|
2015-08-02 19:04:20 -04:00
|
|
|
#include <QTimer>
|
2017-09-03 11:26:32 -04:00
|
|
|
#include <QWidget>
|
|
|
|
|
2017-09-16 16:23:31 -04:00
|
|
|
#include "util/messagequeue.h"
|
|
|
|
|
2015-08-02 19:04:20 -04:00
|
|
|
#include "filesourceinput.h"
|
|
|
|
|
2016-10-10 19:17:55 -04:00
|
|
|
class DeviceSourceAPI;
|
2015-08-02 19:04:20 -04:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class FileSourceGui;
|
|
|
|
}
|
|
|
|
|
2017-09-25 18:22:08 -04:00
|
|
|
class FileSourceGui : public QWidget, public PluginInstanceGUI {
|
2015-08-02 19:04:20 -04:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2016-10-10 19:17:55 -04:00
|
|
|
explicit FileSourceGui(DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
|
2015-08-17 02:29:34 -04:00
|
|
|
virtual ~FileSourceGui();
|
2017-09-16 04:45:08 -04:00
|
|
|
virtual void destroy();
|
2015-08-02 19:04:20 -04:00
|
|
|
|
|
|
|
void setName(const QString& name);
|
|
|
|
QString getName() const;
|
|
|
|
|
|
|
|
void resetToDefaults();
|
2015-09-28 21:35:14 -04:00
|
|
|
virtual qint64 getCenterFrequency() const;
|
|
|
|
virtual void setCenterFrequency(qint64 centerFrequency);
|
2015-08-02 19:04:20 -04:00
|
|
|
QByteArray serialize() const;
|
|
|
|
bool deserialize(const QByteArray& data);
|
2017-09-16 16:23:31 -04:00
|
|
|
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
|
2015-08-17 02:29:34 -04:00
|
|
|
virtual bool handleMessage(const Message& message);
|
2015-08-02 19:04:20 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
Ui::FileSourceGui* ui;
|
|
|
|
|
2016-10-10 19:17:55 -04:00
|
|
|
DeviceSourceAPI* m_deviceAPI;
|
2015-08-02 19:04:20 -04:00
|
|
|
FileSourceInput::Settings m_settings;
|
2016-05-11 17:35:16 -04:00
|
|
|
QTimer m_statusTimer;
|
2015-08-02 19:04:20 -04:00
|
|
|
std::vector<int> m_gains;
|
2016-10-02 17:16:40 -04:00
|
|
|
DeviceSampleSource* m_sampleSource;
|
2015-08-03 22:17:24 -04:00
|
|
|
bool m_acquisition;
|
2015-08-04 21:25:06 -04:00
|
|
|
QString m_fileName;
|
2015-08-03 22:17:24 -04:00
|
|
|
int m_sampleRate;
|
|
|
|
quint64 m_centerFrequency;
|
2016-02-24 20:30:50 -05:00
|
|
|
quint32 m_recordLength;
|
2015-08-03 22:17:24 -04:00
|
|
|
std::time_t m_startingTimeStamp;
|
|
|
|
int m_samplesCount;
|
2015-08-05 19:43:35 -04:00
|
|
|
std::size_t m_tickCount;
|
2016-02-25 08:07:39 -05:00
|
|
|
bool m_enableNavTime;
|
2016-05-12 06:29:12 -04:00
|
|
|
int m_deviceSampleRate;
|
|
|
|
quint64 m_deviceCenterFrequency; //!< Center frequency in device
|
2016-05-11 17:35:16 -04:00
|
|
|
int m_lastEngineState;
|
2017-09-16 16:23:31 -04:00
|
|
|
MessageQueue m_inputMessageQueue;
|
2015-08-02 19:04:20 -04:00
|
|
|
|
|
|
|
void displaySettings();
|
2015-08-03 22:17:24 -04:00
|
|
|
void displayTime();
|
2015-08-02 19:04:20 -04:00
|
|
|
void sendSettings();
|
2016-05-12 06:29:12 -04:00
|
|
|
void updateSampleRateAndFrequency();
|
2015-08-04 21:25:06 -04:00
|
|
|
void configureFileName();
|
|
|
|
void updateWithAcquisition();
|
|
|
|
void updateWithStreamData();
|
|
|
|
void updateWithStreamTime();
|
2015-08-02 19:04:20 -04:00
|
|
|
|
|
|
|
private slots:
|
2017-09-16 19:23:54 -04:00
|
|
|
void handleInputMessages();
|
2016-05-11 17:35:16 -04:00
|
|
|
void on_startStop_toggled(bool checked);
|
2015-08-02 19:04:20 -04:00
|
|
|
void on_playLoop_toggled(bool checked);
|
|
|
|
void on_play_toggled(bool checked);
|
2016-02-25 08:07:39 -05:00
|
|
|
void on_navTimeSlider_valueChanged(int value);
|
2015-08-04 19:43:30 -04:00
|
|
|
void on_showFileDialog_clicked(bool checked);
|
2016-05-11 17:35:16 -04:00
|
|
|
void updateStatus();
|
2015-08-05 19:43:35 -04:00
|
|
|
void tick();
|
2015-08-02 19:04:20 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INCLUDE_FILESOURCEGUI_H
|