1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-07 17:16:02 -05:00
sdrangel/plugins/channelrx/demodatv/atvdemod.h

112 lines
4.4 KiB
C
Raw Normal View History

2017-02-23 02:18:56 -05:00
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2017 F4HKW //
// 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>
#include "dsp/basebandsamplesink.h"
2019-05-09 11:27:12 -04:00
#include "channel/channelapi.h"
#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;
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
{
Q_OBJECT
public:
2019-12-01 09:13:35 -05:00
class MsgConfigureATVDemod : public Message {
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; }
2019-12-01 09:13:35 -05:00
static MsgConfigureATVDemod* create(const ATVDemodSettings& settings, bool force)
{
2019-12-01 09:13:35 -05:00
return new MsgConfigureATVDemod(settings, force);
}
private:
2019-12-01 09:13:35 -05:00
ATVDemodSettings m_settings;
bool m_force;
2019-12-01 09:13:35 -05:00
MsgConfigureATVDemod(const ATVDemodSettings& settings, bool force) :
Message(),
2019-12-01 09:13:35 -05:00
m_settings(settings),
m_force(force)
{ }
};
2019-05-08 16:11:53 -04:00
ATVDemod(DeviceAPI *deviceAPI);
virtual ~ATVDemod();
2017-12-17 17:15:42 -05:00
virtual void destroy() { delete this; }
2017-03-17 04:39:20 -04: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();
virtual bool handleMessage(const Message& cmd);
virtual void getIdentifier(QString& id) { id = objectName(); }
virtual void getTitle(QString& title) { title = objectName(); }
2019-12-01 09:13:35 -05:00
virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; }
2017-12-17 17:15:42 -05:00
virtual QByteArray serialize() const { return QByteArray(); }
virtual bool deserialize(const QByteArray& data) { (void) data; return false; }
2019-05-09 11:27:12 -04:00
virtual int getNbSinkStreams() const { return 1; }
virtual int getNbSourceStreams() const { return 0; }
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
}
ScopeVis *getScopeSink() { return m_basebandSink->getScopeSink(); }
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); }
2017-02-23 02:18:56 -05:00
static const char* const m_channelIdURI;
static const char* const m_channelId;
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;
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
2019-12-01 09:13:35 -05:00
void applySettings(const ATVDemodSettings& settings, bool force = false);
2017-02-23 02:18:56 -05:00
};
#endif // INCLUDE_ATVDEMOD_H