sdrangel/plugins/channeltx/modm17/m17modprocessor.h

81 wiersze
3.2 KiB
C
Czysty Zwykły widok Historia

2022-06-10 15:54:18 +00:00
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2022 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 //
// (at your option) any later version. //
// //
// 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_M17MODPROCESSOR_H
#define INCLUDE_M17MODPROCESSOR_H
#include <QObject>
#include <QByteArray>
2022-06-17 00:25:34 +00:00
#include "m17/M17Modulator.h"
2022-06-10 15:54:18 +00:00
#include "util/message.h"
#include "util/messagequeue.h"
2022-06-18 04:15:54 +00:00
#include "m17modfifo.h"
2022-06-10 15:54:18 +00:00
class M17ModProcessor : public QObject
{
Q_OBJECT
public:
2022-06-12 20:51:18 +00:00
class MsgSendSMS : public Message {
2022-06-10 15:54:18 +00:00
MESSAGE_CLASS_DECLARATION
public:
2022-06-12 20:51:18 +00:00
const QString& getSourceCall() const { return m_sourceCall; }
const QString& getDestCall() const { return m_destCall; }
const QString& getSMSText() const { return m_smsText; }
2022-06-10 15:54:18 +00:00
2022-06-12 20:51:18 +00:00
static MsgSendSMS* create(const QString& sourceCall, const QString& destCall, const QString& smsText) {
return new MsgSendSMS(sourceCall, destCall, smsText);
2022-06-10 15:54:18 +00:00
}
private:
2022-06-12 20:51:18 +00:00
QString m_sourceCall;
QString m_destCall;
QString m_smsText;
2022-06-10 15:54:18 +00:00
2022-06-12 20:51:18 +00:00
MsgSendSMS(const QString& sourceCall, const QString& destCall, const QString& smsText) :
2022-06-10 15:54:18 +00:00
Message(),
2022-06-12 20:51:18 +00:00
m_sourceCall(sourceCall),
m_destCall(destCall),
m_smsText(smsText)
2022-06-10 15:54:18 +00:00
{ }
};
M17ModProcessor();
~M17ModProcessor();
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
2022-06-18 04:15:54 +00:00
M17ModFIFO *getBasebandFifo() { return &m_basebandFifo; }
2022-06-10 15:54:18 +00:00
private:
MessageQueue m_inputMessageQueue;
2022-06-18 04:15:54 +00:00
M17ModFIFO m_basebandFifo; //!< Samples are 16 bit integer baseband 48 kS/s samples
2022-06-17 00:25:34 +00:00
mobilinkd::M17Modulator m_m17Modulator;
2022-06-10 15:54:18 +00:00
bool handleMessage(const Message& cmd);
2022-06-12 20:51:18 +00:00
void processPacket(const QString& sourceCall, const QString& destCall, const QByteArray& packetBytes);
2022-06-17 00:25:34 +00:00
void test(const QString& sourceCall, const QString& destCall);
void send_preamble();
void send_eot();
void output_baseband(std::array<uint8_t, 2> sync_word, const std::array<int8_t, 368>& frame);
2022-06-10 15:54:18 +00:00
private slots:
void handleInputMessages();
};
#endif // INCLUDE_M17MODPROCESSOR_H