sdrangel/plugins/channelrx/demodlora/lorademod.h

99 lines
3.7 KiB
C
Raw Normal View History

2015-01-10 19:12:58 -05:00
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
// (C) 2015 John Greb //
// //
// 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. //
2015-01-10 19:12:58 -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/>. //
///////////////////////////////////////////////////////////////////////////////////
2019-12-03 12:49:52 -05:00
#ifndef INCLUDE_LORADEMOD_H
#define INCLUDE_LORADEMOD_H
2015-01-10 19:12:58 -05:00
#include <vector>
2017-10-07 19:42:18 -04:00
#include "dsp/basebandsamplesink.h"
2019-05-09 11:27:12 -04:00
#include "channel/channelapi.h"
2015-01-10 19:12:58 -05:00
#include "util/message.h"
2019-12-03 12:49:52 -05:00
#include "lorademodbaseband.h"
2015-01-11 14:30:48 -05:00
2019-05-08 16:11:53 -04:00
class DeviceAPI;
2019-12-03 12:49:52 -05:00
class QThread;
2017-10-07 19:42:18 -04:00
2019-05-09 11:27:12 -04:00
class LoRaDemod : public BasebandSampleSink, public ChannelAPI {
2015-01-10 19:12:58 -05:00
public:
2017-10-07 19:42:18 -04:00
class MsgConfigureLoRaDemod : public Message {
MESSAGE_CLASS_DECLARATION
public:
const LoRaDemodSettings& getSettings() const { return m_settings; }
bool getForce() const { return m_force; }
static MsgConfigureLoRaDemod* create(const LoRaDemodSettings& settings, bool force)
{
return new MsgConfigureLoRaDemod(settings, force);
}
private:
LoRaDemodSettings m_settings;
bool m_force;
MsgConfigureLoRaDemod(const LoRaDemodSettings& settings, bool force) :
Message(),
m_settings(settings),
m_force(force)
{ }
};
2019-05-08 16:11:53 -04:00
LoRaDemod(DeviceAPI* deviceAPI);
2015-08-17 02:29:34 -04:00
virtual ~LoRaDemod();
2017-12-17 17:15:42 -05:00
virtual void destroy() { delete this; }
2019-12-03 12:49:52 -05:00
void setSpectrumSink(BasebandSampleSink* sampleSink) { m_basebandSink->setSpectrumSink(sampleSink); }
2015-01-10 19:12:58 -05:00
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool pO);
2015-08-17 02:29:34 -04:00
virtual void start();
virtual void stop();
virtual bool handleMessage(const Message& cmd);
2015-01-10 19:12:58 -05:00
virtual void getIdentifier(QString& id) { id = objectName(); }
virtual void getTitle(QString& title) { title = m_settings.m_title; }
2017-12-17 17:15:42 -05:00
virtual qint64 getCenterFrequency() const { return 0; }
virtual QByteArray serialize() const;
virtual bool deserialize(const QByteArray& data);
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;
return 0;
}
static const QString m_channelIdURI;
static const QString m_channelId;
2015-01-10 19:12:58 -05:00
private:
2019-05-08 16:11:53 -04:00
DeviceAPI *m_deviceAPI;
2019-12-03 12:49:52 -05:00
QThread *m_thread;
LoRaDemodBaseband* m_basebandSink;
2017-10-07 19:42:18 -04:00
LoRaDemodSettings m_settings;
2019-12-03 12:49:52 -05:00
int m_basebandSampleRate;
2015-01-10 19:12:58 -05:00
2019-12-03 12:49:52 -05:00
void applySettings(const LoRaDemodSettings& settings, bool force = false);
2015-01-10 19:12:58 -05:00
};
2019-12-03 12:49:52 -05:00
#endif // INCLUDE_LORADEMOD_H