2015-01-11 00:12:58 +00: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 04:39:30 +00:00
|
|
|
// (at your option) any later version. //
|
2015-01-11 00:12:58 +00: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 17:49:52 +00:00
|
|
|
#ifndef INCLUDE_LORADEMOD_H
|
|
|
|
#define INCLUDE_LORADEMOD_H
|
2015-01-11 00:12:58 +00:00
|
|
|
|
|
|
|
#include <vector>
|
2017-10-07 23:42:18 +00:00
|
|
|
|
2017-11-19 17:18:17 +00:00
|
|
|
#include "dsp/basebandsamplesink.h"
|
2020-05-15 21:12:46 +00:00
|
|
|
#include "dsp/spectrumvis.h"
|
2019-05-09 15:27:12 +00:00
|
|
|
#include "channel/channelapi.h"
|
2015-01-11 00:12:58 +00:00
|
|
|
#include "util/message.h"
|
|
|
|
|
2019-12-03 17:49:52 +00:00
|
|
|
#include "lorademodbaseband.h"
|
2015-01-11 19:30:48 +00:00
|
|
|
|
2019-05-08 20:11:53 +00:00
|
|
|
class DeviceAPI;
|
2019-12-03 17:49:52 +00:00
|
|
|
class QThread;
|
2017-10-07 23:42:18 +00:00
|
|
|
|
2019-05-09 15:27:12 +00:00
|
|
|
class LoRaDemod : public BasebandSampleSink, public ChannelAPI {
|
2015-01-11 00:12:58 +00:00
|
|
|
public:
|
2017-10-07 23:42:18 +00: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 20:11:53 +00:00
|
|
|
LoRaDemod(DeviceAPI* deviceAPI);
|
2015-08-17 06:29:34 +00:00
|
|
|
virtual ~LoRaDemod();
|
2017-12-17 22:15:42 +00:00
|
|
|
virtual void destroy() { delete this; }
|
2020-05-15 21:12:46 +00:00
|
|
|
SpectrumVis *getSpectrumVis() { return &m_spectrumVis; }
|
2015-01-11 00:12:58 +00:00
|
|
|
|
2015-08-25 06:24:23 +00:00
|
|
|
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool pO);
|
2015-08-17 06:29:34 +00:00
|
|
|
virtual void start();
|
|
|
|
virtual void stop();
|
|
|
|
virtual bool handleMessage(const Message& cmd);
|
2015-01-11 00:12:58 +00:00
|
|
|
|
2017-11-19 17:18:17 +00:00
|
|
|
virtual void getIdentifier(QString& id) { id = objectName(); }
|
|
|
|
virtual void getTitle(QString& title) { title = m_settings.m_title; }
|
2017-12-17 22:15:42 +00:00
|
|
|
virtual qint64 getCenterFrequency() const { return 0; }
|
|
|
|
|
|
|
|
virtual QByteArray serialize() const;
|
|
|
|
virtual bool deserialize(const QByteArray& data);
|
2017-11-19 17:18:17 +00:00
|
|
|
|
2019-05-09 15:27:12 +00: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;
|
|
|
|
}
|
|
|
|
|
2017-11-23 00:19:32 +00:00
|
|
|
static const QString m_channelIdURI;
|
|
|
|
static const QString m_channelId;
|
2017-11-08 13:23:49 +00:00
|
|
|
|
2015-01-11 00:12:58 +00:00
|
|
|
private:
|
2019-05-08 20:11:53 +00:00
|
|
|
DeviceAPI *m_deviceAPI;
|
2019-12-03 17:49:52 +00:00
|
|
|
QThread *m_thread;
|
|
|
|
LoRaDemodBaseband* m_basebandSink;
|
2017-10-07 23:42:18 +00:00
|
|
|
LoRaDemodSettings m_settings;
|
2020-05-15 21:12:46 +00:00
|
|
|
SpectrumVis m_spectrumVis;
|
2019-12-03 17:49:52 +00:00
|
|
|
int m_basebandSampleRate;
|
2015-01-11 00:12:58 +00:00
|
|
|
|
2019-12-03 17:49:52 +00:00
|
|
|
void applySettings(const LoRaDemodSettings& settings, bool force = false);
|
2015-01-11 00:12:58 +00:00
|
|
|
};
|
|
|
|
|
2019-12-03 17:49:52 +00:00
|
|
|
#endif // INCLUDE_LORADEMOD_H
|