1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

AIS, DSC, End-of-Train, Packet, Radiosonde: All packet date/time to come from File Input device or system clock.

This commit is contained in:
srcejon 2024-03-03 21:24:54 +00:00
parent ae64f2c652
commit 2a29a69a3e
44 changed files with 434 additions and 87 deletions

View File

@ -916,6 +916,8 @@ void AISDemodGUI::displaySettings()
ui->showSlotMap->setChecked(m_settings.m_showSlotMap);
ui->slotMapWidget->setVisible(m_settings.m_showSlotMap);
ui->useFileTime->setChecked(m_settings.m_useFileTime);
// Order and size columns
QHeaderView *header = ui->messages->horizontalHeader();
for (int i = 0; i < AISDEMOD_MESSAGE_COLUMNS; i++)
@ -1088,6 +1090,12 @@ void AISDemodGUI::on_logOpen_clicked()
}
}
void AISDemodGUI::on_useFileTime_toggled(bool checked)
{
m_settings.m_useFileTime = checked;
applySettings();
}
void AISDemodGUI::makeUIConnections()
{
QObject::connect(ui->deltaFrequency, &ValueDialZ::changed, this, &AISDemodGUI::on_deltaFrequency_changed);
@ -1105,6 +1113,7 @@ void AISDemodGUI::makeUIConnections()
QObject::connect(ui->logFilename, &QToolButton::clicked, this, &AISDemodGUI::on_logFilename_clicked);
QObject::connect(ui->logOpen, &QToolButton::clicked, this, &AISDemodGUI::on_logOpen_clicked);
QObject::connect(ui->showSlotMap, &ButtonSwitch::clicked, this, &AISDemodGUI::on_showSlotMap_clicked);
QObject::connect(ui->useFileTime, &ButtonSwitch::toggled, this, &AISDemodGUI::on_useFileTime_toggled);
}
void AISDemodGUI::updateAbsoluteCenterFrequency()

View File

@ -159,6 +159,7 @@ private slots:
void on_logFilename_clicked();
void on_logOpen_clicked();
void on_showSlotMap_clicked(bool checked=false);
void on_useFileTime_toggled(bool checked=false);
void filterRow(int row);
void filter();
void messages_sectionMoved(int logicalIndex, int oldVisualIndex, int newVisualIndex);

View File

@ -557,6 +557,27 @@
</property>
</spacer>
</item>
<item>
<widget class="ButtonSwitch" name="useFileTime">
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Check to use date and time from input file. Uncheck to use date and time from clock.</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/clockcurrent.png</normaloff>
<normalon>:/clockfile.png</normalon>:/clockcurrent.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="showSlotMap">
<property name="maximumSize">
@ -958,18 +979,18 @@
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>RollupContents</class>
<extends>QWidget</extends>
<header>gui/rollupcontents.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>RollupContents</class>
<extends>QWidget</extends>
<header>gui/rollupcontents.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>LevelMeterSignalDB</class>
<extends>QWidget</extends>

View File

