2017-02-23 02:18:56 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
2023-11-18 06:02:48 -05:00
|
|
|
// Copyright (C) 2017-2022 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
|
|
|
// Copyright (C) 2020 Kacper Michajłow <kasper93@gmail.com> //
|
|
|
|
// Copyright (C) 2020 Vort <vvort@yandex.ru> //
|
2017-02-23 02:18:56 -05:00
|
|
|
// for F4EXB / SDRAngel //
|
|
|
|
// //
|
|
|
|
// 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 //
|
2019-04-11 00:39:30 -04:00
|
|
|
// (at your option) any later version. //
|
2017-02-23 02:18:56 -05:00
|
|
|
// //
|
|
|
|
// 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_ATVDEMOD_H
|
|
|
|
#define INCLUDE_ATVDEMOD_H
|
|
|
|
|
|
|
|
#include <QElapsedTimer>
|
2020-08-19 07:12:23 -04:00
|
|
|
#include <QThread>
|
2017-02-23 02:18:56 -05:00
|
|
|
#include <vector>
|
2017-03-17 06:46:38 -04:00
|
|
|
|
|
|
|
#include "dsp/basebandsamplesink.h"
|
2019-05-09 11:27:12 -04:00
|
|
|
#include "channel/channelapi.h"
|
2017-03-17 06:46:38 -04:00
|
|
|
#include "dsp/devicesamplesource.h"
|
|
|
|
#include "dsp/dspcommands.h"
|
2017-02-23 02:18:56 -05:00
|
|
|
#include "util/message.h"
|
|
|
|
|
2019-12-01 09:13:35 -05:00
|
|
|
#include "atvdemodbaseband.h"
|
|
|
|
|
2019-05-08 16:11:53 -04:00
|
|
|
class DeviceAPI;
|
2021-05-29 14:09:28 -04:00
|
|
|
class ScopeVis;
|
2017-02-23 02:18:56 -05:00
|
|
|
|
2019-05-09 11:27:12 -04:00
|
|
|
class ATVDemod : public BasebandSampleSink, public ChannelAPI
|
2017-02-23 02:18:56 -05:00
|
|
|
{
|
|
|
|
public:
|
2019-12-01 09:13:35 -05:00
|
|
|
class MsgConfigureATVDemod : public Message {
|
2017-11-06 17:57:59 -05:00
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
|
|
|
|
public:
|
2019-12-01 09:13:35 -05:00
|
|
|
const ATVDemodSettings& getSettings() const { return m_settings; }
|
|
|
|
bool getForce() const { return m_force; }
|
2017-11-06 17:57:59 -05:00
|
|
|
|
2019-12-01 09:13:35 -05:00
|
|
|
static MsgConfigureATVDemod* create(const ATVDemodSettings& settings, bool force)
|
2017-11-06 17:57:59 -05:00
|
|
|
{
|
2019-12-01 09:13:35 -05:00
|
|
|
return new MsgConfigureATVDemod(settings, force);
|
2017-11-06 17:57:59 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2019-12-01 09:13:35 -05:00
|
|
|
ATVDemodSettings m_settings;
|
|
|
|
bool m_force;
|
2017-11-06 17:57:59 -05:00
|
|
|
|
2019-12-01 09:13:35 -05:00
|
|
|
MsgConfigureATVDemod(const ATVDemodSettings& settings, bool force) :
|
2017-11-06 17:57:59 -05:00
|
|
|
Message(),
|
2019-12-01 09:13:35 -05:00
|
|
|
m_settings(settings),
|
|
|
|
m_force(force)
|
2017-11-06 17:04:23 -05:00
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2019-05-08 16:11:53 -04:00
|
|
|
ATVDemod(DeviceAPI *deviceAPI);
|
2020-10-04 13:07:42 -04:00
|
|
|
virtual ~ATVDemod();
|
2017-12-17 17:15:42 -05:00
|
|
|
virtual void destroy() { delete this; }
|
2022-04-16 10:45:53 -04:00
|
|
|
virtual void setDeviceAPI(DeviceAPI *deviceAPI);
|
|
|
|
virtual DeviceAPI *getDeviceAPI() { return m_deviceAPI; }
|
2017-03-17 04:39:20 -04:00
|
|
|
|
2020-11-15 02:31:49 -05:00
|
|
|
using BasebandSampleSink::feed;
|
|
|
|
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
|
2017-02-23 02:18:56 -05:00
|
|
|
virtual void start();
|
|
|
|
virtual void stop();
|
2022-02-12 18:57:33 -05:00
|
|
|
virtual void pushMessage(Message *msg) { m_inputMessageQueue.push(msg); }
|
|
|
|
virtual QString getSinkName() { return objectName(); }
|
2017-02-23 02:18:56 -05:00
|
|
|
|
2020-11-21 14:24:18 -05:00
|
|
|
virtual void getIdentifier(QString& id) { id = objectName(); }
|
2022-03-26 04:51:06 -04:00
|
|
|
virtual QString getIdentifier() const { return objectName(); }
|
2017-11-18 21:38:07 -05:00
|
|
|
virtual void getTitle(QString& title) { title = objectName(); }
|
2019-12-01 09:13:35 -05:00
|
|
|
virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; }
|
2022-01-06 16:47:41 -05:00
|
|
|
virtual void setCenterFrequency(qint64 frequency);
|
2017-12-17 17:15:42 -05:00
|
|
|
|
|
|
|
virtual QByteArray serialize() const { return QByteArray(); }
|
2018-11-12 18:45:03 -05:00
|
|
|
virtual bool deserialize(const QByteArray& data) { (void) data; return false; }
|
2017-11-18 21:38:07 -05:00
|
|
|
|
2019-05-09 11:27:12 -04:00
|
|
|
virtual int getNbSinkStreams() const { return 1; }
|
|
|
|
virtual int getNbSourceStreams() const { return 0; }
|
2023-12-13 13:24:26 -05:00
|
|
|
virtual int getStreamIndex() const { return m_settings.m_streamIndex; }
|
2019-05-09 11:27:12 -04:00
|
|
|
|
|
|
|
virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const
|
|
|
|
{
|
|
|
|
(void) streamIndex;
|
|
|
|
(void) sinkElseSource;
|
2019-12-01 09:13:35 -05:00
|
|
|
return m_settings.m_inputFrequencyOffset;
|
2019-05-09 11:27:12 -04:00
|
|
|
}
|
|
|
|
|
2021-05-30 07:12:00 -04:00
|
|
|
ScopeVis *getScopeSink() { return m_basebandSink->getScopeSink(); }
|
2020-08-03 12:31:47 -04:00
|
|
|
void setTVScreen(TVScreenAnalog *tvScreen) { m_basebandSink->setTVScreen(tvScreen); }; //!< set by the GUI
|
2019-12-01 09:13:35 -05:00
|
|
|
double getMagSq() const { return m_basebandSink->getMagSq(); } //!< Beware this is scaled to 2^30
|
|
|
|
bool getBFOLocked() { return m_basebandSink->getBFOLocked(); }
|
|
|
|
void setVideoTabIndex(int videoTabIndex) { m_basebandSink->setVideoTabIndex(videoTabIndex); }
|
2022-04-17 19:42:03 -04:00
|
|
|
uint32_t getNumberOfDeviceStreams() const;
|
2017-02-23 02:18:56 -05:00
|
|
|
|
2020-11-21 14:24:18 -05:00
|
|
|
static const char* const m_channelIdURI;
|
|
|
|
static const char* const m_channelId;
|
2017-11-08 08:23:49 -05:00
|
|
|
|
2017-02-23 02:18:56 -05:00
|
|
|
private:
|
2019-05-08 16:11:53 -04:00
|
|
|
DeviceAPI* m_deviceAPI;
|
2020-08-19 07:12:23 -04:00
|
|
|
QThread m_thread;
|
2019-12-01 09:13:35 -05:00
|
|
|
ATVDemodBaseband* m_basebandSink;
|
|
|
|
ATVDemodSettings m_settings;
|
2020-07-11 15:01:32 -04:00
|
|
|
qint64 m_centerFrequency; //!< center frequency stored from device message used when starting baseband sink
|
|
|
|
int m_basebandSampleRate; //!< sample rate stored from device message used when starting baseband sink
|
2017-03-16 18:13:51 -04:00
|
|
|
|
2022-02-12 18:57:33 -05:00
|
|
|
virtual bool handleMessage(const Message& cmd);
|
2019-12-01 09:13:35 -05:00
|
|
|
void applySettings(const ATVDemodSettings& settings, bool force = false);
|
2022-03-18 12:08:04 -04:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void handleIndexInDeviceSetChanged(int index);
|
2017-02-23 02:18:56 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INCLUDE_ATVDEMOD_H
|