Browse Source

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

chirpmodem-v8.0.0
srcejon 3 years ago
parent
commit
2a29a69a3e
  1. 9
      plugins/channelrx/demodais/aisdemodgui.cpp
  2. 1
      plugins/channelrx/demodais/aisdemodgui.h
  3. 29
      plugins/channelrx/demodais/aisdemodgui.ui
  4. 3
      plugins/channelrx/demodais/aisdemodsettings.cpp
  5. 1
      plugins/channelrx/demodais/aisdemodsettings.h
  6. 17
      plugins/channelrx/demodais/aisdemodsink.cpp
  7. 15
      plugins/channelrx/demodais/readme.md
  8. 8
      plugins/channelrx/demoddsc/dscdemodgui.cpp
  9. 1
      plugins/channelrx/demoddsc/dscdemodgui.h
  10. 29
      plugins/channelrx/demoddsc/dscdemodgui.ui
  11. 3
      plugins/channelrx/demoddsc/dscdemodsettings.cpp
  12. 2
      plugins/channelrx/demoddsc/dscdemodsettings.h
  13. 21
      plugins/channelrx/demoddsc/dscdemodsink.cpp
  14. 15
      plugins/channelrx/demoddsc/readme.md
  15. 11
      plugins/channelrx/demodendoftrain/endoftraindemodgui.cpp
  16. 1
      plugins/channelrx/demodendoftrain/endoftraindemodgui.h
  17. 21
      plugins/channelrx/demodendoftrain/endoftraindemodgui.ui
  18. 17
      plugins/channelrx/demodendoftrain/endoftraindemodsettings.cpp
  19. 1
      plugins/channelrx/demodendoftrain/endoftraindemodsettings.h
  20. 20
      plugins/channelrx/demodendoftrain/endoftraindemodsink.cpp
  21. 17
      plugins/channelrx/demodendoftrain/readme.md
  22. 36
      plugins/channelrx/demodpacket/packetdemodgui.cpp
  23. 15
      plugins/channelrx/demodpacket/packetdemodgui.h
  24. 64
      plugins/channelrx/demodpacket/packetdemodgui.ui
  25. 5
      plugins/channelrx/demodpacket/packetdemodsettings.cpp
  26. 3
      plugins/channelrx/demodpacket/packetdemodsettings.h
  27. 20
      plugins/channelrx/demodpacket/packetdemodsink.cpp
  28. 17
      plugins/channelrx/demodpacket/readme.md
  29. 6
      plugins/channelrx/demodradiosonde/radiosondedemod.h
  30. 9
      plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp
  31. 1
      plugins/channelrx/demodradiosonde/radiosondedemodgui.h
  32. 41
      plugins/channelrx/demodradiosonde/radiosondedemodgui.ui
  33. 5
      plugins/channelrx/demodradiosonde/radiosondedemodsettings.cpp
  34. 1
      plugins/channelrx/demodradiosonde/radiosondedemodsettings.h
  35. 19
      plugins/channelrx/demodradiosonde/radiosondedemodsink.cpp
  36. 15
      plugins/channelrx/demodradiosonde/readme.md
  37. BIN
      sdrgui/resources/clockcurrent.png
  38. BIN
      sdrgui/resources/clockfile.png
  39. 2
      sdrgui/resources/res.qrc
  40. 2
      swagger/sdrangel/api/swagger/include/AISDemod.yaml
  41. 2
      swagger/sdrangel/api/swagger/include/DSCDemod.yaml
  42. 2
      swagger/sdrangel/api/swagger/include/EndOfTrainDemod.yaml
  43. 2
      swagger/sdrangel/api/swagger/include/PacketDemod.yaml
  44. 2
      swagger/sdrangel/api/swagger/include/RadiosondeDemod.yaml

9
plugins/channelrx/demodais/aisdemodgui.cpp