@ -48,6 +48,7 @@ void AISDemodSettings::resetToDefaults()
m_logFilename = "ais_log.csv";
m_logEnabled = false;
m_showSlotMap = false;
m_useFileTime = false;
m_rgbColor = QColor(102, 0, 0).rgb();
m_title = "AIS Demodulator";
m_streamIndex = 0;
@ -105,6 +106,7 @@ QByteArray AISDemodSettings::serialize() const
s.writeBlob(27, m_geometryBytes);
s.writeBool(28, m_hidden);
s.writeBool(29, m_showSlotMap);
s.writeBool(30, m_useFileTime);
for (int i = 0; i < AISDEMOD_MESSAGE_COLUMNS; i++)
s.writeS32(100 + i, m_messageColumnIndexes[i]);
@ -191,6 +193,7 @@ bool AISDemodSettings::deserialize(const QByteArray& data)
d.readBlob(27, &m_geometryBytes);
d.readBool(28, &m_hidden, false);
d.readBool(29, &m_showSlotMap, false);
d.readBool(30, &m_useFileTime, false);
for (int i = 0; i < AISDEMOD_MESSAGE_COLUMNS; i++) {
d.readS32(100 + i, &m_messageColumnIndexes[i], i);

View File

@ -50,6 +50,7 @@ struct AISDemodSettings
QString m_logFilename;
bool m_logEnabled;
bool m_showSlotMap;
bool m_useFileTime;
quint32 m_rgbColor;
QString m_title;

View File

@ -23,6 +23,8 @@
#include "dsp/dspengine.h"
#include "dsp/datafifo.h"
#include "dsp/scopevis.h"
#include "device/deviceapi.h"
#include "channel/channelwebapiutils.h"
#include "util/db.h"
#include "util/stepfunctions.h"
#include "maincore.h"
@ -264,6 +266,21 @@ void AISDemodSink::processOneSample(Complex &ci)
// This is unlikely to be accurate in absolute terms, given we don't know latency from SDR or buffering within SDRangel
// But can be used to get an idea of congestion
QDateTime currentTime = QDateTime::currentDateTime();
if (m_settings.m_useFileTime)
{
QString hardwareId = m_aisDemod->getDeviceAPI()->getHardwareId();
if ((hardwareId == "FileInput") || (hardwareId == "SigMFFileInput"))
{
QString dateTimeStr;
int deviceIdx = m_aisDemod->getDeviceSetIndex();
if (ChannelWebAPIUtils::getDeviceReportValue(deviceIdx, "absoluteTime", dateTimeStr)) {
currentTime = QDateTime::fromString(dateTimeStr, Qt::ISODateWithMs);
}
}
}
int txTimeMs = (totalBitCount + 8 + 24 + 8) * (1000.0 / m_settings.m_baud); // Add ramp up, preamble and start-flag
QDateTime startDateTime = currentTime.addMSecs(-txTimeMs);
int ms = startDateTime.time().second() * 1000 + startDateTime.time().msec();

View File

@ -56,7 +56,7 @@ Pressing this button clears all messages from the table.
<h3>9: UDP</h3>
When checked, received messages are forwarded to the specified UDP address (12) and port (13).
When checked, received messages are forwarded to the specified UDP address (10) and port (11).
<h3>10: UDP address</h3>
@ -70,17 +70,22 @@ UDP port number to forward received messages to.
The format the messages are forwarded via UDP in. This can be either binary (which is useful for SDRangel's PERTester feature) or NMEA (which is useful for 3rd party applications such as OpenCPN).
<h3>13: Start/stop Logging Messages to .csv File</h3>
<h3>13: Use Date and Time from File</h3>
When checked, if the source device is a File Input device, the date and time used for
packet reception time is taken from the file playback time. Otherwise, the current system clock time is used.
<h3>14: Start/stop Logging Messages to .csv File</h3>
When checked, writes all received AIS messages to a .csv file.
<h3>14: .csv Log Filename</h3>
<h3>15: .csv Log Filename</h3>
Click to specify the name of the .csv file which received AIS messages are logged to.
<h3>15: Read Data from .csv File</h3>
<h3>16: Read Data from .csv File</h3>
Click to specify a previously written AIS .csv log file, which is read and used to update the table.
Click to specify a previously written .csv log file, which is read and used to update the table.
<h3>Slot Map</h3>

View File

@ -1009,6 +1009,7 @@ void DSCDemodGUI::displaySettings()
ui->logFilename->setToolTip(QString(".csv log filename: %1").arg(m_settings.m_logFilename));
ui->logEnable->setChecked(m_settings.m_logEnabled);
ui->useFileTime->setChecked(m_settings.m_useFileTime);
ui->feed->setChecked(m_settings.m_feed);
// Order and size columns
@ -1169,6 +1170,12 @@ void DSCDemodGUI::on_logOpen_clicked()
}
}
void DSCDemodGUI::on_useFileTime_toggled(bool checked)
{
m_settings.m_useFileTime = checked;
applySettings();
}
void DSCDemodGUI::makeUIConnections()
{
QObject::connect(ui->deltaFrequency, &ValueDialZ::changed, this, &DSCDemodGUI::on_deltaFrequency_changed);
@ -1183,6 +1190,7 @@ void DSCDemodGUI::makeUIConnections()
QObject::connect(ui->logFilename, &QToolButton::clicked, this, &DSCDemodGUI::on_logFilename_clicked);
QObject::connect(ui->logOpen, &QToolButton::clicked, this, &DSCDemodGUI::on_logOpen_clicked);
QObject::connect(ui->feed, &ButtonSwitch::clicked, this, &DSCDemodGUI::on_feed_clicked);
QObject::connect(ui->useFileTime, &ButtonSwitch::toggled, this, &DSCDemodGUI::on_useFileTime_toggled);
}
void DSCDemodGUI::updateAbsoluteCenterFrequency()

View File

@ -151,6 +151,7 @@ private slots:
void on_logEnable_clicked(bool checked=false);
void on_logFilename_clicked();
void on_logOpen_clicked();
void on_useFileTime_toggled(bool checked=false);
void on_feed_clicked(bool checked=false);
void on_feed_rightClicked(const QPoint &point);
void filterRow(int row);

View File

@ -545,6 +545,27 @@
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="useFileTime">
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Check to use date and time from input file. Uncheck to use date and time from clock.</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/clockcurrent.png</normaloff>
<normalon>:/clockfile.png</normalon>:/clockcurrent.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="logEnable">
<property name="maximumSize">
@ -934,18 +955,18 @@
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>RollupContents</class>
<extends>QWidget</extends>
<header>gui/rollupcontents.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>RollupContents</class>
<extends>QWidget</extends>
<header>gui/rollupcontents.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>LevelMeterSignalDB</class>
<extends>QWidget</extends>

View File

@ -46,6 +46,7 @@ void DSCDemodSettings::resetToDefaults()
m_logFilename = "dsc_log.csv";
m_logEnabled = false;
m_feed = true;
m_useFileTime = false;
m_rgbColor = QColor(181, 230, 29).rgb();
m_title = "DSC Demodulator";
@ -85,6 +86,7 @@ QByteArray DSCDemodSettings::serialize() const
s.writeString(12, m_logFilename);
s.writeBool(13, m_logEnabled);
s.writeBool(14, m_feed);
s.writeBool(15, m_useFileTime);
s.writeU32(20, m_rgbColor);
s.writeString(21, m_title);
@ -155,6 +157,7 @@ bool DSCDemodSettings::deserialize(const QByteArray& data)
d.readString(12, &m_logFilename, "dsc_log.csv");
d.readBool(13, &m_logEnabled, false);
d.readBool(14, &m_feed, true);
d.readBool(15, &m_useFileTime, false);
d.readU32(20, &m_rgbColor, QColor(181, 230, 29).rgb());
d.readString(21, &m_title, "DSC Demodulator");

View File

@ -52,6 +52,8 @@ struct DSCDemodSettings
QString m_logFilename;
bool m_logEnabled;
bool m_useFileTime;
Serializable *m_scopeGUI;
Serializable *m_rollupState;
int m_workspaceIndex;

View File

