mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 17:28:50 -05:00
M17 demod: view SMS messages in GUI
This commit is contained in:
parent
9738e986c2
commit
5f2d2a0b2e
@ -44,6 +44,7 @@
|
||||
#include "m17demod.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(M17Demod::MsgConfigureM17Demod, Message)
|
||||
MESSAGE_CLASS_DEFINITION(M17Demod::MsgReportSMS, Message)
|
||||
|
||||
const char* const M17Demod::m_channelIdURI = "sdrangel.channel.m17demod";
|
||||
const char* const M17Demod::m_channelId = "M17Demod";
|
||||
@ -60,6 +61,7 @@ M17Demod::M17Demod(DeviceAPI *deviceAPI) :
|
||||
m_thread = new QThread(this);
|
||||
m_basebandSink = new M17DemodBaseband();
|
||||
m_basebandSink->setChannel(this);
|
||||
m_basebandSink->setDemodInputMessageQueue(&m_inputMessageQueue);
|
||||
m_basebandSink->moveToThread(m_thread);
|
||||
|
||||
applySettings(m_settings, true);
|
||||
@ -173,6 +175,16 @@ bool M17Demod::handleMessage(const Message& cmd)
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (MsgReportSMS::match(cmd))
|
||||
{
|
||||
MsgReportSMS& report = (MsgReportSMS&) cmd;
|
||||
// Forward to GUI if any
|
||||
if (getMessageQueueToGUI()) {
|
||||
getMessageQueueToGUI()->push(new MsgReportSMS(report));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
|
@ -45,8 +45,7 @@ public:
|
||||
const M17DemodSettings& getSettings() const { return m_settings; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigureM17Demod* create(const M17DemodSettings& settings, bool force)
|
||||
{
|
||||
static MsgConfigureM17Demod* create(const M17DemodSettings& settings, bool force) {
|
||||
return new MsgConfigureM17Demod(settings, force);
|
||||
}
|
||||
|
||||
@ -61,6 +60,31 @@ public:
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgReportSMS : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
const QString& getSource() const { return m_source; }
|
||||
const QString& getDest() const { return m_dest; }
|
||||
const QString& getSMS() const { return m_sms; }
|
||||
|
||||
static MsgReportSMS* create(const QString& source, const QString& dest, const QString& sms) {
|
||||
return new MsgReportSMS(source, dest, sms);
|
||||
}
|
||||
|
||||
private:
|
||||
QString m_source;
|
||||
QString m_dest;
|
||||
QString m_sms;
|
||||
|
||||
MsgReportSMS(const QString& source, const QString& dest, const QString& sms) :
|
||||
Message(),
|
||||
m_source(source),
|
||||
m_dest(dest),
|
||||
m_sms(sms)
|
||||
{ }
|
||||
};
|
||||
|
||||
M17Demod(DeviceAPI *deviceAPI);
|
||||
virtual ~M17Demod();
|
||||
virtual void destroy() { delete this; }
|
||||
|
@ -97,6 +97,7 @@ public:
|
||||
bool getStreamElsePacket() const { return m_sink.getStreamElsePacket(); }
|
||||
uint16_t getCRC() const { return m_sink.getCRC(); }
|
||||
int getStdPacketProtocol() const { return m_sink.getStdPacketProtocol(); }
|
||||
void setDemodInputMessageQueue(MessageQueue *messageQueue) { m_sink.setDemodInputMessageQueue(messageQueue); }
|
||||
|
||||
private:
|
||||
SampleSinkFifo m_sampleFifo;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <QDockWidget>
|
||||
#include <QMainWindow>
|
||||
#include <QDebug>
|
||||
#include <QScrollBar>
|
||||
|
||||
#include <complex>
|
||||
|
||||
@ -113,6 +114,23 @@ bool M17DemodGUI::handleMessage(const Message& message)
|
||||
updateAbsoluteCenterFrequency();
|
||||
return true;
|
||||
}
|
||||
else if (M17Demod::MsgReportSMS::match(message))
|
||||
{
|
||||
const M17Demod::MsgReportSMS& report = (M17Demod::MsgReportSMS&) message;
|
||||
QDateTime dt = QDateTime::currentDateTime();
|
||||
QString dateStr = dt.toString("HH:mm:ss");
|
||||
QTextCursor cursor = ui->smsLog->textCursor();
|
||||
cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
|
||||
cursor.insertText(tr("=== %1 %2 to %3 ===\n%4\n")
|
||||
.arg(dateStr)
|
||||
.arg(report.getSource())
|
||||
.arg(report.getDest())
|
||||
.arg(report.getSMS())
|
||||
);
|
||||
ui->smsLog->verticalScrollBar()->setValue(ui->smsLog->verticalScrollBar()->maximum());
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -25,6 +25,7 @@
|
||||
#include "audio/audiofifo.h"
|
||||
|
||||
#include "m17/ax25_frame.h"
|
||||
#include "m17demod.h"
|
||||
#include "m17demodprocessor.h"
|
||||
|
||||
M17DemodProcessor* M17DemodProcessor::m_this = nullptr;
|
||||
@ -36,7 +37,8 @@ M17DemodProcessor::M17DemodProcessor() :
|
||||
m_demod(handle_frame),
|
||||
m_audioFifo(nullptr),
|
||||
m_audioMute(false),
|
||||
m_volume(1.0f)
|
||||
m_volume(1.0f),
|
||||
m_demodInputMessageQueue(nullptr)
|
||||
{
|
||||
m_this = this;
|
||||
m_codec2 = ::codec2_create(CODEC2_MODE_3200);
|
||||
@ -359,7 +361,20 @@ bool M17DemodProcessor::decode_packet(mobilinkd::M17FrameDecoder::packet_buffer_
|
||||
oss << *it;
|
||||
}
|
||||
|
||||
qDebug() << "M17DemodProcessor::decode_packet: SMS:" << oss.str().c_str();
|
||||
qDebug() << "M17DemodProcessor::decode_packet: "
|
||||
<< " From:" << getSrcCall()
|
||||
<< " To:" << getDestcCall()
|
||||
<< " SMS:" << oss.str().c_str();
|
||||
|
||||
if (m_demodInputMessageQueue)
|
||||
{
|
||||
M17Demod::MsgReportSMS *msg = M17Demod::MsgReportSMS::create(
|
||||
getSrcCall(),
|
||||
getDestcCall(),
|
||||
QString(oss.str().c_str())
|
||||
);
|
||||
m_demodInputMessageQueue->push(msg);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "m17demodfilters.h"
|
||||
|
||||
class AudioFifo;
|
||||
class MessageQueue;
|
||||
|
||||
class M17DemodProcessor : public QObject
|
||||
{
|
||||
@ -45,6 +46,7 @@ public:
|
||||
M17DemodProcessor();
|
||||
~M17DemodProcessor();
|
||||
|
||||
void setDemodInputMessageQueue(MessageQueue *messageQueue) { m_demodInputMessageQueue = messageQueue; }
|
||||
void pushSample(qint16 sample);
|
||||
void setDisplayLSF(bool displayLSF) { m_displayLSF = displayLSF; }
|
||||
void setNoiseBlanker(bool noiseBlanker) { m_noiseBlanker = noiseBlanker; }
|
||||
@ -130,6 +132,8 @@ private:
|
||||
uint32_t m_lsfCount; // Incremented each time a new LSF is decoded. Reset when lock is lost.
|
||||
StdPacketProtocol m_stdPacketProtocol;
|
||||
|
||||
MessageQueue *m_demodInputMessageQueue;
|
||||
|
||||
static bool handle_frame(mobilinkd::M17FrameDecoder::output_buffer_t const& frame, int viterbi_cost);
|
||||
static void diagnostic_callback(
|
||||
bool dcd,
|
||||
|
@ -99,6 +99,7 @@ public:
|
||||
bool getStreamElsePacket() const { return m_m17DemodProcessor.getStreamElsePacket(); }
|
||||
uint16_t getCRC() const { return m_m17DemodProcessor.getCRC(); }
|
||||
int getStdPacketProtocol() const { return (int) m_m17DemodProcessor.getStdPacketProtocol(); }
|
||||
void setDemodInputMessageQueue(MessageQueue *messageQueue) { m_m17DemodProcessor.setDemodInputMessageQueue(messageQueue); }
|
||||
|
||||
private:
|
||||
struct MagSqLevelsStore
|
||||
|
Loading…
Reference in New Issue
Block a user