@ -916,6 +916,8 @@ void AISDemodGUI::displaySettings() @@ -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() @@ -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() @@ -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()

1
plugins/channelrx/demodais/aisdemodgui.h

@ -159,6 +159,7 @@ private slots: @@ -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);

29
plugins/channelrx/demodais/aisdemodgui.ui

@ -557,6 +557,27 @@ @@ -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">
@ -959,15 +980,15 @@ @@ -959,15 +980,15 @@
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>RollupContents</class>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/rollupcontents.h</header>
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDialZ</class>
<class>RollupContents</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<header>gui/rollupcontents.h</header>
<container>1</container>
</customwidget>
<customwidget>

3
plugins/channelrx/demodais/aisdemodsettings.cpp

@ -48,6 +48,7 @@ void AISDemodSettings::resetToDefaults() @@ -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 @@ -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) @@ -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);

1
plugins/channelrx/demodais/aisdemodsettings.h

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

17
plugins/channelrx/demodais/aisdemodsink.cpp

@ -23,6 +23,8 @@ @@ -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) @@ -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();

15
plugins/channelrx/demodais/readme.md

@ -56,7 +56,7 @@ Pressing this button clears all messages from the table. @@ -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. @@ -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>

8
plugins/channelrx/demoddsc/dscdemodgui.cpp

@ -1009,6 +1009,7 @@ void DSCDemodGUI::displaySettings() @@ -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() @@ -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() @@ -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()

1
plugins/channelrx/demoddsc/dscdemodgui.h

@ -151,6 +151,7 @@ private slots: @@ -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);

29
plugins/channelrx/demoddsc/dscdemodgui.ui

@ -545,6 +545,27 @@ @@ -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">
@ -935,15 +956,15 @@ @@ -935,15 +956,15 @@
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>RollupContents</class>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/rollupcontents.h</header>
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDialZ</class>
<class>RollupContents</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<header>gui/rollupcontents.h</header>
<container>1</container>
</customwidget>
<customwidget>

3
plugins/channelrx/demoddsc/dscdemodsettings.cpp

@ -46,6 +46,7 @@ void DSCDemodSettings::resetToDefaults() @@ -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 @@ -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) @@ -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");

2
plugins/channelrx/demoddsc/dscdemodsettings.h

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

21
plugins/channelrx/demoddsc/dscdemodsink.cpp

@ -21,8 +21,10 @@ @@ -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) @@ -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();

15
plugins/channelrx/demoddsc/readme.md

@ -60,19 +60,24 @@ The messages are submitted with Preferences > My Position... > Station name used @@ -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)

11
plugins/channelrx/demodendoftrain/endoftraindemodgui.cpp

@ -511,6 +511,8 @@ EndOfTrainDemodGUI::EndOfTrainDemodGUI(PluginAPI* pluginAPI, DeviceUISet *device @@ -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() @@ -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() @@ -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() @@ -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()

1
plugins/channelrx/demodendoftrain/endoftraindemodgui.h

@ -137,6 +137,7 @@ private slots: @@ -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);

21
plugins/channelrx/demodendoftrain/endoftraindemodgui.ui

@ -498,6 +498,27 @@ @@ -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">

17
plugins/channelrx/demodendoftrain/endoftraindemodsettings.cpp

@ -47,8 +47,9 @@ void EndOfTrainDemodSettings::resetToDefaults() @@ -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 @@ -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) @@ -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 @@ -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, @@ -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;
}

1
plugins/channelrx/demodendoftrain/endoftraindemodsettings.h

@ -42,6 +42,7 @@ struct EndOfTrainDemodSettings @@ -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;

20
plugins/channelrx/demodendoftrain/endoftraindemodsink.cpp

@ -20,7 +20,9 @@ @@ -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) @@ -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

17
plugins/channelrx/demodendoftrain/readme.md

@ -58,19 +58,24 @@ IP address of the host to forward received packets to via UDP. @@ -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 @@ -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