@ -21,8 +21,10 @@
#include "dsp/dspengine.h"
#include "dsp/scopevis.h"
#include "device/deviceapi.h"
#include "util/db.h"
#include "util/popcount.h"
#include "channel/channelwebapiutils.h"
#include "maincore.h"
#include "dscdemod.h"
@ -240,8 +242,25 @@ void DSCDemodSink::receiveBit(bool bit)
{
if (m_dscDecoder.decodeBits(m_bits & 0x3ff))
{
QDateTime dateTime = QDateTime::currentDateTime();
if (m_settings.m_useFileTime)
{
QString hardwareId = m_dscDemod->getDeviceAPI()->getHardwareId();
if ((hardwareId == "FileInput") || (hardwareId == "SigMFFileInput"))
{
QString dateTimeStr;
int deviceIdx = m_dscDemod->getDeviceSetIndex();
if (ChannelWebAPIUtils::getDeviceReportValue(deviceIdx, "absoluteTime", dateTimeStr)) {
dateTime = QDateTime::fromString(dateTimeStr, Qt::ISODateWithMs);
}
}
}
QByteArray bytes = m_dscDecoder.getMessage();
DSCMessage message(bytes, QDateTime::currentDateTime());
DSCMessage message(bytes, dateTime);
//qDebug() << "RX Bytes: " << bytes.toHex();
//qDebug() << "DSC Message: " << message.toString();

View File

@ -60,19 +60,24 @@ The messages are submitted with Preferences > My Position... > Station name used
Right click to open http://yaddnet.org/ in your browser, showing recent messages received from this ID.
<h3>11: Start/stop Logging Messages to .csv File</h3>
<h3>11: Use Date and Time from File</h3>
When checked, writes all received messages to a .csv file, specified by (12).
When checked, if the source device is a File Input device, the date and time used for
packet reception time is taken from the file playback time. Otherwise, the current system clock time is used.
<h3>12: .csv Log Filename</h3>
<h3>12: Start/stop Logging Messages to .csv File</h3>
When checked, writes all received messages to a .csv file, specified by (13).
<h3>13: .csv Log Filename</h3>
Click to specify the name of the .csv file which received messasges are logged to.
<h3>13: Read Data from .csv File</h3>
<h3>14: Read Data from .csv File</h3>
Click to specify a previously written .csv log file, which is read and used to update the table.
<h3>14: Received Messages Table</h3>
<h3>15: Received Messages Table</h3>
![DSC Demodulator plugin GUI](../../../doc/img/DSCDemod_plugin_messages.png)

View File

@ -511,6 +511,8 @@ EndOfTrainDemodGUI::EndOfTrainDemodGUI(PluginAPI* pluginAPI, DeviceUISet *device
connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor()));
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
ui->scopeContainer->setVisible(false);
// Resize the table using dummy data
resizeTable();
// Allow user to reorder columns
@ -601,6 +603,8 @@ void EndOfTrainDemodGUI::displaySettings()
ui->logFilename->setToolTip(QString(".csv log filename: %1").arg(m_settings.m_logFilename));
ui->logEnable->setChecked(m_settings.m_logEnabled);
ui->useFileTime->setChecked(m_settings.m_useFileTime);
// Order and size columns
QHeaderView *header = ui->packets->horizontalHeader();
for (int i = 0; i < ENDOFTRAINDEMOD_COLUMNS; i++)
@ -739,6 +743,12 @@ void EndOfTrainDemodGUI::on_logOpen_clicked()
}
}
void EndOfTrainDemodGUI::on_useFileTime_toggled(bool checked)
{
m_settings.m_useFileTime = checked;
applySetting("useFileTime");
}
void EndOfTrainDemodGUI::makeUIConnections()
{
QObject::connect(ui->deltaFrequency, &ValueDialZ::changed, this, &EndOfTrainDemodGUI::on_deltaFrequency_changed);
@ -752,6 +762,7 @@ void EndOfTrainDemodGUI::makeUIConnections()
QObject::connect(ui->logEnable, &ButtonSwitch::clicked, this, &EndOfTrainDemodGUI::on_logEnable_clicked);
QObject::connect(ui->logFilename, &QToolButton::clicked, this, &EndOfTrainDemodGUI::on_logFilename_clicked);
QObject::connect(ui->logOpen, &QToolButton::clicked, this, &EndOfTrainDemodGUI::on_logOpen_clicked);
QObject::connect(ui->useFileTime, &ButtonSwitch::toggled, this, &EndOfTrainDemodGUI::on_useFileTime_toggled);
}
void EndOfTrainDemodGUI::updateAbsoluteCenterFrequency()

View File

@ -137,6 +137,7 @@ private slots:
void on_logEnable_clicked(bool checked=false);
void on_logFilename_clicked();
void on_logOpen_clicked();
void on_useFileTime_toggled(bool checked=false);
void filterRow(int row);
void filter();
void endoftrains_sectionMoved(int logicalIndex, int oldVisualIndex, int newVisualIndex);

View File

@ -498,6 +498,27 @@
</property>
</spacer>
</item>
<item>
<widget class="ButtonSwitch" name="useFileTime">
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Check to use date and time from input file. Uncheck to use date and time from clock.</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/clockcurrent.png</normaloff>
<normalon>:/clockfile.png</normalon>:/clockcurrent.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="logEnable">
<property name="maximumSize">

View File

