mirror of https://github.com/f4exb/sdrangel.git
M17 demod: view SMS messages in GUI
This commit is contained in:
parent
9738e986c2
commit
5f2d2a0b2e
|
@ -44,6 +44,7 @@
|
||||||
#include "m17demod.h"
|
#include "m17demod.h"
|
||||||
|
|
||||||
MESSAGE_CLASS_DEFINITION(M17Demod::MsgConfigureM17Demod, Message)
|
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_channelIdURI = "sdrangel.channel.m17demod";
|
||||||
const char* const M17Demod::m_channelId = "M17Demod";
|
const char* const M17Demod::m_channelId = "M17Demod";
|
||||||
|
@ -60,6 +61,7 @@ M17Demod::M17Demod(DeviceAPI *deviceAPI) :
|
||||||
m_thread = new QThread(this);
|
m_thread = new QThread(this);
|
||||||
m_basebandSink = new M17DemodBaseband();
|
m_basebandSink = new M17DemodBaseband();
|
||||||
m_basebandSink->setChannel(this);
|
m_basebandSink->setChannel(this);
|
||||||
|
m_basebandSink->setDemodInputMessageQueue(&m_inputMessageQueue);
|
||||||
m_basebandSink->moveToThread(m_thread);
|
m_basebandSink->moveToThread(m_thread);
|
||||||
|
|
||||||
applySettings(m_settings, true);
|
applySettings(m_settings, true);
|
||||||
|
@ -173,6 +175,16 @@ bool M17Demod::handleMessage(const Message& cmd)
|
||||||
|
|
||||||
return true;
|
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
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -45,8 +45,7 @@ public:
|
||||||
const M17DemodSettings& getSettings() const { return m_settings; }
|
const M17DemodSettings& getSettings() const { return m_settings; }
|
||||||
bool getForce() const { return m_force; }
|
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);
|
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);
|
M17Demod(DeviceAPI *deviceAPI);
|
||||||
virtual ~M17Demod();
|
virtual ~M17Demod();
|
||||||
virtual void destroy() { delete this; }
|
virtual void destroy() { delete this; }
|
||||||
|
|
|
@ -97,6 +97,7 @@ public:
|
||||||
bool getStreamElsePacket() const { return m_sink.getStreamElsePacket(); }
|
bool getStreamElsePacket() const { return m_sink.getStreamElsePacket(); }
|
||||||
uint16_t getCRC() const { return m_sink.getCRC(); }
|
uint16_t getCRC() const { return m_sink.getCRC(); }
|
||||||
int getStdPacketProtocol() const { return m_sink.getStdPacketProtocol(); }
|
int getStdPacketProtocol() const { return m_sink.getStdPacketProtocol(); }
|
||||||
|
void setDemodInputMessageQueue(MessageQueue *messageQueue) { m_sink.setDemodInputMessageQueue(messageQueue); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SampleSinkFifo m_sampleFifo;
|
SampleSinkFifo m_sampleFifo;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QScrollBar>
|
||||||
|
|
||||||
#include <complex>
|
#include <complex>
|
||||||
|
|
||||||
|
@ -113,6 +114,23 @@ bool M17DemodGUI::handleMessage(const Message& message)
|
||||||
updateAbsoluteCenterFrequency();
|
updateAbsoluteCenterFrequency();
|
||||||
return true;
|
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
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>482</width>
|
<width>522</width>
|
||||||
<height>400</height>
|
<height>420</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -18,14 +18,14 @@
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>482</width>
|
<width>522</width>
|
||||||
<height>400</height>
|
<height>420</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>560</width>
|
<width>560</width>
|
||||||
<height>400</height>
|
<height>420</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>480</width>
|
<width>520</width>
|
||||||
<height>136</height>
|
<height>136</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>480</width>
|
<width>520</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
@ -525,14 +525,14 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>136</y>
|
<y>136</y>
|
||||||
<width>480</width>
|
<width>520</width>
|
||||||
<height>249</height>
|
<height>280</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>480</width>
|
<width>520</width>
|
||||||
<height>248</height>
|
<height>274</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -637,7 +637,7 @@
|
||||||
<widget class="QLabel" name="typeText">
|
<widget class="QLabel" name="typeText">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>120</width>
|
<width>130</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
@ -718,6 +718,45 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
<widget class="QTabWidget" name="digitalTabWidget">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>210</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Digital section</string>
|
||||||
|
</property>
|
||||||
|
<property name="tabPosition">
|
||||||
|
<enum>QTabWidget::East</enum>
|
||||||
|
</property>
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="settingsTab">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Dgital Settings</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="icon">
|
||||||
|
<iconset resource="../../../sdrgui/resources/res.qrc">
|
||||||
|
<normaloff>:/gear.png</normaloff>:/gear.png</iconset>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="title">
|
||||||
|
<string/>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="toolTip">
|
||||||
|
<string>Settings</string>
|
||||||
|
</attribute>
|
||||||
|
<widget class="QWidget" name="layoutWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>476</width>
|
||||||
|
<height>212</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
<layout class="QHBoxLayout" name="scopeLayout">
|
<layout class="QHBoxLayout" name="scopeLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="TVScreen" name="screenTV" native="true">
|
<widget class="TVScreen" name="screenTV" native="true">
|
||||||
|
@ -1454,6 +1493,64 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="smsTab">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>SMS data</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="icon">
|
||||||
|
<iconset resource="../../../sdrgui/resources/res.qrc">
|
||||||
|
<normaloff>:/sms.png</normaloff>:/sms.png</iconset>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="title">
|
||||||
|
<string/>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="toolTip">
|
||||||
|
<string>SMS</string>
|
||||||
|
</attribute>
|
||||||
|
<widget class="QPlainTextEdit" name="smsLog">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>471</width>
|
||||||
|
<height>210</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Liberation Mono</family>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>SMS log</string>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="aprsTab">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>APRS data</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="icon">
|
||||||
|
<iconset resource="../../../sdrgui/resources/res.qrc">
|
||||||
|
<normaloff>:/world.png</normaloff>:/world.png</iconset>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="title">
|
||||||
|
<string/>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="toolTip">
|
||||||
|
<string>APRS</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "audio/audiofifo.h"
|
#include "audio/audiofifo.h"
|
||||||
|
|
||||||
#include "m17/ax25_frame.h"
|
#include "m17/ax25_frame.h"
|
||||||
|
#include "m17demod.h"
|
||||||
#include "m17demodprocessor.h"
|
#include "m17demodprocessor.h"
|
||||||
|
|
||||||
M17DemodProcessor* M17DemodProcessor::m_this = nullptr;
|
M17DemodProcessor* M17DemodProcessor::m_this = nullptr;
|
||||||
|
@ -36,7 +37,8 @@ M17DemodProcessor::M17DemodProcessor() :
|
||||||
m_demod(handle_frame),
|
m_demod(handle_frame),
|
||||||
m_audioFifo(nullptr),
|
m_audioFifo(nullptr),
|
||||||
m_audioMute(false),
|
m_audioMute(false),
|
||||||
m_volume(1.0f)
|
m_volume(1.0f),
|
||||||
|
m_demodInputMessageQueue(nullptr)
|
||||||
{
|
{
|
||||||
m_this = this;
|
m_this = this;
|
||||||
m_codec2 = ::codec2_create(CODEC2_MODE_3200);
|
m_codec2 = ::codec2_create(CODEC2_MODE_3200);
|
||||||
|
@ -359,7 +361,20 @@ bool M17DemodProcessor::decode_packet(mobilinkd::M17FrameDecoder::packet_buffer_
|
||||||
oss << *it;
|
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;
|
return true;
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "m17demodfilters.h"
|
#include "m17demodfilters.h"
|
||||||
|
|
||||||
class AudioFifo;
|
class AudioFifo;
|
||||||
|
class MessageQueue;
|
||||||
|
|
||||||
class M17DemodProcessor : public QObject
|
class M17DemodProcessor : public QObject
|
||||||
{
|
{
|
||||||
|
@ -45,6 +46,7 @@ public:
|
||||||
M17DemodProcessor();
|
M17DemodProcessor();
|
||||||
~M17DemodProcessor();
|
~M17DemodProcessor();
|
||||||
|
|
||||||
|
void setDemodInputMessageQueue(MessageQueue *messageQueue) { m_demodInputMessageQueue = messageQueue; }
|
||||||
void pushSample(qint16 sample);
|
void pushSample(qint16 sample);
|
||||||
void setDisplayLSF(bool displayLSF) { m_displayLSF = displayLSF; }
|
void setDisplayLSF(bool displayLSF) { m_displayLSF = displayLSF; }
|
||||||
void setNoiseBlanker(bool noiseBlanker) { m_noiseBlanker = noiseBlanker; }
|
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.
|
uint32_t m_lsfCount; // Incremented each time a new LSF is decoded. Reset when lock is lost.
|
||||||
StdPacketProtocol m_stdPacketProtocol;
|
StdPacketProtocol m_stdPacketProtocol;
|
||||||
|
|
||||||
|
MessageQueue *m_demodInputMessageQueue;
|
||||||
|
|
||||||
static bool handle_frame(mobilinkd::M17FrameDecoder::output_buffer_t const& frame, int viterbi_cost);
|
static bool handle_frame(mobilinkd::M17FrameDecoder::output_buffer_t const& frame, int viterbi_cost);
|
||||||
static void diagnostic_callback(
|
static void diagnostic_callback(
|
||||||
bool dcd,
|
bool dcd,
|
||||||
|
|
|
@ -99,6 +99,7 @@ public:
|
||||||
bool getStreamElsePacket() const { return m_m17DemodProcessor.getStreamElsePacket(); }
|
bool getStreamElsePacket() const { return m_m17DemodProcessor.getStreamElsePacket(); }
|
||||||
uint16_t getCRC() const { return m_m17DemodProcessor.getCRC(); }
|
uint16_t getCRC() const { return m_m17DemodProcessor.getCRC(); }
|
||||||
int getStdPacketProtocol() const { return (int) m_m17DemodProcessor.getStdPacketProtocol(); }
|
int getStdPacketProtocol() const { return (int) m_m17DemodProcessor.getStdPacketProtocol(); }
|
||||||
|
void setDemodInputMessageQueue(MessageQueue *messageQueue) { m_m17DemodProcessor.setDemodInputMessageQueue(messageQueue); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct MagSqLevelsStore
|
struct MagSqLevelsStore
|
||||||
|
|
Loading…
Reference in New Issue