36
plugins/channelrx/demodpacket/packetdemodgui.cpp

@ -16,10 +16,6 @@ @@ -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 @@ @@ -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 @@ @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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() @@ -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() @@ -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() @@ -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() @@ -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()

15
plugins/channelrx/demodpacket/packetdemodgui.h

@ -97,7 +97,7 @@ private: @@ -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: @@ -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: @@ -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);

64
plugins/channelrx/demodpacket/packetdemodgui.ui

@ -385,6 +385,13 @@ @@ -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 @@ @@ -394,7 +401,7 @@
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>UDP</string>
<string/>
</property>
</widget>
</item>
@ -536,6 +543,27 @@ @@ -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 @@ @@ -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 @@ @@ -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>
@ -725,15 +768,16 @@ @@ -725,15 +768,16 @@
<container>1</container>
</customwidget>
<customwidget>
<class>LevelMeterSignalDB</class>
<class>RollupContents</class>
<extends>QWidget</extends>
<header>gui/levelmeter.h</header>
<header>gui/rollupcontents.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
<class>LevelMeterSignalDB</class>
<extends>QWidget</extends>
<header>gui/levelmeter.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>

5
plugins/channelrx/demodpacket/packetdemodsettings.cpp

@ -46,6 +46,7 @@ void PacketDemodSettings::resetToDefaults() @@ -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 @@ -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) @@ -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);
}

3
plugins/channelrx/demodpacket/packetdemodsettings.h

@ -27,7 +27,7 @@ @@ -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 @@ -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;

20
plugins/channelrx/demodpacket/packetdemodsink.cpp

@ -22,8 +22,10 @@ @@ -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) @@ -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);
}
}

17
plugins/channelrx/demodpacket/readme.md

@ -1,4 +1,4 @@ @@ -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 @@ -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 @@ -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.

6
plugins/channelrx/demodradiosonde/radiosondedemod.h

@ -82,9 +82,9 @@ public: @@ -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: @@ -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),

9
plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp

@ -771,6 +771,8 @@ void RadiosondeDemodGUI::displaySettings() @@ -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() @@ -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() @@ -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()

1
plugins/channelrx/demodradiosonde/radiosondedemodgui.h

@ -154,6 +154,7 @@ private slots: @@ -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);

41
plugins/channelrx/demodradiosonde/radiosondedemodgui.ui

@ -524,6 +524,27 @@ @@ -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,27 +1097,27 @@ @@ -1076,27 +1097,27 @@
</widget>
</widget>
<customwidgets>
<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>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/levelmeter.h</header>
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDialZ</class>
<class>RollupContents</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<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>

5
plugins/channelrx/demodradiosonde/radiosondedemodsettings.cpp

@ -48,6 +48,7 @@ void RadiosondeDemodSettings::resetToDefaults() @@ -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 @@ -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) @@ -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);
}

1
plugins/channelrx/demodradiosonde/radiosondedemodsettings.h

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

19
plugins/channelrx/demodradiosonde/radiosondedemodsink.cpp

@ -23,8 +23,10 @@ @@ -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) @@ -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);
}

15
plugins/channelrx/demodradiosonde/readme.md

@ -1,4 +1,4 @@ @@ -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. @@ -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.

BIN
sdrgui/resources/clockcurrent.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
sdrgui/resources/clockfile.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

2
sdrgui/resources/res.qrc

@ -154,6 +154,8 @@ @@ -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>

2
swagger/sdrangel/api/swagger/include/AISDemod.yaml

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

2
swagger/sdrangel/api/swagger/include/DSCDemod.yaml

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

2
swagger/sdrangel/api/swagger/include/EndOfTrainDemod.yaml

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

2
swagger/sdrangel/api/swagger/include/PacketDemod.yaml

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

2
swagger/sdrangel/api/swagger/include/RadiosondeDemod.yaml

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

Loading…
Cancel
Save