@ -47,8 +47,9 @@ void EndOfTrainDemodSettings::resetToDefaults()
m_udpPort = 9999;
m_logFilename = "endoftrain_log.csv";
m_logEnabled = false;
m_useFileTime = false;
m_rgbColor = QColor(0, 105, 2).rgb();
m_rgbColor = QColor(170, 85, 0).rgb();
m_title = "End-of-Train Demodulator";
m_streamIndex = 0;
m_useReverseAPI = false;
@ -79,6 +80,7 @@ QByteArray EndOfTrainDemodSettings::serialize() const
s.writeU32(7, m_udpPort);
s.writeString(8, m_logFilename);
s.writeBool(9, m_logEnabled);
s.writeBool(10, m_useFileTime);
s.writeU32(20, m_rgbColor);
s.writeString(21, m_title);
@ -134,8 +136,9 @@ bool EndOfTrainDemodSettings::deserialize(const QByteArray& data)
}
d.readString(8, &m_logFilename, "endoftrain_log.csv");
d.readBool(9, &m_logEnabled, false);
d.readBool(10, &m_useFileTime, false);
d.readU32(20, &m_rgbColor, QColor(0, 105, 2).rgb());
d.readU32(20, &m_rgbColor, QColor(170, 85, 0).rgb());
d.readString(21, &m_title, "End-of-Train Demodulator");
if (m_channelMarker)
{
@ -206,9 +209,12 @@ void EndOfTrainDemodSettings::applySettings(const QStringList& settingsKeys, con
if (settingsKeys.contains("logFilename")) {
m_logFilename = settings.m_logFilename;
}
if (settingsKeys.contains("logEnabledpPort")) {
if (settingsKeys.contains("logEnabled")) {
m_logEnabled = settings.m_logEnabled;
}
if (settingsKeys.contains("useFileTime")) {
m_useFileTime = settings.m_useFileTime;
}
if (settingsKeys.contains("rgbColor")) {
m_rgbColor = settings.m_rgbColor;
}
@ -275,9 +281,12 @@ QString EndOfTrainDemodSettings::getDebugString(const QStringList& settingsKeys,
if (settingsKeys.contains("logFilename")) {
ostr << " m_logFilename: " << m_logFilename.toStdString();
}
if (settingsKeys.contains("logEnabledpPort")) {
if (settingsKeys.contains("logEnabledp")) {
ostr << " m_logEnabled: " << m_logEnabled;
}
if (settingsKeys.contains("useFileTime")) {
ostr << " m_useFileTime: " << m_useFileTime;
}
if (settingsKeys.contains("rgbColor") || force) {
ostr << " m_rgbColor: " << m_rgbColor;
}

View File

@ -42,6 +42,7 @@ struct EndOfTrainDemodSettings
uint16_t m_udpPort;
QString m_logFilename;
bool m_logEnabled;
bool m_useFileTime;
quint32 m_rgbColor;
QString m_title;

View File

@ -20,7 +20,9 @@
#include "dsp/dspengine.h"
#include "dsp/datafifo.h"
#include "device/deviceapi.h"
#include "util/db.h"
#include "channel/channelwebapiutils.h"
#include "maincore.h"
#include "endoftraindemod.h"
@ -214,7 +216,23 @@ void EndOfTrainDemodSink::processOneSample(Complex &ci)
//qDebug() << "RX: " << rxPacket.toHex();
if (getMessageQueueToChannel())
{
MainCore::MsgPacket *msg = MainCore::MsgPacket::create(m_endoftrainDemod, rxPacket, QDateTime::currentDateTime());
QDateTime dateTime = QDateTime::currentDateTime();
if (m_settings.m_useFileTime)
{
QString hardwareId = m_endoftrainDemod->getDeviceAPI()->getHardwareId();
if ((hardwareId == "FileInput") || (hardwareId == "SigMFFileInput"))
{
QString dateTimeStr;
int deviceIdx = m_endoftrainDemod->getDeviceSetIndex();
if (ChannelWebAPIUtils::getDeviceReportValue(deviceIdx, "absoluteTime", dateTimeStr)) {
dateTime = QDateTime::fromString(dateTimeStr, Qt::ISODateWithMs);
}
}
}
MainCore::MsgPacket *msg = MainCore::MsgPacket::create(m_endoftrainDemod, rxPacket, dateTime);
getMessageQueueToChannel()->push(msg);
}
// Reset state to start receiving next packet

View File

@ -58,19 +58,24 @@ IP address of the host to forward received packets to via UDP.
UDP port number to forward received packets to.
<h3>10: Start/stop Logging Packets to .csv File</h3>
<h3>10: Use Date and Time from File</h3>
When checked, writes all received packets to a .csv file. The filename is specified by (11).
When checked, if the source device is a File Input device, the date and time used for
packet reception time is taken from the file playback time. Otherwise, the current system clock time is used.
<h3>11: .csv Log Filename</h3>
<h3>11: Start/stop Logging Packets to .csv File</h3>
When checked, writes all received packets to a .csv file. The filename is specified by (12).
<h3>12: .csv Log Filename</h3>
Click to specify the name of the .csv file which received packets are logged to.
<h3>12: Read Data from .csv File</h3>
<h3>13: Read Data from .csv File</h3>
Click to specify a previously written .csv log file, which is read and used to update the table.
<h3>13: Clear table</h3>
<h3>14: Clear table</h3>
Pressing this button clears all packets from the table.
@ -98,3 +103,5 @@ The received packets table displays the contents of the packets that have been r
<h2>Attribution</h2>
Based on code and reverse engineering by Eric Reuter
Clock icons created by Pixel perfect from Flaticon https:://www.flaticon.com

View File

@ -16,10 +16,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include <limits>
#include <ctype.h>
#include <QDockWidget>
#include <QMainWindow>
#include <QDebug>
#include <QMessageBox>
#include <QAction>
@ -38,7 +34,6 @@
#include "util/simpleserializer.h"
#include "util/csv.h"
#include "util/db.h"
#include "util/morse.h"
#include "util/units.h"
#include "gui/basicchannelsettingsdialog.h"
#include "gui/devicestreamselectiondialog.h"
@ -51,20 +46,14 @@
#include "packetdemod.h"
#include "packetdemodsink.h"
#define PACKET_COL_FROM 0
#define PACKET_COL_TO 1
#define PACKET_COL_VIA 2
#define PACKET_COL_TYPE 3
#define PACKET_COL_PID 4
#define PACKET_COL_DATA_ASCII 5
#define PACKET_COL_DATA_HEX 6
void PacketDemodGUI::resizeTable()
{
// Fill table with a row of dummy data that will size the columns nicely
// Trailing spaces are for sort arrow
int row = ui->packets->rowCount();
ui->packets->setRowCount(row + 1);
ui->packets->setItem(row, PACKET_COL_DATE, new QTableWidgetItem("Frid Apr 15 2016-"));
ui->packets->setItem(row, PACKET_COL_TIME, new QTableWidgetItem("10:17:00"));
ui->packets->setItem(row, PACKET_COL_FROM, new QTableWidgetItem("123456-15-"));
ui->packets->setItem(row, PACKET_COL_TO, new QTableWidgetItem("123456-15-"));
ui->packets->setItem(row, PACKET_COL_VIA, new QTableWidgetItem("123456-15-"));
@ -158,7 +147,7 @@ bool PacketDemodGUI::deserialize(const QByteArray& data)
}
// Add row to table
void PacketDemodGUI::packetReceived(QByteArray packet)
void PacketDemodGUI::packetReceived(const QByteArray& packet, QDateTime dateTime)
{
AX25Packet ax25;
@ -172,6 +161,8 @@ void PacketDemodGUI::packetReceived(QByteArray packet)
int row = ui->packets->rowCount();
ui->packets->setRowCount(row + 1);
QTableWidgetItem *dateItem = new QTableWidgetItem();
QTableWidgetItem *timeItem = new QTableWidgetItem();
QTableWidgetItem *fromItem = new QTableWidgetItem();
QTableWidgetItem *toItem = new QTableWidgetItem();
QTableWidgetItem *viaItem = new QTableWidgetItem();
@ -179,6 +170,8 @@ void PacketDemodGUI::packetReceived(QByteArray packet)
QTableWidgetItem *pidItem = new QTableWidgetItem();
QTableWidgetItem *dataASCIIItem = new QTableWidgetItem();
QTableWidgetItem *dataHexItem = new QTableWidgetItem();
ui->packets->setItem(row, PACKET_COL_DATE, dateItem);
ui->packets->setItem(row, PACKET_COL_TIME, timeItem);
ui->packets->setItem(row, PACKET_COL_FROM, fromItem);
ui->packets->setItem(row, PACKET_COL_TO, toItem);
ui->packets->setItem(row, PACKET_COL_VIA, viaItem);
@ -186,6 +179,8 @@ void PacketDemodGUI::packetReceived(QByteArray packet)
ui->packets->setItem(row, PACKET_COL_PID, pidItem);
ui->packets->setItem(row, PACKET_COL_DATA_ASCII, dataASCIIItem);
ui->packets->setItem(row, PACKET_COL_DATA_HEX, dataHexItem);
dateItem->setText(dateTime.date().toString());
timeItem->setText(dateTime.time().toString());
fromItem->setText(ax25.m_from);
toItem->setText(ax25.m_to);
viaItem->setText(ax25.m_via);
@ -229,7 +224,7 @@ bool PacketDemodGUI::handleMessage(const Message& message)
else if (MainCore::MsgPacket::match(message))
{
MainCore::MsgPacket& report = (MainCore::MsgPacket&) message;
packetReceived(report.getPacket());
packetReceived(report.getPacket(), report.getDateTime());
return true;
}
@ -554,6 +549,8 @@ void PacketDemodGUI::displaySettings()
ui->logFilename->setToolTip(QString(".csv log filename: %1").arg(m_settings.m_logFilename));
ui->logEnable->setChecked(m_settings.m_logEnabled);
ui->useFileTime->setChecked(m_settings.m_useFileTime);
// Order and size columns
QHeaderView *header = ui->packets->horizontalHeader();
for (int i = 0; i < PACKETDEMOD_COLUMNS; i++)
@ -666,7 +663,7 @@ void PacketDemodGUI::on_logOpen_clicked()
QTime time = QTime::fromString(cols[timeCol]);
QDateTime dateTime(date, time);
QByteArray bytes = QByteArray::fromHex(cols[dataCol].toLatin1());
packetReceived(bytes);
packetReceived(bytes, dateTime);
if (count % 1000 == 0)
{
QApplication::processEvents();
@ -692,6 +689,12 @@ void PacketDemodGUI::on_logOpen_clicked()
}
}
void PacketDemodGUI::on_useFileTime_toggled(bool checked)
{
m_settings.m_useFileTime = checked;
applySettings();
}
void PacketDemodGUI::makeUIConnections()
{
QObject::connect(ui->deltaFrequency, &ValueDialZ::changed, this, &PacketDemodGUI::on_deltaFrequency_changed);
@ -708,6 +711,7 @@ void PacketDemodGUI::makeUIConnections()
QObject::connect(ui->logEnable, &ButtonSwitch::clicked, this, &PacketDemodGUI::on_logEnable_clicked);
QObject::connect(ui->logFilename, &QToolButton::clicked, this, &PacketDemodGUI::on_logFilename_clicked);
QObject::connect(ui->logOpen, &QToolButton::clicked, this, &PacketDemodGUI::on_logOpen_clicked);
QObject::connect(ui->useFileTime, &ButtonSwitch::toggled, this, &PacketDemodGUI::on_useFileTime_toggled);
}
void PacketDemodGUI::updateAbsoluteCenterFrequency()

View File

@ -97,7 +97,7 @@ private:
void blockApplySettings(bool block);
void applySettings(bool force = false);
void displaySettings();
void packetReceived(QByteArray packet);
void packetReceived(const QByteArray& packet, QDateTime dateTime);
bool handleMessage(const Message& message);
void makeUIConnections();
void updateAbsoluteCenterFrequency();
@ -108,6 +108,18 @@ private:
void resizeTable();
QAction *createCheckableItem(QString& text, int idx, bool checked);
enum PacketCol {
PACKET_COL_DATE,
PACKET_COL_TIME,
PACKET_COL_FROM,
PACKET_COL_TO,
PACKET_COL_VIA,
PACKET_COL_TYPE,
PACKET_COL_PID,
PACKET_COL_DATA_ASCII,
PACKET_COL_DATA_HEX
};
private slots:
void on_deltaFrequency_changed(qint64 value);
void on_mode_currentIndexChanged(int value);
@ -123,6 +135,7 @@ private slots:
void on_logEnable_clicked(bool checked=false);
void on_logFilename_clicked();
void on_logOpen_clicked();
void on_useFileTime_toggled(bool checked=false);
void filterRow(int row);
void filter();
void packets_sectionMoved(int logicalIndex, int oldVisualIndex, int newVisualIndex);

View File

@ -385,6 +385,13 @@
</item>
<item>
<layout class="QHBoxLayout" name="udpLayout">
<item>
<widget class="QLabel" name="udpEnabledLabel">
<property name="text">
<string>UDP</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="udpEnabled">
<property name="toolTip">
@ -394,7 +401,7 @@
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>UDP</string>
<string/>
</property>
</widget>
</item>
@ -536,6 +543,27 @@
</property>
</spacer>
</item>
<item>
<widget class="ButtonSwitch" name="useFileTime">
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Check to use date and time from input file. Uncheck to use date and time from clock.</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/clockcurrent.png</normaloff>
<normalon>:/clockfile.png</normalon>:/clockcurrent.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="logEnable">
<property name="maximumSize">
@ -650,6 +678,22 @@
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<column>
<property name="text">
<string>Date</string>
</property>
<property name="toolTip">
<string>Date packet was received</string>
</property>
</column>
<column>
<property name="text">
<string>Time</string>
</property>
<property name="toolTip">
<string>Time packet was received</string>
</property>
</column>
<column>
<property name="text">
<string>From</string>
@ -713,10 +757,9 @@
</widget>
<customwidgets>
<customwidget>
<class>RollupContents</class>
<extends>QWidget</extends>
<header>gui/rollupcontents.h</header>
<container>1</container>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>ValueDialZ</class>
@ -724,17 +767,18 @@
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>RollupContents</class>
<extends>QWidget</extends>
<header>gui/rollupcontents.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>LevelMeterSignalDB</class>
<extends>QWidget</extends>
<header>gui/levelmeter.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>packets</tabstop>

View File

@ -46,6 +46,7 @@ void PacketDemodSettings::resetToDefaults()
m_udpPort = 9999;
m_logFilename = "packet_log.csv";
m_logEnabled = false;
m_useFileTime = false;
m_rgbColor = QColor(0, 105, 2).rgb();
m_title = "Packet Demodulator";
@ -103,6 +104,8 @@ QByteArray PacketDemodSettings::serialize() const
s.writeBlob(29, m_geometryBytes);
s.writeBool(30, m_hidden);
s.writeBool(31, m_useFileTime);
for (int i = 0; i < PACKETDEMOD_COLUMNS; i++) {
s.writeS32(100 + i, m_columnIndexes[i]);
}
@ -185,6 +188,8 @@ bool PacketDemodSettings::deserialize(const QByteArray& data)
d.readBlob(29, &m_geometryBytes);
d.readBool(30, &m_hidden, false);
d.readBool(31, &m_useFileTime, false);
for (int i = 0; i < PACKETDEMOD_COLUMNS; i++) {
d.readS32(100 + i, &m_columnIndexes[i], i);
}

View File

@ -27,7 +27,7 @@
class Serializable;
// Number of columns in the table
#define PACKETDEMOD_COLUMNS 7
#define PACKETDEMOD_COLUMNS 9
struct PacketDemodSettings
{
@ -45,6 +45,7 @@ struct PacketDemodSettings
bool m_udpEnabled;
QString m_udpAddress;
uint16_t m_udpPort;
bool m_useFileTime;
quint32 m_rgbColor;
QString m_title;

View File

@ -22,8 +22,10 @@
#include "dsp/dspengine.h"
#include "dsp/datafifo.h"
#include "device/deviceapi.h"
#include "util/db.h"
#include "util/stepfunctions.h"
#include "channel/channelwebapiutils.h"
#include "maincore.h"
#include "packetdemod.h"
@ -191,7 +193,23 @@ void PacketDemodSink::processOneSample(Complex &ci)
qDebug() << "RX: " << rxPacket.toHex();
if (getMessageQueueToChannel())
{
MainCore::MsgPacket *msg = MainCore::MsgPacket::create(m_packetDemod, rxPacket, QDateTime::currentDateTime()); // FIXME pointer
QDateTime dateTime = QDateTime::currentDateTime();
if (m_settings.m_useFileTime)
{
QString hardwareId = m_packetDemod->getDeviceAPI()->getHardwareId();
if ((hardwareId == "FileInput") || (hardwareId == "SigMFFileInput"))
{
QString dateTimeStr;
int deviceIdx = m_packetDemod->getDeviceSetIndex();
if (ChannelWebAPIUtils::getDeviceReportValue(deviceIdx, "absoluteTime", dateTimeStr)) {
dateTime = QDateTime::fromString(dateTimeStr, Qt::ISODateWithMs);
}
}
}
MainCore::MsgPacket *msg = MainCore::MsgPacket::create(m_packetDemod, rxPacket, dateTime);
getMessageQueueToChannel()->push(msg);
}
}

View File

@ -1,4 +1,4 @@
<h1>Packet radio demodulator plugin</h1>
<h1>Packet Radio Demodulator Plugin</h1>
<h2>Introduction</h2>
@ -60,19 +60,24 @@ When checked, received packets are forwarded to the specified UDP address (12) a
IP address of the host to forward received packets to via UDP.
<h3>11: UDP port</h3>
<h3>13: UDP port</h3>
UDP port number to forward received packets to.
<h3>12: Start/stop Logging Packets to .csv File</h3>
<h3>14: Use Date and Time from File</h3>
When checked, if the source device is a File Input device, the date and time used for
packet reception time is taken from the file playback time. Otherwise, the current system clock time is used.
<h3>15: Start/stop Logging Packets to .csv File</h3>
When checked, writes all received packets to a .csv file.
<h3>13: .csv Log Filename</h3>
<h3>16: .csv Log Filename</h3>
Click to specify the name of the .csv file which received packets are logged to.
<h3>14: Read Data from .csv File</h3>
<h3>17: Read Data from .csv File</h3>
Click to specify a previously written .csv log file, which is read and used to update the table.
@ -80,6 +85,8 @@ Click to specify a previously written .csv log file, which is read and used to u
The received packets table displays the contents of the packets that have been received. Only packets with valid CRCs are displayed.
* Date - The date the packet was received.
* Time - The time the packet was received.
* From - The source address / callsign of the sender of the packet.
* To - The destination address.
* Via - List of addresses of repeaters the packet has passed through or directed via.

View File

@ -82,9 +82,9 @@ public:
int getErrorsCorrected() const { return m_errorsCorrected; }
int getThreshold() const { return m_threshold; }
static MsgMessage* create(QByteArray message, int errorsCorrected, int threshold)
static MsgMessage* create(const QByteArray& message, QDateTime dateTime, int errorsCorrected, int threshold)
{
return new MsgMessage(message, QDateTime::currentDateTime(), errorsCorrected, threshold);
return new MsgMessage(message, dateTime, errorsCorrected, threshold);
}
private:
@ -93,7 +93,7 @@ public:
int m_errorsCorrected;
int m_threshold;
MsgMessage(QByteArray message, QDateTime dateTime, int errorsCorrected, int threshold) :
MsgMessage(const QByteArray& message, QDateTime dateTime, int errorsCorrected, int threshold) :
Message(),
m_message(message),
m_dateTime(dateTime),

View File

@ -771,6 +771,8 @@ void RadiosondeDemodGUI::displaySettings()
ui->logFilename->setToolTip(QString(".csv log filename: %1").arg(m_settings.m_logFilename));
ui->logEnable->setChecked(m_settings.m_logEnabled);
ui->useFileTime->setChecked(m_settings.m_useFileTime);
// Order and size columns
QHeaderView *header = ui->frames->horizontalHeader();
for (int i = 0; i < RADIOSONDEDEMOD_FRAME_COLUMNS; i++)
@ -924,6 +926,12 @@ void RadiosondeDemodGUI::on_logOpen_clicked()
}
}
void RadiosondeDemodGUI::on_useFileTime_toggled(bool checked)
{
m_settings.m_useFileTime = checked;
applySettings();
}
void RadiosondeDemodGUI::makeUIConnections()
{
QObject::connect(ui->deltaFrequency, &ValueDialZ::changed, this, &RadiosondeDemodGUI::on_deltaFrequency_changed);
@ -939,6 +947,7 @@ void RadiosondeDemodGUI::makeUIConnections()
QObject::connect(ui->logEnable, &ButtonSwitch::clicked, this, &RadiosondeDemodGUI::on_logEnable_clicked);
QObject::connect(ui->logFilename, &QToolButton::clicked, this, &RadiosondeDemodGUI::on_logFilename_clicked);
QObject::connect(ui->logOpen, &QToolButton::clicked, this, &RadiosondeDemodGUI::on_logOpen_clicked);
QObject::connect(ui->useFileTime, &ButtonSwitch::toggled, this, &RadiosondeDemodGUI::on_useFileTime_toggled);
}
void RadiosondeDemodGUI::updateAbsoluteCenterFrequency()

View File

@ -154,6 +154,7 @@ private slots:
void on_logEnable_clicked(bool checked=false);
void on_logFilename_clicked();
void on_logOpen_clicked();
void on_useFileTime_toggled(bool checked=false);
void filterRow(int row);
void filter();
void frames_sectionMoved(int logicalIndex, int oldVisualIndex, int newVisualIndex);

View File

@ -524,6 +524,27 @@
</property>
</spacer>
</item>
<item>
<widget class="ButtonSwitch" name="useFileTime">
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Check to use date and time from input file. Uncheck to use date and time from clock.</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/clockcurrent.png</normaloff>
<normalon>:/clockfile.png</normalon>:/clockcurrent.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="logEnable">
<property name="maximumSize">
@ -1076,29 +1097,29 @@
</widget>
</widget>
<customwidgets>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>RollupContents</class>
<extends>QWidget</extends>
<header>gui/rollupcontents.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>LevelMeterSignalDB</class>
<extends>QWidget</extends>
<header>gui/levelmeter.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GLScope</class>
<extends>QWidget</extends>

View File

@ -48,6 +48,7 @@ void RadiosondeDemodSettings::resetToDefaults()
m_scopeCh2 = 6;
m_logFilename = "radiosonde_log.csv";
m_logEnabled = false;
m_useFileTime = false;
m_rgbColor = QColor(102, 0, 102).rgb();
m_title = "Radiosonde Demodulator";
m_streamIndex = 0;
@ -106,6 +107,8 @@ QByteArray RadiosondeDemodSettings::serialize() const
s.writeBlob(27, m_geometryBytes);
s.writeBool(28, m_hidden);
s.writeBool(29, m_useFileTime);
for (int i = 0; i < RADIOSONDEDEMOD_FRAME_COLUMNS; i++)
s.writeS32(100 + i, m_frameColumnIndexes[i]);
for (int i = 0; i < RADIOSONDEDEMOD_FRAME_COLUMNS; i++)
@ -192,6 +195,8 @@ bool RadiosondeDemodSettings::deserialize(const QByteArray& data)
d.readBlob(27, &m_geometryBytes);
d.readBool(28, &m_hidden, false);
d.readBool(29, &m_useFileTime, false);
for (int i = 0; i < RADIOSONDEDEMOD_FRAME_COLUMNS; i++) {
d.readS32(100 + i, &m_frameColumnIndexes[i], i);
}

View File

@ -47,6 +47,7 @@ struct RadiosondeDemodSettings
QString m_logFilename;
bool m_logEnabled;
bool m_useFileTime;
quint32 m_rgbColor;
QString m_title;

View File

@ -23,8 +23,10 @@
#include "dsp/dspengine.h"
#include "dsp/datafifo.h"
#include "dsp/scopevis.h"
#include "device/deviceapi.h"
#include "util/db.h"
#include "util/stepfunctions.h"
#include "channel/channelwebapiutils.h"
#include "util/reedsolomon.h"
#include "maincore.h"
@ -415,8 +417,23 @@ bool RadiosondeDemodSink::processFrame(int length, float corr, int sampleIdx)
{
if (getMessageQueueToChannel())
{
QDateTime dateTime = QDateTime::currentDateTime();
if (m_settings.m_useFileTime)
{
QString hardwareId = m_radiosondeDemod->getDeviceAPI()->getHardwareId();
if ((hardwareId == "FileInput") || (hardwareId == "SigMFFileInput"))
{
QString dateTimeStr;
int deviceIdx = m_radiosondeDemod->getDeviceSetIndex();
if (ChannelWebAPIUtils::getDeviceReportValue(deviceIdx, "absoluteTime", dateTimeStr)) {
dateTime = QDateTime::fromString(dateTimeStr, Qt::ISODateWithMs);
}
}
}
QByteArray rxPacket((char *)m_bytes, length);
RadiosondeDemod::MsgMessage *msg = RadiosondeDemod::MsgMessage::create(rxPacket, errorsCorrected, corr);
RadiosondeDemod::MsgMessage *msg = RadiosondeDemod::MsgMessage::create(rxPacket, dateTime, errorsCorrected, corr);
getMessageQueueToChannel()->push(msg);
}

View File

@ -1,4 +1,4 @@
<h1>Radiosonde demodulator plugin</h1>
<h1>Radiosonde Demodulator Plugin</h1>
<h2>Introduction</h2>
@ -56,19 +56,24 @@ UDP port number to forward received frames to.
Entering a regular expression in the Find field displays only frames where the radiosonde serial number matches the given regular expression.
<h3>11: Start/stop Logging Frames to .csv File</h3>
<h3>11: Use Date and Time from File</h3>
When checked, if the source device is a File Input device, the date and time used for
frame reception time is taken from the file playback time. Otherwise, the current system clock time is used.
<h3>12: Start/stop Logging Frames to .csv File</h3>
When checked, writes all received frames to a .csv file.
<h3>14: .csv Log Filename</h3>
<h3>13: .csv Log Filename</h3>
Click to specify the name of the .csv file which received frames are logged to.
<h3>15: Read Data from .csv File</h3>
<h3>14: Read Data from .csv File</h3>
Click to specify a previously written radiosonde .csv log file, which is read and used to update the table.
<h3>11: Clear Data from table</h3>
<h3>15: Clear Data from table</h3>
Pressing this button clears all data from the table.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -154,6 +154,8 @@
<file>stackvertical.png</file>
<file>stackcolumns.png</file>
<file>tab.png</file>
<file>clockfile.png</file>
<file>clockcurrent.png</file>
<file>LiberationMono-Regular.ttf</file>
<file>LiberationSans-Regular.ttf</file>
</qresource>

View File

@ -32,6 +32,8 @@ AISDemodSettings:
type: string
logEnabled:
type: integer
useFileTime:
type: integer
rgbColor:
type: integer
title:

View File

@ -23,6 +23,8 @@ DSCDemodSettings:
type: string
logEnabled:
type: integer
useFileTime:
type: integer
rgbColor:
type: integer
title:

View File

@ -23,6 +23,8 @@ EndOfTrainDemodSettings:
type: string
logEnabled:
type: integer
useFileTime:
type: integer
rgbColor:
type: integer
title:

View File

@ -28,6 +28,8 @@ PacketDemodSettings:
type: string
logEnabled:
type: integer
useFileTime:
type: integer
rgbColor:
type: integer
title:

View File

@ -29,6 +29,8 @@ RadiosondeDemodSettings:
type: string
logEnabled:
type: integer
useFileTime:
type: integer
rgbColor:
type: integer
title: