25 changed files with 6245 additions and 16 deletions
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
IF (NOT INMARSATC_FOUND) |
||||
FIND_PATH( |
||||
INMARSATC_INCLUDE_DIR |
||||
NAMES inmarsatc_decoder.h inmarsatc_parser.h |
||||
HINTS ${INMARSATC_DIR}/include |
||||
PATHS /usr/include |
||||
/usr/local/include |
||||
) |
||||
|
||||
FIND_LIBRARY( |
||||
INMARSATC_LIBRARIES |
||||
NAMES inmarsatc_decoder inmarsatc_parser |
||||
HINTS ${INMARSATC_DIR}/lib |
||||
${INMARSATC_DIR}/lib64 |
||||
PATHS /usr/lib |
||||
/usr/lib64 |
||||
/usr/local/lib |
||||
/usr/local/lib64 |
||||
) |
||||
|
||||
if (INMARSATC_INCLUDE_DIR AND INMARSATC_LIBRARIES) |
||||
set(INMARSATC_FOUND TRUE CACHE INTERNAL "inmarsatc found") |
||||
message(STATUS "Found inmarsatc: ${INMARSATC_INCLUDE_DIR}, ${INMARSATC_LIBRARIES}") |
||||
else (INMARSATC_INCLUDE_DIR AND INMARSATC_LIBRARIES) |
||||
set(INMARSATC_FOUND FALSE CACHE INTERNAL "inmarsatc found") |
||||
message(STATUS "inmarsatc not found.") |
||||
endif (INMARSATC_INCLUDE_DIR AND INMARSATC_LIBRARIES) |
||||
|
||||
mark_as_advanced(INMARSATC_INCLUDE_DIR INMARSATC_LIBRARIES) |
||||
|
||||
ENDIF (NOT INMARSATC_FOUND) |
||||
|
After Width: | Height: | Size: 658 KiB |
|
After Width: | Height: | Size: 98 KiB |
@ -0,0 +1,72 @@
@@ -0,0 +1,72 @@
|
||||
project(demodinmarsat) |
||||
|
||||
set(demodinmarsat_SOURCES |
||||
inmarsatdemod.cpp |
||||
inmarsatdemodsettings.cpp |
||||
inmarsatdemodbaseband.cpp |
||||
inmarsatdemodsink.cpp |
||||
inmarsatdemodplugin.cpp |
||||
inmarsatdemodwebapiadapter.cpp |
||||
) |
||||
|
||||
set(demodinmarsat_HEADERS |
||||
inmarsatdemod.h |
||||
inmarsatdemodsettings.h |
||||
inmarsatdemodbaseband.h |
||||
inmarsatdemodsink.h |
||||
inmarsatdemodplugin.h |
||||
inmarsatdemodwebapiadapter.h |
||||
) |
||||
|
||||
include_directories( |
||||
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client |
||||
${INMARSATC_INCLUDE_DIR} |
||||
) |
||||
|
||||
if(NOT SERVER_MODE) |
||||
set(demodinmarsat_SOURCES |
||||
${demodinmarsat_SOURCES} |
||||
inmarsatdemodgui.cpp |
||||
inmarsatdemodgui.ui |
||||
) |
||||
set(demodinmarsat_HEADERS |
||||
${demodinmarsat_HEADERS} |
||||
inmarsatdemodgui.h |
||||
) |
||||
|
||||
set(TARGET_NAME ${PLUGINS_PREFIX}demodinmarsat) |
||||
set(TARGET_LIB "Qt::Widgets") |
||||
set(TARGET_LIB_GUI "sdrgui") |
||||
set(INSTALL_FOLDER ${INSTALL_PLUGINS_DIR}) |
||||
else() |
||||
set(TARGET_NAME ${PLUGINSSRV_PREFIX}demodinmarsatsrv) |
||||
set(TARGET_LIB "") |
||||
set(TARGET_LIB_GUI "") |
||||
set(INSTALL_FOLDER ${INSTALL_PLUGINSSRV_DIR}) |
||||
endif() |
||||
|
||||
if(NOT Qt6_FOUND) |
||||
add_library(${TARGET_NAME} ${demodinmarsat_SOURCES}) |
||||
else() |
||||
qt_add_plugin(${TARGET_NAME} CLASS_NAME InmarsatDemodPlugin ${demodinmarsat_SOURCES}) |
||||
endif() |
||||
|
||||
if(NOT BUILD_SHARED_LIBS) |
||||
set_property(GLOBAL APPEND PROPERTY STATIC_PLUGINS_PROPERTY ${TARGET_NAME}) |
||||
endif() |
||||
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE |
||||
Qt::Core |
||||
${TARGET_LIB} |
||||
sdrbase |
||||
${TARGET_LIB_GUI} |
||||
${INMARSATC_LIBRARIES} |
||||
) |
||||
|
||||
install(TARGETS ${TARGET_NAME} DESTINATION ${INSTALL_FOLDER}) |
||||
|
||||
# Install debug symbols |
||||
if (WIN32) |
||||
install(FILES $<TARGET_PROPERTY:${TARGET_NAME},RUNTIME_OUTPUT_DIRECTORY>/${TARGET_NAME}stripped.pdb CONFIGURATIONS Release DESTINATION ${INSTALL_FOLDER} RENAME ${TARGET_NAME}.pdb ) |
||||
install(FILES $<TARGET_PDB_FILE:${TARGET_NAME}> CONFIGURATIONS Debug RelWithDebInfo DESTINATION ${INSTALL_FOLDER} ) |
||||
endif() |
||||
@ -0,0 +1,671 @@
@@ -0,0 +1,671 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2021-2026 Jon Beniston, M7RCE <jon@beniston.com> //
|
||||
// Copyright (C) 2021-2022 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "inmarsatdemod.h" |
||||
|
||||
#include <QTime> |
||||
#include <QDebug> |
||||
#include <QNetworkAccessManager> |
||||
#include <QNetworkReply> |
||||
#include <QBuffer> |
||||
#include <QThread> |
||||
|
||||
#include "SWGChannelSettings.h" |
||||
#include "SWGWorkspaceInfo.h" |
||||
#include "SWGInmarsatDemodSettings.h" |
||||
#include "SWGChannelReport.h" |
||||
|
||||
#include "dsp/dspcommands.h" |
||||
#include "device/deviceapi.h" |
||||
#include "settings/serializable.h" |
||||
#include "util/db.h" |
||||
#include "maincore.h" |
||||
|
||||
MESSAGE_CLASS_DEFINITION(InmarsatDemod::MsgConfigureInmarsatDemod, Message) |
||||
|
||||
const char * const InmarsatDemod::m_channelIdURI = "sdrangel.channel.inmarsatdemod"; |
||||
const char * const InmarsatDemod::m_channelId = "InmarsatDemod"; |
||||
|
||||
InmarsatDemod::InmarsatDemod(DeviceAPI *deviceAPI) : |
||||
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), |
||||
m_deviceAPI(deviceAPI), |
||||
m_basebandSampleRate(0) |
||||
{ |
||||
setObjectName(m_channelId); |
||||
|
||||
m_basebandSink = new InmarsatDemodBaseband(this); |
||||
m_basebandSink->setMessageQueueToChannel(getInputMessageQueue()); |
||||
m_basebandSink->setChannel(this); |
||||
m_basebandSink->moveToThread(&m_thread); |
||||
|
||||
applySettings(m_settings, QStringList(), true); |
||||
|
||||
m_deviceAPI->addChannelSink(this); |
||||
m_deviceAPI->addChannelSinkAPI(this); |
||||
|
||||
m_networkManager = new QNetworkAccessManager(); |
||||
QObject::connect( |
||||
m_networkManager, |
||||
&QNetworkAccessManager::finished, |
||||
this, |
||||
&InmarsatDemod::networkManagerFinished |
||||
); |
||||
QObject::connect( |
||||
this, |
||||
&ChannelAPI::indexInDeviceSetChanged, |
||||
this, |
||||
&InmarsatDemod::handleIndexInDeviceSetChanged |
||||
); |
||||
} |
||||
|
||||
InmarsatDemod::~InmarsatDemod() |
||||
{ |
||||
qDebug("InmarsatDemod::~InmarsatDemod"); |
||||
QObject::disconnect( |
||||
m_networkManager, |
||||
&QNetworkAccessManager::finished, |
||||
this, |
||||
&InmarsatDemod::networkManagerFinished |
||||
); |
||||
delete m_networkManager; |
||||
m_deviceAPI->removeChannelSinkAPI(this); |
||||
m_deviceAPI->removeChannelSink(this, true); |
||||
|
||||
if (m_basebandSink->isRunning()) { |
||||
stop(); |
||||
} |
||||
|
||||
delete m_basebandSink; |
||||
} |
||||
|
||||
void InmarsatDemod::setDeviceAPI(DeviceAPI *deviceAPI) |
||||
{ |
||||
if (deviceAPI != m_deviceAPI) |
||||
{ |
||||
m_deviceAPI->removeChannelSinkAPI(this); |
||||
m_deviceAPI->removeChannelSink(this, false); |
||||
m_deviceAPI = deviceAPI; |
||||
m_deviceAPI->addChannelSink(this); |
||||
m_deviceAPI->addChannelSinkAPI(this); |
||||
} |
||||
} |
||||
|
||||
uint32_t InmarsatDemod::getNumberOfDeviceStreams() const |
||||
{ |
||||
return m_deviceAPI->getNbSourceStreams(); |
||||
} |
||||
|
||||
void InmarsatDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool firstOfBurst) |
||||
{ |
||||
(void) firstOfBurst; |
||||
m_basebandSink->feed(begin, end); |
||||
} |
||||
|
||||
void InmarsatDemod::start() |
||||
{ |
||||
qDebug("InmarsatDemod::start"); |
||||
|
||||
m_basebandSink->reset(); |
||||
m_basebandSink->startWork(); |
||||
m_thread.start(); |
||||
|
||||
DSPSignalNotification *dspMsg = new DSPSignalNotification(m_basebandSampleRate, m_centerFrequency); |
||||
m_basebandSink->getInputMessageQueue()->push(dspMsg); |
||||
|
||||
InmarsatDemodBaseband::MsgConfigureInmarsatDemodBaseband *msg = InmarsatDemodBaseband::MsgConfigureInmarsatDemodBaseband::create(m_settings, QStringList(), true); |
||||
m_basebandSink->getInputMessageQueue()->push(msg); |
||||
} |
||||
|
||||
void InmarsatDemod::stop() |
||||
{ |
||||
qDebug("InmarsatDemod::stop"); |
||||
m_basebandSink->stopWork(); |
||||
m_thread.quit(); |
||||
m_thread.wait(); |
||||
} |
||||
|
||||
bool InmarsatDemod::handleMessage(const Message& cmd) |
||||
{ |
||||
if (MsgConfigureInmarsatDemod::match(cmd)) |
||||
{ |
||||
MsgConfigureInmarsatDemod& cfg = (MsgConfigureInmarsatDemod&) cmd; |
||||
qDebug() << "InmarsatDemod::handleMessage: MsgConfigureInmarsatDemod"; |
||||
applySettings(cfg.getSettings(), cfg.getSettingsKeys(), cfg.getForce()); |
||||
|
||||
return true; |
||||
} |
||||
else if (DSPSignalNotification::match(cmd)) |
||||
{ |
||||
DSPSignalNotification& notif = (DSPSignalNotification&) cmd; |
||||
m_basebandSampleRate = notif.getSampleRate(); |
||||
m_centerFrequency = notif.getCenterFrequency(); |
||||
// Forward to the sink
|
||||
DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy
|
||||
qDebug() << "InmarsatDemod::handleMessage: DSPSignalNotification"; |
||||
m_basebandSink->getInputMessageQueue()->push(rep); |
||||
// Forward to GUI if any
|
||||
if (m_guiMessageQueue) { |
||||
m_guiMessageQueue->push(new DSPSignalNotification(notif)); |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
else if (MainCore::MsgPacket::match(cmd)) |
||||
{ |
||||
// Forward to GUI
|
||||
MainCore::MsgPacket& report = (MainCore::MsgPacket&)cmd; |
||||
if (getMessageQueueToGUI()) |
||||
{ |
||||
MainCore::MsgPacket *msg = new MainCore::MsgPacket(report); |
||||
getMessageQueueToGUI()->push(msg); |
||||
} |
||||
|
||||
// Forward to packet features
|
||||
QList<ObjectPipe*> packetsPipes; |
||||
MainCore::instance()->getMessagePipes().getMessagePipes(this, "packets", packetsPipes); |
||||
|
||||
for (const auto& pipe : packetsPipes) |
||||
{ |
||||
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element); |
||||
MainCore::MsgPacket *msg = new MainCore::MsgPacket(report); |
||||
messageQueue->push(msg); |
||||
} |
||||
|
||||
// Forward via UDP
|
||||
if (m_settings.m_udpEnabled) |
||||
{ |
||||
qDebug() << "Forwarding to " << m_settings.m_udpAddress << ":" << m_settings.m_udpPort; |
||||
m_udpSocket.writeDatagram(report.getPacket().data(), report.getPacket().size(), |
||||
QHostAddress(m_settings.m_udpAddress), m_settings.m_udpPort); |
||||
} |
||||
|
||||
// Write to log file
|
||||
if (m_logFile.isOpen()) |
||||
{ |
||||
m_logStream << report.getDateTime().date().toString() << "," |
||||
<< report.getDateTime().time().toString() << "," |
||||
<< report.getPacket().toHex() << "\n"; |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
else if (MainCore::MsgChannelDemodQuery::match(cmd)) |
||||
{ |
||||
qDebug() << "InmarsatDemod::handleMessage: MsgChannelDemodQuery"; |
||||
sendSampleRateToDemodAnalyzer(); |
||||
|
||||
return true; |
||||
} |
||||
else |
||||
{ |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
ScopeVis *InmarsatDemod::getScopeSink() |
||||
{ |
||||
return m_basebandSink->getScopeSink(); |
||||
} |
||||
|
||||
void InmarsatDemod::setCenterFrequency(qint64 frequency) |
||||
{ |
||||
InmarsatDemodSettings settings = m_settings; |
||||
settings.m_inputFrequencyOffset = frequency; |
||||
applySettings(settings, {"inputFrequencyOffset"}, false); |
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{ |
||||
MsgConfigureInmarsatDemod *msgToGUI = MsgConfigureInmarsatDemod::create(settings, {"inputFrequencyOffset"}, false); |
||||
m_guiMessageQueue->push(msgToGUI); |
||||
} |
||||
} |
||||
|
||||
void InmarsatDemod::applySettings(const InmarsatDemodSettings& settings, const QStringList& settingsKeys, bool force) |
||||
{ |
||||
qDebug() << "InmarsatDemod::applySettings:" |
||||
<< settings.getDebugString(settingsKeys, force) |
||||
<< " force: " << force; |
||||
|
||||
if (settingsKeys.contains("streamIndex")) |
||||
{ |
||||
if (m_deviceAPI->getSampleMIMO()) // change of stream is possible for MIMO devices only
|
||||
{ |
||||
m_deviceAPI->removeChannelSinkAPI(this); |
||||
m_deviceAPI->removeChannelSink(this, m_settings.m_streamIndex); |
||||
m_deviceAPI->addChannelSink(this, settings.m_streamIndex); |
||||
m_deviceAPI->addChannelSinkAPI(this); |
||||
m_settings.m_streamIndex = settings.m_streamIndex; // make sure ChannelAPI::getStreamIndex() is consistent
|
||||
emit streamIndexChanged(settings.m_streamIndex); |
||||
} |
||||
} |
||||
|
||||
InmarsatDemodBaseband::MsgConfigureInmarsatDemodBaseband *msg = InmarsatDemodBaseband::MsgConfigureInmarsatDemodBaseband::create(settings, settingsKeys, force); |
||||
m_basebandSink->getInputMessageQueue()->push(msg); |
||||
|
||||
if (settings.m_useReverseAPI) |
||||
{ |
||||
bool fullUpdate = (settingsKeys.contains("useReverseAPI") && settings.m_useReverseAPI) || |
||||
settingsKeys.contains("reverseAPIAddress") || |
||||
settingsKeys.contains("reverseAPIPort") || |
||||
settingsKeys.contains("reverseAPIDeviceIndex") || |
||||
settingsKeys.contains("reverseAPIChannelIndex"); |
||||
webapiReverseSendSettings(settingsKeys, settings, fullUpdate || force); |
||||
} |
||||
|
||||
if ((settings.m_logEnabled != m_settings.m_logEnabled) |
||||
|| (settings.m_logFilename != m_settings.m_logFilename) |
||||
|| force) |
||||
{ |
||||
if (m_logFile.isOpen()) |
||||
{ |
||||
m_logStream.flush(); |
||||
m_logFile.close(); |
||||
} |
||||
if (settings.m_logEnabled && !settings.m_logFilename.isEmpty()) |
||||
{ |
||||
m_logFile.setFileName(settings.m_logFilename); |
||||
if (m_logFile.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) |
||||
{ |
||||
qDebug() << "InmarsatDemod::applySettings - Logging to: " << settings.m_logFilename; |
||||
bool newFile = m_logFile.size() == 0; |
||||
m_logStream.setDevice(&m_logFile); |
||||
if (newFile) |
||||
{ |
||||
// Write header
|
||||
m_logStream << "Date,Time,Data\n"; |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
qDebug() << "InmarsatDemod::applySettings - Unable to open log file: " << settings.m_logFilename; |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (force) { |
||||
m_settings = settings; |
||||
} else { |
||||
m_settings.applySettings(settingsKeys, settings); |
||||
} |
||||
} |
||||
|
||||
void InmarsatDemod::sendSampleRateToDemodAnalyzer() |
||||
{ |
||||
QList<ObjectPipe*> pipes; |
||||
MainCore::instance()->getMessagePipes().getMessagePipes(this, "reportdemod", pipes); |
||||
|
||||
if (pipes.size() > 0) |
||||
{ |
||||
for (const auto& pipe : pipes) |
||||
{ |
||||
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element); |
||||
MainCore::MsgChannelDemodReport *msg = MainCore::MsgChannelDemodReport::create( |
||||
this, |
||||
InmarsatDemodSettings::CHANNEL_SAMPLE_RATE |
||||
); |
||||
messageQueue->push(msg); |
||||
} |
||||
} |
||||
} |
||||
|
||||
QByteArray InmarsatDemod::serialize() const |
||||
{ |
||||
return m_settings.serialize(); |
||||
} |
||||
|
||||
bool InmarsatDemod::deserialize(const QByteArray& data) |
||||
{ |
||||
if (m_settings.deserialize(data)) |
||||
{ |
||||
MsgConfigureInmarsatDemod *msg = MsgConfigureInmarsatDemod::create(m_settings, QStringList(), true); |
||||
m_inputMessageQueue.push(msg); |
||||
return true; |
||||
} |
||||
else |
||||
{ |
||||
m_settings.resetToDefaults(); |
||||
MsgConfigureInmarsatDemod *msg = MsgConfigureInmarsatDemod::create(m_settings, QStringList(), true); |
||||
m_inputMessageQueue.push(msg); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
int InmarsatDemod::webapiSettingsGet( |
||||
SWGSDRangel::SWGChannelSettings& response, |
||||
QString& errorMessage) |
||||
{ |
||||
(void) errorMessage; |
||||
response.setInmarsatDemodSettings(new SWGSDRangel::SWGInmarsatDemodSettings()); |
||||
response.getInmarsatDemodSettings()->init(); |
||||
webapiFormatChannelSettings(response, m_settings); |
||||
return 200; |
||||
} |
||||
|
||||
int InmarsatDemod::webapiWorkspaceGet( |
||||
SWGSDRangel::SWGWorkspaceInfo& response, |
||||
QString& errorMessage) |
||||
{ |
||||
(void) errorMessage; |
||||
response.setIndex(m_settings.m_workspaceIndex); |
||||
return 200; |
||||
} |
||||
|
||||
int InmarsatDemod::webapiSettingsPutPatch( |
||||
bool force, |
||||
const QStringList& channelSettingsKeys, |
||||
SWGSDRangel::SWGChannelSettings& response, |
||||
QString& errorMessage) |
||||
{ |
||||
(void) errorMessage; |
||||
InmarsatDemodSettings settings = m_settings; |
||||
webapiUpdateChannelSettings(settings, channelSettingsKeys, response); |
||||
|
||||
MsgConfigureInmarsatDemod *msg = MsgConfigureInmarsatDemod::create(settings, channelSettingsKeys, force); |
||||
m_inputMessageQueue.push(msg); |
||||
|
||||
qDebug("InmarsatDemod::webapiSettingsPutPatch: forward to GUI: %p", m_guiMessageQueue); |
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{ |
||||
MsgConfigureInmarsatDemod *msgToGUI = MsgConfigureInmarsatDemod::create(settings, channelSettingsKeys, force); |
||||
m_guiMessageQueue->push(msgToGUI); |
||||
} |
||||
|
||||
webapiFormatChannelSettings(response, settings); |
||||
|
||||
return 200; |
||||
} |
||||
|
||||
int InmarsatDemod::webapiReportGet( |
||||
SWGSDRangel::SWGChannelReport& response, |
||||
QString& errorMessage) |
||||
{ |
||||
(void) errorMessage; |
||||
response.setInmarsatDemodReport(new SWGSDRangel::SWGInmarsatDemodReport()); |
||||
response.getInmarsatDemodReport()->init(); |
||||
webapiFormatChannelReport(response); |
||||
return 200; |
||||
} |
||||
|
||||
void InmarsatDemod::webapiUpdateChannelSettings( |
||||
InmarsatDemodSettings& settings, |
||||
const QStringList& channelSettingsKeys, |
||||
SWGSDRangel::SWGChannelSettings& response) |
||||
{ |
||||
if (channelSettingsKeys.contains("inputFrequencyOffset")) { |
||||
settings.m_inputFrequencyOffset = response.getInmarsatDemodSettings()->getInputFrequencyOffset(); |
||||
} |
||||
if (channelSettingsKeys.contains("rfBandwidth")) { |
||||
settings.m_rfBandwidth = response.getInmarsatDemodSettings()->getRfBandwidth(); |
||||
} |
||||
if (channelSettingsKeys.contains("rrcRolloff")) { |
||||
settings.m_rrcRolloff = response.getInmarsatDemodSettings()->getRrcRolloff(); |
||||
} |
||||
if (channelSettingsKeys.contains("pllBandwidth")) { |
||||
settings.m_pllBW = response.getInmarsatDemodSettings()->getPllBandwidth(); |
||||
} |
||||
if (channelSettingsKeys.contains("udpEnabled")) { |
||||
settings.m_udpEnabled = response.getInmarsatDemodSettings()->getUdpEnabled(); |
||||
} |
||||
if (channelSettingsKeys.contains("udpAddress")) { |
||||
settings.m_udpAddress = *response.getInmarsatDemodSettings()->getUdpAddress(); |
||||
} |
||||
if (channelSettingsKeys.contains("udpPort")) { |
||||
settings.m_udpPort = response.getInmarsatDemodSettings()->getUdpPort(); |
||||
} |
||||
if (channelSettingsKeys.contains("logFilename")) { |
||||
settings.m_logFilename = *response.getInmarsatDemodSettings()->getLogFilename(); |
||||
} |
||||
if (channelSettingsKeys.contains("logEnabled")) { |
||||
settings.m_logEnabled = response.getInmarsatDemodSettings()->getLogEnabled(); |
||||
} |
||||
if (channelSettingsKeys.contains("useFileTime")) { |
||||
settings.m_useFileTime = response.getInmarsatDemodSettings()->getUseFileTime(); |
||||
} |
||||
if (channelSettingsKeys.contains("rgbColor")) { |
||||
settings.m_rgbColor = response.getInmarsatDemodSettings()->getRgbColor(); |
||||
} |
||||
if (channelSettingsKeys.contains("title")) { |
||||
settings.m_title = *response.getInmarsatDemodSettings()->getTitle(); |
||||
} |
||||
if (channelSettingsKeys.contains("streamIndex")) { |
||||
settings.m_streamIndex = response.getInmarsatDemodSettings()->getStreamIndex(); |
||||
} |
||||
if (channelSettingsKeys.contains("useReverseAPI")) { |
||||
settings.m_useReverseAPI = response.getInmarsatDemodSettings()->getUseReverseApi() != 0; |
||||
} |
||||
if (channelSettingsKeys.contains("reverseAPIAddress")) { |
||||
settings.m_reverseAPIAddress = *response.getInmarsatDemodSettings()->getReverseApiAddress(); |
||||
} |
||||
if (channelSettingsKeys.contains("reverseAPIPort")) { |
||||
settings.m_reverseAPIPort = response.getInmarsatDemodSettings()->getReverseApiPort(); |
||||
} |
||||
if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) { |
||||
settings.m_reverseAPIDeviceIndex = response.getInmarsatDemodSettings()->getReverseApiDeviceIndex(); |
||||
} |
||||
if (channelSettingsKeys.contains("reverseAPIChannelIndex")) { |
||||
settings.m_reverseAPIChannelIndex = response.getInmarsatDemodSettings()->getReverseApiChannelIndex(); |
||||
} |
||||
if (settings.m_channelMarker && channelSettingsKeys.contains("channelMarker")) { |
||||
settings.m_channelMarker->updateFrom(channelSettingsKeys, response.getInmarsatDemodSettings()->getChannelMarker()); |
||||
} |
||||
if (settings.m_rollupState && channelSettingsKeys.contains("rollupState")) { |
||||
settings.m_rollupState->updateFrom(channelSettingsKeys, response.getInmarsatDemodSettings()->getRollupState()); |
||||
} |
||||
} |
||||
|
||||
void InmarsatDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const InmarsatDemodSettings& settings) |
||||
{ |
||||
response.getInmarsatDemodSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset); |
||||
response.getInmarsatDemodSettings()->setRfBandwidth(settings.m_rfBandwidth); |
||||
response.getInmarsatDemodSettings()->setRrcRolloff(settings.m_rrcRolloff); |
||||
response.getInmarsatDemodSettings()->setPllBandwidth(settings.m_pllBW); |
||||
response.getInmarsatDemodSettings()->setUdpEnabled(settings.m_udpEnabled); |
||||
response.getInmarsatDemodSettings()->setUdpAddress(new QString(settings.m_udpAddress)); |
||||
response.getInmarsatDemodSettings()->setUdpPort(settings.m_udpPort); |
||||
response.getInmarsatDemodSettings()->setLogFilename(new QString(settings.m_logFilename)); |
||||
response.getInmarsatDemodSettings()->setLogEnabled(settings.m_logEnabled); |
||||
response.getInmarsatDemodSettings()->setUseFileTime(settings.m_useFileTime); |
||||
|
||||
response.getInmarsatDemodSettings()->setRgbColor(settings.m_rgbColor); |
||||
if (response.getInmarsatDemodSettings()->getTitle()) { |
||||
*response.getInmarsatDemodSettings()->getTitle() = settings.m_title; |
||||
} else { |
||||
response.getInmarsatDemodSettings()->setTitle(new QString(settings.m_title)); |
||||
} |
||||
|
||||
response.getInmarsatDemodSettings()->setStreamIndex(settings.m_streamIndex); |
||||
response.getInmarsatDemodSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0); |
||||
|
||||
if (response.getInmarsatDemodSettings()->getReverseApiAddress()) { |
||||
*response.getInmarsatDemodSettings()->getReverseApiAddress() = settings.m_reverseAPIAddress; |
||||
} else { |
||||
response.getInmarsatDemodSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress)); |
||||
} |
||||
|
||||
response.getInmarsatDemodSettings()->setReverseApiPort(settings.m_reverseAPIPort); |
||||
response.getInmarsatDemodSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex); |
||||
response.getInmarsatDemodSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex); |
||||
|
||||
if (settings.m_channelMarker) |
||||
{ |
||||
if (response.getInmarsatDemodSettings()->getChannelMarker()) |
||||
{ |
||||
settings.m_channelMarker->formatTo(response.getInmarsatDemodSettings()->getChannelMarker()); |
||||
} |
||||
else |
||||
{ |
||||
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker(); |
||||
settings.m_channelMarker->formatTo(swgChannelMarker); |
||||
response.getInmarsatDemodSettings()->setChannelMarker(swgChannelMarker); |
||||
} |
||||
} |
||||
|
||||
if (settings.m_rollupState) |
||||
{ |
||||
if (response.getInmarsatDemodSettings()->getRollupState()) |
||||
{ |
||||
settings.m_rollupState->formatTo(response.getInmarsatDemodSettings()->getRollupState()); |
||||
} |
||||
else |
||||
{ |
||||
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState(); |
||||
settings.m_rollupState->formatTo(swgRollupState); |
||||
response.getInmarsatDemodSettings()->setRollupState(swgRollupState); |
||||
} |
||||
} |
||||
} |
||||
|
||||
void InmarsatDemod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) |
||||
{ |
||||
double magsqAvg, magsqPeak; |
||||
int nbMagsqSamples; |
||||
getMagSqLevels(magsqAvg, magsqPeak, nbMagsqSamples); |
||||
|
||||
response.getInmarsatDemodReport()->setChannelPowerDb(CalcDb::dbPower(magsqAvg)); |
||||
response.getInmarsatDemodReport()->setChannelSampleRate(m_basebandSink->getChannelSampleRate()); |
||||
} |
||||
|
||||
void InmarsatDemod::webapiReverseSendSettings(const QList<QString>& channelSettingsKeys, const InmarsatDemodSettings& settings, bool force) |
||||
{ |
||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings(); |
||||
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force); |
||||
|
||||
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings") |
||||
.arg(settings.m_reverseAPIAddress) |
||||
.arg(settings.m_reverseAPIPort) |
||||
.arg(settings.m_reverseAPIDeviceIndex) |
||||
.arg(settings.m_reverseAPIChannelIndex); |
||||
m_networkRequest.setUrl(QUrl(channelSettingsURL)); |
||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); |
||||
|
||||
QBuffer *buffer = new QBuffer(); |
||||
buffer->open((QBuffer::ReadWrite)); |
||||
buffer->write(swgChannelSettings->asJson().toUtf8()); |
||||
buffer->seek(0); |
||||
|
||||
// Always use PATCH to avoid passing reverse API settings
|
||||
QNetworkReply *reply = m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer); |
||||
buffer->setParent(reply); |
||||
|
||||
delete swgChannelSettings; |
||||
} |
||||
|
||||
void InmarsatDemod::webapiFormatChannelSettings( |
||||
const QStringList& channelSettingsKeys, |
||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings, |
||||
const InmarsatDemodSettings& settings, |
||||
bool force |
||||
) |
||||
{ |
||||
swgChannelSettings->setDirection(0); // Single sink (Rx)
|
||||
swgChannelSettings->setOriginatorChannelIndex(getIndexInDeviceSet()); |
||||
swgChannelSettings->setOriginatorDeviceSetIndex(getDeviceSetIndex()); |
||||
swgChannelSettings->setChannelType(new QString("InmarsatDemod")); |
||||
swgChannelSettings->setInmarsatDemodSettings(new SWGSDRangel::SWGInmarsatDemodSettings()); |
||||
SWGSDRangel::SWGInmarsatDemodSettings *swgInmarsatDemodSettings = swgChannelSettings->getInmarsatDemodSettings(); |
||||
|
||||
// transfer data that has been modified. When force is on transfer all data except reverse API data
|
||||
|
||||
if (channelSettingsKeys.contains("inputFrequencyOffset") || force) { |
||||
swgInmarsatDemodSettings->setInputFrequencyOffset(settings.m_inputFrequencyOffset); |
||||
} |
||||
if (channelSettingsKeys.contains("rfBandwidth") || force) { |
||||
swgInmarsatDemodSettings->setRfBandwidth(settings.m_rfBandwidth); |
||||
} |
||||
if (channelSettingsKeys.contains("rrcRolloff") || force) { |
||||
swgInmarsatDemodSettings->setRrcRolloff(settings.m_rrcRolloff); |
||||
} |
||||
if (channelSettingsKeys.contains("pllBandwidth") || force) { |
||||
swgInmarsatDemodSettings->setPllBandwidth(settings.m_pllBW); |
||||
} |
||||
if (channelSettingsKeys.contains("udpEnabled") || force) { |
||||
swgInmarsatDemodSettings->setUdpEnabled(settings.m_udpEnabled); |
||||
} |
||||
if (channelSettingsKeys.contains("udpAddress") || force) { |
||||
swgInmarsatDemodSettings->setUdpAddress(new QString(settings.m_udpAddress)); |
||||
} |
||||
if (channelSettingsKeys.contains("udpPort") || force) { |
||||
swgInmarsatDemodSettings->setUdpPort(settings.m_udpPort); |
||||
} |
||||
if (channelSettingsKeys.contains("logFilename") || force) { |
||||
swgInmarsatDemodSettings->setLogFilename(new QString(settings.m_logFilename)); |
||||
} |
||||
if (channelSettingsKeys.contains("logEnabled") || force) { |
||||
swgInmarsatDemodSettings->setLogEnabled(settings.m_logEnabled); |
||||
} |
||||
if (channelSettingsKeys.contains("useFilTime") || force) { |
||||
swgInmarsatDemodSettings->setUseFileTime(settings.m_useFileTime); |
||||
} |
||||
if (channelSettingsKeys.contains("rgbColor") || force) { |
||||
swgInmarsatDemodSettings->setRgbColor(settings.m_rgbColor); |
||||
} |
||||
if (channelSettingsKeys.contains("title") || force) { |
||||
swgInmarsatDemodSettings->setTitle(new QString(settings.m_title)); |
||||
} |
||||
if (channelSettingsKeys.contains("streamIndex") || force) { |
||||
swgInmarsatDemodSettings->setStreamIndex(settings.m_streamIndex); |
||||
} |
||||
|
||||
if (settings.m_channelMarker && (channelSettingsKeys.contains("channelMarker") || force)) |
||||
{ |
||||
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker(); |
||||
settings.m_channelMarker->formatTo(swgChannelMarker); |
||||
swgInmarsatDemodSettings->setChannelMarker(swgChannelMarker); |
||||
} |
||||
|
||||
if (settings.m_rollupState && (channelSettingsKeys.contains("rollupState") || force)) |
||||
{ |
||||
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState(); |
||||
settings.m_rollupState->formatTo(swgRollupState); |
||||
swgInmarsatDemodSettings->setRollupState(swgRollupState); |
||||
} |
||||
} |
||||
|
||||
void InmarsatDemod::networkManagerFinished(QNetworkReply *reply) |
||||
{ |
||||
QNetworkReply::NetworkError replyError = reply->error(); |
||||
|
||||
if (replyError) |
||||
{ |
||||
qWarning() << "InmarsatDemod::networkManagerFinished:" |
||||
<< " error(" << (int) replyError |
||||
<< "): " << replyError |
||||
<< ": " << reply->errorString(); |
||||
} |
||||
else |
||||
{ |
||||
QString answer = reply->readAll(); |
||||
answer.chop(1); // remove last \n
|
||||
qDebug("InmarsatDemod::networkManagerFinished: reply:\n%s", answer.toStdString().c_str()); |
||||
} |
||||
|
||||
reply->deleteLater(); |
||||
} |
||||
|
||||
void InmarsatDemod::handleIndexInDeviceSetChanged(int index) |
||||
{ |
||||
if (index < 0) { |
||||
return; |
||||
} |
||||
|
||||
QString fifoLabel = QString("%1 [%2:%3]") |
||||
.arg(m_channelId) |
||||
.arg(m_deviceAPI->getDeviceSetIndex()) |
||||
.arg(index); |
||||
m_basebandSink->setFifoLabel(fifoLabel); |
||||
} |
||||
@ -0,0 +1,180 @@
@@ -0,0 +1,180 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
||||
// written by Christian Daniel //
|
||||
// Copyright (C) 2015-2022 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
||||
// Copyright (C) 2020-2026 Jon Beniston, M7RCE <jon@beniston.com> //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_INMARSATDEMOD_H |
||||
#define INCLUDE_INMARSATDEMOD_H |
||||
|
||||
#include <QNetworkRequest> |
||||
#include <QUdpSocket> |
||||
#include <QThread> |
||||
#include <QFile> |
||||
#include <QTextStream> |
||||
|
||||
#include "dsp/basebandsamplesink.h" |
||||
#include "channel/channelapi.h" |
||||
#include "util/message.h" |
||||
|
||||
#include "inmarsatdemodbaseband.h" |
||||
#include "inmarsatdemodsettings.h" |
||||
|
||||
class QNetworkAccessManager; |
||||
class QNetworkReply; |
||||
class QThread; |
||||
class DeviceAPI; |
||||
class ScopeVis; |
||||
|
||||
class InmarsatDemod : public BasebandSampleSink, public ChannelAPI { |
||||
public: |
||||
class MsgConfigureInmarsatDemod : public Message { |
||||
MESSAGE_CLASS_DECLARATION |
||||
|
||||
public: |
||||
const InmarsatDemodSettings& getSettings() const { return m_settings; } |
||||
const QStringList& getSettingsKeys() const { return m_settingsKeys; } |
||||
bool getForce() const { return m_force; } |
||||
|
||||
static MsgConfigureInmarsatDemod* create(const InmarsatDemodSettings& settings, const QStringList& settingsKeys, bool force) |
||||
{ |
||||
return new MsgConfigureInmarsatDemod(settings, settingsKeys, force); |
||||
} |
||||
|
||||
private: |
||||
InmarsatDemodSettings m_settings; |
||||
QStringList m_settingsKeys; |
||||
bool m_force; |
||||
|
||||
MsgConfigureInmarsatDemod(const InmarsatDemodSettings& settings, const QStringList& settingsKeys, bool force) : |
||||
Message(), |
||||
m_settings(settings), |
||||
m_settingsKeys(settingsKeys), |
||||
m_force(force) |
||||
{ } |
||||
}; |
||||
|
||||
InmarsatDemod(DeviceAPI *deviceAPI); |
||||
virtual ~InmarsatDemod(); |
||||
virtual void destroy() { delete this; } |
||||
virtual void setDeviceAPI(DeviceAPI *deviceAPI); |
||||
virtual DeviceAPI *getDeviceAPI() { return m_deviceAPI; } |
||||
|
||||
using BasebandSampleSink::feed; |
||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po); |
||||
virtual void start(); |
||||
virtual void stop(); |
||||
virtual void pushMessage(Message *msg) { m_inputMessageQueue.push(msg); } |
||||
virtual QString getSinkName() { return objectName(); } |
||||
|
||||
virtual void getIdentifier(QString& id) { id = objectName(); } |
||||
virtual QString getIdentifier() const { return objectName(); } |
||||
virtual const QString& getURI() const { return getName(); } |
||||
virtual void getTitle(QString& title) { title = m_settings.m_title; } |
||||
virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } |
||||
virtual void setCenterFrequency(qint64 frequency); |
||||
|
||||
virtual QByteArray serialize() const; |
||||
virtual bool deserialize(const QByteArray& data); |
||||
|
||||
virtual int getNbSinkStreams() const { return 1; } |
||||
virtual int getNbSourceStreams() const { return 0; } |
||||
virtual int getStreamIndex() const { return m_settings.m_streamIndex; } |
||||
|
||||
virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const |
||||
{ |
||||
(void) streamIndex; |
||||
(void) sinkElseSource; |
||||
return 0; |
||||
} |
||||
|
||||
virtual int webapiSettingsGet( |
||||
SWGSDRangel::SWGChannelSettings& response, |
||||
QString& errorMessage); |
||||
|
||||
virtual int webapiWorkspaceGet( |
||||
SWGSDRangel::SWGWorkspaceInfo& response, |
||||
QString& errorMessage); |
||||
|
||||
virtual int webapiSettingsPutPatch( |
||||
bool force, |
||||
const QStringList& channelSettingsKeys, |
||||
SWGSDRangel::SWGChannelSettings& response, |
||||
QString& errorMessage); |
||||
|
||||
virtual int webapiReportGet( |
||||
SWGSDRangel::SWGChannelReport& response, |
||||
QString& errorMessage); |
||||
|
||||
static void webapiFormatChannelSettings( |
||||
SWGSDRangel::SWGChannelSettings& response, |
||||
const InmarsatDemodSettings& settings); |
||||
|
||||
static void webapiUpdateChannelSettings( |
||||
InmarsatDemodSettings& settings, |
||||
const QStringList& channelSettingsKeys, |
||||
SWGSDRangel::SWGChannelSettings& response); |
||||
|
||||
ScopeVis *getScopeSink(); |
||||
double getMagSq() const { return m_basebandSink->getMagSq(); } |
||||
|
||||
void getMagSqLevels(double& avg, double& peak, int& nbSamples) { |
||||
m_basebandSink->getMagSqLevels(avg, peak, nbSamples); |
||||
} |
||||
|
||||
void getPLLStatus(bool &locked, Real &coarseFreqCurrent, Real &coarseFreqCurrentPower, Real &coarseFreq, Real &coarseFreqPower, Real &fineFreq) const { |
||||
m_basebandSink->getPLLStatus(locked, coarseFreqCurrent, coarseFreqCurrentPower, coarseFreq, coarseFreqPower, fineFreq); |
||||
} |
||||
|
||||
uint32_t getNumberOfDeviceStreams() const; |
||||
|
||||
static const char * const m_channelIdURI; |
||||
static const char * const m_channelId; |
||||
|
||||
private: |
||||
DeviceAPI *m_deviceAPI; |
||||
QThread m_thread; |
||||
InmarsatDemodBaseband* m_basebandSink; |
||||
InmarsatDemodSettings m_settings; |
||||
int m_basebandSampleRate; //!< stored from device message used when starting baseband sink
|
||||
qint64 m_centerFrequency; |
||||
QUdpSocket m_udpSocket; |
||||
QFile m_logFile; |
||||
QTextStream m_logStream; |
||||
|
||||
QNetworkAccessManager *m_networkManager; |
||||
QNetworkRequest m_networkRequest; |
||||
|
||||
virtual bool handleMessage(const Message& cmd); |
||||
void applySettings(const InmarsatDemodSettings& settings, const QStringList& settingsKeys, bool force = false); |
||||
void sendSampleRateToDemodAnalyzer(); |
||||
void webapiReverseSendSettings(const QList<QString>& channelSettingsKeys, const InmarsatDemodSettings& settings, bool force); |
||||
void webapiFormatChannelSettings( |
||||
const QStringList& channelSettingsKeys, |
||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings, |
||||
const InmarsatDemodSettings& settings, |
||||
bool force |
||||
); |
||||
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response); |
||||
|
||||
private slots: |
||||
void networkManagerFinished(QNetworkReply *reply); |
||||
void handleIndexInDeviceSetChanged(int index); |
||||
|
||||
}; |
||||
|
||||
#endif // INCLUDE_INMARSATDEMOD_H
|
||||
@ -0,0 +1,184 @@
@@ -0,0 +1,184 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019-2021 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
||||
// Copyright (C) 2020-2026 Jon Beniston, M7RCE <jon@beniston.com> //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QDebug> |
||||
|
||||
#include "dsp/dspcommands.h" |
||||
#include "dsp/downchannelizer.h" |
||||
|
||||
#include "inmarsatdemodbaseband.h" |
||||
|
||||
MESSAGE_CLASS_DEFINITION(InmarsatDemodBaseband::MsgConfigureInmarsatDemodBaseband, Message) |
||||
|
||||
InmarsatDemodBaseband::InmarsatDemodBaseband(InmarsatDemod *packetDemod) : |
||||
m_sink(packetDemod), |
||||
m_running(false) |
||||
{ |
||||
qDebug("InmarsatDemodBaseband::InmarsatDemodBaseband"); |
||||
|
||||
m_scopeSink.setNbStreams(InmarsatDemodSettings::m_scopeStreams); |
||||
m_sink.setScopeSink(&m_scopeSink); |
||||
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(48000)); |
||||
m_channelizer = new DownChannelizer(&m_sink); |
||||
} |
||||
|
||||
InmarsatDemodBaseband::~InmarsatDemodBaseband() |
||||
{ |
||||
m_inputMessageQueue.clear(); |
||||
|
||||
delete m_channelizer; |
||||
} |
||||
|
||||
void InmarsatDemodBaseband::reset() |
||||
{ |
||||
QMutexLocker mutexLocker(&m_mutex); |
||||
m_inputMessageQueue.clear(); |
||||
m_sampleFifo.reset(); |
||||
} |
||||
|
||||
void InmarsatDemodBaseband::startWork() |
||||
{ |
||||
QMutexLocker mutexLocker(&m_mutex); |
||||
QObject::connect( |
||||
&m_sampleFifo, |
||||
&SampleSinkFifo::dataReady, |
||||
this, |
||||
&InmarsatDemodBaseband::handleData, |
||||
Qt::QueuedConnection |
||||
); |
||||
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); |
||||
m_running = true; |
||||
} |
||||
|
||||
void InmarsatDemodBaseband::stopWork() |
||||
{ |
||||
QMutexLocker mutexLocker(&m_mutex); |
||||
disconnect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); |
||||
QObject::disconnect( |
||||
&m_sampleFifo, |
||||
&SampleSinkFifo::dataReady, |
||||
this, |
||||
&InmarsatDemodBaseband::handleData |
||||
); |
||||
m_running = false; |
||||
} |
||||
|
||||
void InmarsatDemodBaseband::setChannel(ChannelAPI *channel) |
||||
{ |
||||
m_sink.setChannel(channel); |
||||
} |
||||
|
||||
void InmarsatDemodBaseband::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end) |
||||
{ |
||||
m_sampleFifo.write(begin, end); |
||||
} |
||||
|
||||
void InmarsatDemodBaseband::handleData() |
||||
{ |
||||
QMutexLocker mutexLocker(&m_mutex); |
||||
|
||||
while ((m_sampleFifo.fill() > 0) && (m_inputMessageQueue.size() == 0)) |
||||
{ |
||||
SampleVector::iterator part1begin; |
||||
SampleVector::iterator part1end; |
||||
SampleVector::iterator part2begin; |
||||
SampleVector::iterator part2end; |
||||
|
||||
std::size_t count = m_sampleFifo.readBegin(m_sampleFifo.fill(), &part1begin, &part1end, &part2begin, &part2end); |
||||
|
||||
// first part of FIFO data
|
||||
if (part1begin != part1end) { |
||||
m_channelizer->feed(part1begin, part1end); |
||||
} |
||||
|
||||
// second part of FIFO data (used when block wraps around)
|
||||
if(part2begin != part2end) { |
||||
m_channelizer->feed(part2begin, part2end); |
||||
} |
||||
|
||||
m_sampleFifo.readCommit((unsigned int) count); |
||||
} |
||||
} |
||||
|
||||
void InmarsatDemodBaseband::handleInputMessages() |
||||
{ |
||||
Message* message; |
||||
|
||||
while ((message = m_inputMessageQueue.pop()) != nullptr) |
||||
{ |
||||
if (handleMessage(*message)) { |
||||
delete message; |
||||
} |
||||
} |
||||
} |
||||
|
||||
bool InmarsatDemodBaseband::handleMessage(const Message& cmd) |
||||
{ |
||||
if (MsgConfigureInmarsatDemodBaseband::match(cmd)) |
||||
{ |
||||
QMutexLocker mutexLocker(&m_mutex); |
||||
MsgConfigureInmarsatDemodBaseband& cfg = (MsgConfigureInmarsatDemodBaseband&) cmd; |
||||
qDebug() << "InmarsatDemodBaseband::handleMessage: MsgConfigureInmarsatDemodBaseband"; |
||||
|
||||
applySettings(cfg.getSettings(), cfg.getSettingsKeys(), cfg.getForce()); |
||||
|
||||
return true; |
||||
} |
||||
else if (DSPSignalNotification::match(cmd)) |
||||
{ |
||||
QMutexLocker mutexLocker(&m_mutex); |
||||
DSPSignalNotification& notif = (DSPSignalNotification&) cmd; |
||||
qDebug() << "InmarsatDemodBaseband::handleMessage: DSPSignalNotification: basebandSampleRate: " << notif.getSampleRate(); |
||||
setBasebandSampleRate(notif.getSampleRate()); |
||||
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(notif.getSampleRate())); |
||||
|
||||
return true; |
||||
} |
||||
else |
||||
{ |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
void InmarsatDemodBaseband::applySettings(const InmarsatDemodSettings& settings, const QStringList& settingsKeys, bool force) |
||||
{ |
||||
if (settingsKeys.contains("inputFrequencyOffset") || force) |
||||
{ |
||||
m_channelizer->setChannelization(InmarsatDemodSettings::CHANNEL_SAMPLE_RATE, settings.m_inputFrequencyOffset); |
||||
m_sink.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset()); |
||||
} |
||||
|
||||
m_sink.applySettings(settings, settingsKeys, force); |
||||
|
||||
if (force) { |
||||
m_settings = settings; |
||||
} else { |
||||
m_settings.applySettings(settingsKeys, settings); |
||||
} |
||||
} |
||||
|
||||
int InmarsatDemodBaseband::getChannelSampleRate() const |
||||
{ |
||||
return m_channelizer->getChannelSampleRate(); |
||||
} |
||||
|
||||
void InmarsatDemodBaseband::setBasebandSampleRate(int sampleRate) |
||||
{ |
||||
m_channelizer->setBasebandSampleRate(sampleRate); |
||||
m_sink.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset()); |
||||
} |
||||
@ -0,0 +1,107 @@
@@ -0,0 +1,107 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019-2022 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
||||
// Copyright (C) 2020-2026 Jon Beniston, M7RCE <jon@beniston.com> //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_INMARSATDEMODBASEBAND_H |
||||
#define INCLUDE_INMARSATDEMODBASEBAND_H |
||||
|
||||
#include <QObject> |
||||
#include <QRecursiveMutex> |
||||
|
||||
#include "dsp/samplesinkfifo.h" |
||||
#include "dsp/scopevis.h" |
||||
#include "util/message.h" |
||||
#include "util/messagequeue.h" |
||||
|
||||
#include "inmarsatdemodsink.h" |
||||
|
||||
class DownChannelizer; |
||||
class ChannelAPI; |
||||
class InmarsatDemod; |
||||
class ScopeVis; |
||||
|
||||
class InmarsatDemodBaseband : public QObject |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
class MsgConfigureInmarsatDemodBaseband : public Message { |
||||
MESSAGE_CLASS_DECLARATION |
||||
|
||||
public: |
||||
const InmarsatDemodSettings& getSettings() const { return m_settings; } |
||||
const QStringList& getSettingsKeys() const { return m_settingsKeys; } |
||||
bool getForce() const { return m_force; } |
||||
|
||||
static MsgConfigureInmarsatDemodBaseband* create(const InmarsatDemodSettings& settings, const QStringList& settingsKeys, bool force) |
||||
{ |
||||
return new MsgConfigureInmarsatDemodBaseband(settings, settingsKeys, force); |
||||
} |
||||
|
||||
private: |
||||
InmarsatDemodSettings m_settings; |
||||
QStringList m_settingsKeys; |
||||
bool m_force; |
||||
|
||||
MsgConfigureInmarsatDemodBaseband(const InmarsatDemodSettings& settings, const QStringList& settingsKeys, bool force) : |
||||
Message(), |
||||
m_settings(settings), |
||||
m_settingsKeys(settingsKeys), |
||||
m_force(force) |
||||
{ } |
||||
}; |
||||
|
||||
InmarsatDemodBaseband(InmarsatDemod *packetDemod); |
||||
~InmarsatDemodBaseband(); |
||||
void reset(); |
||||
void startWork(); |
||||
void stopWork(); |
||||
void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end); |
||||
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication
|
||||
void getMagSqLevels(double& avg, double& peak, int& nbSamples) { |
||||
m_sink.getMagSqLevels(avg, peak, nbSamples); |
||||
} |
||||
void getPLLStatus(bool &locked, Real &coarseFreqCurrent, Real &coarseFreqCurrentPower, Real &coarseFreq, Real &coarseFreqPower, Real &fineFreq) const { |
||||
m_sink.getPLLStatus(locked, coarseFreqCurrent, coarseFreqCurrentPower, coarseFreq, coarseFreqPower, fineFreq); |
||||
} |
||||
void setMessageQueueToChannel(MessageQueue *messageQueue) { m_sink.setMessageQueueToChannel(messageQueue); } |
||||
void setBasebandSampleRate(int sampleRate); |
||||
int getChannelSampleRate() const; |
||||
ScopeVis *getScopeSink() { return &m_scopeSink; } |
||||
void setChannel(ChannelAPI *channel); |
||||
double getMagSq() const { return m_sink.getMagSq(); } |
||||
bool isRunning() const { return m_running; } |
||||
void setFifoLabel(const QString& label) { m_sampleFifo.setLabel(label); } |
||||
|
||||
private: |
||||
SampleSinkFifo m_sampleFifo; |
||||
DownChannelizer *m_channelizer; |
||||
InmarsatDemodSink m_sink; |
||||
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
|
||||
InmarsatDemodSettings m_settings; |
||||
ScopeVis m_scopeSink; |
||||
bool m_running; |
||||
QRecursiveMutex m_mutex; |
||||
|
||||
bool handleMessage(const Message& cmd); |
||||
void applySettings(const InmarsatDemodSettings& settings, const QStringList& settingsKeys, bool force = false); |
||||
|
||||
private slots: |
||||
void handleInputMessages(); |
||||
void handleData(); //!< Handle data when samples have to be processed
|
||||
}; |
||||
|
||||
#endif // INCLUDE_INMARSATDEMODBASEBAND_H
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,248 @@
@@ -0,0 +1,248 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2020-2026 Jon Beniston, M7RCE <jon@beniston.com> //
|
||||
// Copyright (C) 2020, 2022 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_INMARSATDEMODGUI_H |
||||
#define INCLUDE_INMARSATDEMODGUI_H |
||||
|
||||
#include <QIcon> |
||||
#include <QAbstractListModel> |
||||
#include <QModelIndex> |
||||
#include <QProgressDialog> |
||||
#include <QTableWidgetItem> |
||||
#include <QPushButton> |
||||
#include <QToolButton> |
||||
#include <QHBoxLayout> |
||||
#include <QMenu> |
||||
#include <QHash> |
||||
#include <QDateTime> |
||||
#include <QGeoCoordinate> |
||||
|
||||
#include <inmarsatc_parser.h> |
||||
|
||||
#include "channel/channelgui.h" |
||||
#include "dsp/channelmarker.h" |
||||
#include "util/messagequeue.h" |
||||
#include "settings/rollupstate.h" |
||||
#include "inmarsatdemodsettings.h" |
||||
|
||||
class PluginAPI; |
||||
class DeviceUISet; |
||||
class BasebandSampleSink; |
||||
class ScopeVis; |
||||
class InmarsatDemod; |
||||
class InmarsatDemodGUI; |
||||
|
||||
namespace Ui { |
||||
class InmarsatDemodGUI; |
||||
} |
||||
class InmarsatDemodGUI; |
||||
|
||||
QString decodeAddress(QString messageType, QString addressHex, float *latitude = nullptr, float *longitude = nullptr, QList<QGeoCoordinate> *coordinates = nullptr, QIcon **icon = nullptr); |
||||
|
||||
struct MessagePart { |
||||
int m_part; |
||||
int m_packet; |
||||
QString m_text; |
||||
}; |
||||
|
||||
class MultipartMessage { |
||||
public: |
||||
|
||||
MultipartMessage(int id, std::map<std::string, std::string> params, const QDateTime& dateTime); |
||||
void update(std::map<std::string, std::string> params, const QDateTime& dateTime); |
||||
void addPart(const MessagePart& part); |
||||
QString getMessage() const; |
||||
int getParts() const { return m_parts.size(); } |
||||
int getTotalParts() const { return m_parts[m_parts.size()-1].m_packet * 2; } |
||||
QDateTime getDateTime() const { return m_dateTime; } |
||||
int getId() const { return m_id; } |
||||
QString getService() const { return m_service; } |
||||
QString getPriority() const { return m_priority; } |
||||
QString getAddress() const { return m_address; } |
||||
QIcon *getAddressIcon() const { return m_icon; } |
||||
float getLatitude() const { return m_addressCoordinates.size() > 0 ? m_latitude : m_messageCoordinates[0].latitude(); } |
||||
float getLongitude() const { return m_addressCoordinates.size() > 0 ? m_longitude : m_messageCoordinates[0].longitude(); } |
||||
QList<QGeoCoordinate>& getCoordinates() { return m_addressCoordinates.size() > 0 ? m_addressCoordinates : m_messageCoordinates; } |
||||
|
||||
private: |
||||
|
||||
QDateTime m_dateTime; |
||||
int m_id; |
||||
QString m_service; |
||||
QString m_priority; |
||||
QString m_address; |
||||
QIcon *m_icon; |
||||
QList<MessagePart> m_parts; |
||||
float m_latitude; |
||||
float m_longitude; |
||||
QList<QGeoCoordinate> m_addressCoordinates; |
||||
QList<QGeoCoordinate> m_messageCoordinates; |
||||
|
||||
static QRegularExpression m_re; |
||||
|
||||
void parseMessage(); |
||||
}; |
||||
|
||||
class InmarsatDemodGUI : public ChannelGUI { |
||||
Q_OBJECT |
||||
|
||||
public: |
||||
static InmarsatDemodGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel); |
||||
virtual void destroy(); |
||||
|
||||
void resetToDefaults(); |
||||
QByteArray serialize() const; |
||||
bool deserialize(const QByteArray& data); |
||||
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } |
||||
virtual void setWorkspaceIndex(int index) { m_settings.m_workspaceIndex = index; }; |
||||
virtual int getWorkspaceIndex() const { return m_settings.m_workspaceIndex; }; |
||||
virtual void setGeometryBytes(const QByteArray& blob) { m_settings.m_geometryBytes = blob; }; |
||||
virtual QByteArray getGeometryBytes() const { return m_settings.m_geometryBytes; }; |
||||
virtual QString getTitle() const { return m_settings.m_title; }; |
||||
virtual QColor getTitleColor() const { return m_settings.m_rgbColor; }; |
||||
virtual void zetHidden(bool hidden) { m_settings.m_hidden = hidden; } |
||||
virtual bool getHidden() const { return m_settings.m_hidden; } |
||||
virtual ChannelMarker& getChannelMarker() { return m_channelMarker; } |
||||
virtual int getStreamIndex() const { return m_settings.m_streamIndex; } |
||||
virtual void setStreamIndex(int streamIndex) { m_settings.m_streamIndex = streamIndex; } |
||||
|
||||
public slots: |
||||
void channelMarkerChangedByCursor(); |
||||
void channelMarkerHighlightedByCursor(); |
||||
|
||||
private: |
||||
Ui::InmarsatDemodGUI* ui; |
||||
PluginAPI* m_pluginAPI; |
||||
DeviceUISet* m_deviceUISet; |
||||
ChannelMarker m_channelMarker; |
||||
RollupState m_rollupState; |
||||
InmarsatDemodSettings m_settings; |
||||
QList<QString> m_settingsKeys; |
||||
qint64 m_deviceCenterFrequency; |
||||
bool m_doApplySettings; |
||||
ScopeVis* m_scopeVis; |
||||
|
||||
InmarsatDemod* m_inmarsatDemod; |
||||
int m_basebandSampleRate; |
||||
uint32_t m_tickCount; |
||||
MessageQueue m_inputMessageQueue; |
||||
|
||||
QMenu *m_packetsMenu; // Column select context menu
|
||||
QMenu *m_messagesMenu; |
||||
QStringList m_mapItems; |
||||
bool m_loadingData; |
||||
|
||||
inmarsatc::frameParser::FrameParser m_parser; |
||||
QHash<int, MultipartMessage *> m_messages; |
||||
|
||||
QRegularExpression m_typeRE; |
||||
QRegularExpression m_messageRE; |
||||
|
||||
explicit InmarsatDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent = 0); |
||||
virtual ~InmarsatDemodGUI(); |
||||
|
||||
void blockApplySettings(bool block); |
||||
void applySetting(const QString& settingsKey); |
||||
void applySettings(const QStringList& settingsKeys, bool force = false); |
||||
void applyAllSettings(); |
||||
void displaySettings(); |
||||
void packetReceived(const QByteArray& packet, QDateTime dateTime); |
||||
bool handleMessage(const Message& message); |
||||
void makeUIConnections(); |
||||
void updateAbsoluteCenterFrequency(); |
||||
|
||||
void leaveEvent(QEvent*); |
||||
void enterEvent(EnterEventType*); |
||||
|
||||
void updateMessageTable(MultipartMessage *message); |
||||
void resizeTable(); |
||||
QAction *createCheckableItem(QString& text, int idx, bool checked, bool packets); |
||||
|
||||
void sendAreaToMapFeature(const QString& name, const QString& text, float latitude, float longitude, const QList<QGeoCoordinate>& coordinates); |
||||
void clearAreaFromMapFeature(const QString& name); |
||||
void clearAllFromMapFeature(); |
||||
|
||||
void updateRegularExpressions(); |
||||
void filterRow(QTableWidget *table, int row, int typeCol, int messageCol); |
||||
void filter(); |
||||
|
||||
enum MessageCol { |
||||
MESSAGE_COL_DATE, |
||||
MESSAGE_COL_TIME, |
||||
MESSAGE_COL_ID, |
||||
MESSAGE_COL_SERVICE, |
||||
MESSAGE_COL_PRIORITY, |
||||
MESSAGE_COL_ADDRESS, |
||||
MESSAGE_COL_PARTS, |
||||
MESSAGE_COL_MESSAGE |
||||
}; |
||||
|
||||
enum PacketCol { |
||||
PACKET_COL_DATE, |
||||
PACKET_COL_TIME, |
||||
PACKET_COL_SAT, |
||||
PACKET_COL_LES, |
||||
PACKET_COL_MSG_ID, |
||||
PACKET_COL_TYPE, |
||||
PACKET_COL_FRAME_NO, |
||||
PACKET_COL_LCN, |
||||
PACKET_COL_ULF, |
||||
PACKET_COL_DLF, |
||||
PACKET_COL_PRIORITY, |
||||
PACKET_COL_ADDRESS, |
||||
PACKET_COL_MESSAGE, |
||||
PACKET_COL_DECODE, |
||||
PACKET_COL_DATA_HEX |
||||
}; |
||||
|
||||
private slots: |
||||
void on_packets_itemSelectionChanged(); |
||||
void on_messages_itemSelectionChanged(); |
||||
void on_deltaFrequency_changed(qint64 value); |
||||
void on_rfBW_valueChanged(int index); |
||||
void on_rrcRolloff_valueChanged(int value); |
||||
void on_pll_clicked(bool checked=false); |
||||
void on_pllBW_valueChanged(int value); |
||||
void on_ssBW_valueChanged(int value); |
||||
void on_filterType_editingFinished(); |
||||
void on_filterMessage_editingFinished(); |
||||
void on_clearTable_clicked(); |
||||
void on_udpEnabled_clicked(bool checked); |
||||
void on_udpAddress_editingFinished(); |
||||
void on_udpPort_editingFinished(); |
||||
void on_logEnable_clicked(bool checked=false); |
||||
void on_logFilename_clicked(); |
||||
void on_logOpen_clicked(); |
||||
void on_useFileTime_toggled(bool checked=false); |
||||
void packets_sectionMoved(int logicalIndex, int oldVisualIndex, int newVisualIndex); |
||||
void packets_sectionResized(int logicalIndex, int oldSize, int newSize); |
||||
void packetsColumnSelectMenu(QPoint pos); |
||||
void packetsColumnSelectMenuChecked(bool checked = false); |
||||
void packetsCustomContextMenuRequested(QPoint pos); |
||||
void messages_sectionMoved(int logicalIndex, int oldVisualIndex, int newVisualIndex); |
||||
void messages_sectionResized(int logicalIndex, int oldSize, int newSize); |
||||
void messagesColumnSelectMenu(QPoint pos); |
||||
void messagesColumnSelectMenuChecked(bool checked = false); |
||||
void messagesCustomContextMenuRequested(QPoint pos); |
||||
void onWidgetRolled(QWidget* widget, bool rollDown); |
||||
void onMenuDialogCalled(const QPoint& p); |
||||
void handleInputMessages(); |
||||
void tick(); |
||||
}; |
||||
|
||||
#endif // INCLUDE_INMARSATDEMODGUI_H
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,94 @@
@@ -0,0 +1,94 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
||||
// written by Christian Daniel //
|
||||
// Copyright (C) 2015-2022 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
||||
// Copyright (C) 2020-2026 Jon Beniston, M7RCE <jon@beniston.com> //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QtPlugin> |
||||
#include "plugin/pluginapi.h" |
||||
|
||||
#ifndef SERVER_MODE |
||||
#include "inmarsatdemodgui.h" |
||||
#endif |
||||
#include "inmarsatdemod.h" |
||||
#include "inmarsatdemodwebapiadapter.h" |
||||
#include "inmarsatdemodplugin.h" |
||||
|
||||
const PluginDescriptor InmarsatDemodPlugin::m_pluginDescriptor = { |
||||
InmarsatDemod::m_channelId, |
||||
QStringLiteral("Inmarsat C Demodulator"), |
||||
QStringLiteral("7.22.11"), |
||||
QStringLiteral("(c) Jon Beniston, M7RCE"), |
||||
QStringLiteral("https://github.com/f4exb/sdrangel"), |
||||
true, |
||||
QStringLiteral("https://github.com/f4exb/sdrangel") |
||||
}; |
||||
|
||||
InmarsatDemodPlugin::InmarsatDemodPlugin(QObject* parent) : |
||||
QObject(parent), |
||||
m_pluginAPI(0) |
||||
{ |
||||
} |
||||
|
||||
const PluginDescriptor& InmarsatDemodPlugin::getPluginDescriptor() const |
||||
{ |
||||
return m_pluginDescriptor; |
||||
} |
||||
|
||||
void InmarsatDemodPlugin::initPlugin(PluginAPI* pluginAPI) |
||||
{ |
||||
m_pluginAPI = pluginAPI; |
||||
|
||||
m_pluginAPI->registerRxChannel(InmarsatDemod::m_channelIdURI, InmarsatDemod::m_channelId, this); |
||||
} |
||||
|
||||
void InmarsatDemodPlugin::createRxChannel(DeviceAPI *deviceAPI, BasebandSampleSink **bs, ChannelAPI **cs) const |
||||
{ |
||||
if (bs || cs) |
||||
{ |
||||
InmarsatDemod *instance = new InmarsatDemod(deviceAPI); |
||||
|
||||
if (bs) { |
||||
*bs = instance; |
||||
} |
||||
|
||||
if (cs) { |
||||
*cs = instance; |
||||
} |
||||
} |
||||
} |
||||
|
||||
#ifdef SERVER_MODE |
||||
ChannelGUI* InmarsatDemodPlugin::createRxChannelGUI( |
||||
DeviceUISet *deviceUISet, |
||||
BasebandSampleSink *rxChannel) const |
||||
{ |
||||
(void) deviceUISet; |
||||
(void) rxChannel; |
||||
return 0; |
||||
} |
||||
#else |
||||
ChannelGUI* InmarsatDemodPlugin::createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) const |
||||
{ |
||||
return InmarsatDemodGUI::create(m_pluginAPI, deviceUISet, rxChannel); |
||||
} |
||||
#endif |
||||
|
||||
ChannelWebAPIAdapter* InmarsatDemodPlugin::createChannelWebAPIAdapter() const |
||||
{ |
||||
return new InmarsatDemodWebAPIAdapter(); |
||||
} |
||||
@ -0,0 +1,51 @@
@@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
||||
// written by Christian Daniel //
|
||||
// Copyright (C) 2015-2020 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
||||
// Copyright (C) 2020-2026 Jon Beniston, M7RCE <jon@beniston.com> //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_INMARSATDEMODPLUGIN_H |
||||
#define INCLUDE_INMARSATDEMODPLUGIN_H |
||||
|
||||
#include <QObject> |
||||
#include "plugin/plugininterface.h" |
||||
|
||||
class DeviceUISet; |
||||
class BasebandSampleSink; |
||||
|
||||
class InmarsatDemodPlugin : public QObject, PluginInterface { |
||||
Q_OBJECT |
||||
Q_INTERFACES(PluginInterface) |
||||
Q_PLUGIN_METADATA(IID "sdrangel.channel.inmarsatdemod") |
||||
|
||||
public: |
||||
explicit InmarsatDemodPlugin(QObject* parent = NULL); |
||||
|
||||
const PluginDescriptor& getPluginDescriptor() const; |
||||
void initPlugin(PluginAPI* pluginAPI); |
||||
|
||||
virtual void createRxChannel(DeviceAPI *deviceAPI, BasebandSampleSink **bs, ChannelAPI **cs) const; |
||||
virtual ChannelGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) const; |
||||
virtual ChannelWebAPIAdapter* createChannelWebAPIAdapter() const; |
||||
|
||||
private: |
||||
static const PluginDescriptor m_pluginDescriptor; |
||||
|
||||
PluginAPI* m_pluginAPI; |
||||
}; |
||||
|
||||
#endif // INCLUDE_INMARSATDEMODPLUGIN_H
|
||||
@ -0,0 +1,399 @@
@@ -0,0 +1,399 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
||||
// written by Christian Daniel //
|
||||
// Copyright (C) 2015-2022 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
||||
// Copyright (C) 2020-2026 Jon Beniston, M7RCE <jon@beniston.com> //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QColor> |
||||
|
||||
#include "util/simpleserializer.h" |
||||
#include "settings/serializable.h" |
||||
#include "inmarsatdemodsettings.h" |
||||
|
||||
InmarsatDemodSettings::InmarsatDemodSettings() : |
||||
m_channelMarker(nullptr), |
||||
m_scopeGUI(nullptr), |
||||
m_rollupState(nullptr) |
||||
{ |
||||
appendDefaultColumnSettings(); |
||||
resetToDefaults(); |
||||
} |
||||
|
||||
void InmarsatDemodSettings::appendDefaultColumnSettings() |
||||
{ |
||||
appendDefaultColumnIndexes(m_packetsColumnIndexes, INMARSATDEMOD_PACKETS_COLUMNS); |
||||
appendDefaultColumnSizes(m_packetsColumnSizes, INMARSATDEMOD_PACKETS_COLUMNS); |
||||
appendDefaultColumnIndexes(m_messagesColumnIndexes, INMARSATDEMOD_MESSAGES_COLUMNS); |
||||
appendDefaultColumnSizes(m_messagesColumnSizes, INMARSATDEMOD_MESSAGES_COLUMNS); |
||||
} |
||||
|
||||
void InmarsatDemodSettings::appendDefaultColumnIndexes(QList<int>& list, int size) |
||||
{ |
||||
while (list.size() < size) { |
||||
list.append(list.size()); |
||||
} |
||||
} |
||||
|
||||
void InmarsatDemodSettings::appendDefaultColumnSizes(QList<int>& list, int size) |
||||
{ |
||||
while (list.size() < size) { |
||||
list.append(-1); |
||||
} |
||||
} |
||||
|
||||
void InmarsatDemodSettings::resetToDefaults() |
||||
{ |
||||
m_inputFrequencyOffset = 0; |
||||
m_rfBandwidth = 5000.0f; |
||||
m_rrcRolloff = 1.0f; |
||||
m_pllBW = 2*M_PI/100.0; |
||||
m_ssBW = 2*M_PI/100.0; |
||||
m_filterType = ""; |
||||
m_filterMessage = ""; |
||||
m_udpEnabled = false; |
||||
m_udpAddress = "127.0.0.1"; |
||||
m_udpPort = 9999; |
||||
m_logFilename = "inmarsat_c_log.csv"; |
||||
m_logEnabled = false; |
||||
m_useFileTime = false; |
||||
for (int i = 0; i < INMARSATDEMOD_PACKETS_COLUMNS; i++) |
||||
{ |
||||
m_packetsColumnIndexes[i] = i; |
||||
m_packetsColumnSizes[i] = -1; // Autosize
|
||||
} |
||||
for (int i = 0; i < INMARSATDEMOD_MESSAGES_COLUMNS; i++) |
||||
{ |
||||
m_messagesColumnIndexes[i] = i; |
||||
m_messagesColumnSizes[i] = -1; // Autosize
|
||||
} |
||||
m_rgbColor = QColor(40, 180, 75).rgb(); |
||||
m_title = "Inmarsat C Demodulator"; |
||||
m_streamIndex = 0; |
||||
m_useReverseAPI = false; |
||||
m_reverseAPIAddress = "127.0.0.1"; |
||||
m_reverseAPIPort = 8888; |
||||
m_reverseAPIDeviceIndex = 0; |
||||
m_reverseAPIChannelIndex = 0; |
||||
m_workspaceIndex = 0; |
||||
m_hidden = false; |
||||
} |
||||
|
||||
QByteArray InmarsatDemodSettings::serialize() const |
||||
{ |
||||
SimpleSerializer s(1); |
||||
s.writeS32(1, m_inputFrequencyOffset); |
||||
s.writeS32(2, m_streamIndex); |
||||
s.writeString(3, m_filterType); |
||||
s.writeString(4, m_filterMessage); |
||||
|
||||
s.writeFloat(5, m_rfBandwidth); |
||||
s.writeFloat(6, m_rrcRolloff); |
||||
s.writeFloat(7, m_pllBW); |
||||
s.writeFloat(8, m_ssBW); |
||||
|
||||
s.writeBool(10, m_udpEnabled); |
||||
s.writeString(11, m_udpAddress); |
||||
s.writeU32(12, m_udpPort); |
||||
|
||||
s.writeString(13, m_logFilename); |
||||
s.writeBool(14, m_logEnabled); |
||||
|
||||
s.writeBool(15, m_useFileTime); |
||||
|
||||
s.writeList(16, m_packetsColumnIndexes); |
||||
s.writeList(17, m_packetsColumnSizes); |
||||
s.writeList(18, m_messagesColumnIndexes); |
||||
s.writeList(19, m_messagesColumnSizes); |
||||
|
||||
if (m_channelMarker) { |
||||
s.writeBlob(20, m_channelMarker->serialize()); |
||||
} |
||||
s.writeU32(21, m_rgbColor); |
||||
s.writeString(22, m_title); |
||||
s.writeBool(23, m_useReverseAPI); |
||||
s.writeString(24, m_reverseAPIAddress); |
||||
s.writeU32(25, m_reverseAPIPort); |
||||
s.writeU32(26, m_reverseAPIDeviceIndex); |
||||
s.writeU32(27, m_reverseAPIChannelIndex); |
||||
if (m_rollupState) { |
||||
s.writeBlob(28, m_rollupState->serialize()); |
||||
} |
||||
s.writeS32(29, m_workspaceIndex); |
||||
s.writeBlob(30, m_geometryBytes); |
||||
s.writeBool(31, m_hidden); |
||||
if (m_scopeGUI) { |
||||
s.writeBlob(32, m_scopeGUI->serialize()); |
||||
} |
||||
|
||||
return s.final(); |
||||
} |
||||
|
||||
bool InmarsatDemodSettings::deserialize(const QByteArray& data) |
||||
{ |
||||
SimpleDeserializer d(data); |
||||
|
||||
if(!d.isValid()) |
||||
{ |
||||
resetToDefaults(); |
||||
return false; |
||||
} |
||||
|
||||
if(d.getVersion() == 1) |
||||
{ |
||||
QByteArray bytetmp; |
||||
uint32_t utmp; |
||||
QString strtmp; |
||||
|
||||
d.readS32(1, &m_inputFrequencyOffset, 0); |
||||
d.readS32(2, &m_streamIndex, 0); |
||||
d.readString(3, &m_filterType, ""); |
||||
d.readString(4, &m_filterMessage, ""); |
||||
|
||||
d.readFloat(5, &m_rfBandwidth, 5000.0f); |
||||
d.readFloat(6, &m_rrcRolloff, 1.0f); |
||||
d.readFloat(7, &m_pllBW, 2*M_PI/100.0); |
||||
d.readFloat(8, &m_ssBW, 2*M_PI/100.0); |
||||
|
||||
d.readBool(10, &m_udpEnabled); |
||||
d.readString(11, &m_udpAddress); |
||||
d.readU32(12, &utmp); |
||||
|
||||
d.readString(13, &m_logFilename, "inmarsat_c_log.csv"); |
||||
d.readBool(14, &m_logEnabled, false); |
||||
|
||||
d.readBool(15, &m_useFileTime, false); |
||||
|
||||
d.readList(16, &m_packetsColumnIndexes); |
||||
d.readList(17, &m_packetsColumnSizes); |
||||
d.readList(18, &m_messagesColumnIndexes); |
||||
d.readList(19, &m_messagesColumnSizes); |
||||
appendDefaultColumnSettings(); |
||||
|
||||
if (m_channelMarker) |
||||
{ |
||||
d.readBlob(20, &bytetmp); |
||||
m_channelMarker->deserialize(bytetmp); |
||||
} |
||||
d.readU32(21, &m_rgbColor, QColor(40, 180, 75).rgb()); |
||||
d.readString(22, &m_title, "Inmarsat C Demodulator"); |
||||
d.readBool(23, &m_useReverseAPI, false); |
||||
d.readString(24, &m_reverseAPIAddress, "127.0.0.1"); |
||||
d.readU32(25, &utmp, 0); |
||||
|
||||
if ((utmp > 1023) && (utmp < 65535)) { |
||||
m_reverseAPIPort = utmp; |
||||
} else { |
||||
m_reverseAPIPort = 8888; |
||||
} |
||||
|
||||
d.readU32(26, &utmp, 0); |
||||
m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp; |
||||
d.readU32(27, &utmp, 0); |
||||
m_reverseAPIChannelIndex = utmp > 99 ? 99 : utmp; |
||||
|
||||
if ((utmp > 1023) && (utmp < 65535)) { |
||||
m_udpPort = utmp; |
||||
} else { |
||||
m_udpPort = 9999; |
||||
} |
||||
|
||||
if (m_rollupState) |
||||
{ |
||||
d.readBlob(28, &bytetmp); |
||||
m_rollupState->deserialize(bytetmp); |
||||
} |
||||
|
||||
d.readS32(29, &m_workspaceIndex, 0); |
||||
d.readBlob(30, &m_geometryBytes); |
||||
d.readBool(31, &m_hidden, false); |
||||
|
||||
if (m_scopeGUI) |
||||
{ |
||||
d.readBlob(32, &bytetmp); |
||||
m_scopeGUI->deserialize(bytetmp); |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
else |
||||
{ |
||||
resetToDefaults(); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
void InmarsatDemodSettings::applySettings(const QStringList& settingsKeys, const InmarsatDemodSettings& settings) |
||||
{ |
||||
if (settingsKeys.contains("inputFrequencyOffset")) { |
||||
m_inputFrequencyOffset = settings.m_inputFrequencyOffset; |
||||
} |
||||
if (settingsKeys.contains("rfBandwidth")) { |
||||
m_rfBandwidth = settings.m_rfBandwidth; |
||||
} |
||||
if (settingsKeys.contains("rrcRolloff")) { |
||||
m_rrcRolloff = settings.m_rrcRolloff; |
||||
} |
||||
if (settingsKeys.contains("pllBandwidth")) { |
||||
m_pllBW = settings.m_pllBW; |
||||
} |
||||
if (settingsKeys.contains("ssBandwidth")) { |
||||
m_ssBW = settings.m_ssBW; |
||||
} |
||||
if (settingsKeys.contains("filterType")) { |
||||
m_filterType = settings.m_filterType; |
||||
} |
||||
if (settingsKeys.contains("filterMessage")) { |
||||
m_filterMessage = settings.m_filterMessage; |
||||
} |
||||
if (settingsKeys.contains("udpEnabled")) { |
||||
m_udpEnabled = settings.m_udpEnabled; |
||||
} |
||||
if (settingsKeys.contains("udpAddress")) { |
||||
m_udpAddress = settings.m_udpAddress; |
||||
} |
||||
if (settingsKeys.contains("udpPort")) { |
||||
m_udpPort = settings.m_udpPort; |
||||
} |
||||
if (settingsKeys.contains("useFileTime")) { |
||||
m_useFileTime = settings.m_useFileTime; |
||||
} |
||||
if (settingsKeys.contains("logFilename")) { |
||||
m_logFilename = settings.m_logFilename; |
||||
} |
||||
if (settingsKeys.contains("logEnabled")) { |
||||
m_logEnabled = settings.m_logEnabled; |
||||
} |
||||
if (settingsKeys.contains("packetsColumnIndexes")) { |
||||
m_packetsColumnIndexes = settings.m_packetsColumnIndexes; |
||||
} |
||||
if (settingsKeys.contains("packetsColumnSizes")) { |
||||
m_packetsColumnSizes = settings.m_packetsColumnSizes; |
||||
} |
||||
if (settingsKeys.contains("messagesColumnIndexes")) { |
||||
m_messagesColumnIndexes = settings.m_messagesColumnIndexes; |
||||
} |
||||
if (settingsKeys.contains("messagesColumnSizes")) { |
||||
m_messagesColumnSizes = settings.m_messagesColumnSizes; |
||||
} |
||||
if (settingsKeys.contains("rgbColor")) { |
||||
m_rgbColor = settings.m_rgbColor; |
||||
} |
||||
if (settingsKeys.contains("title")) { |
||||
m_title = settings.m_title; |
||||
} |
||||
if (settingsKeys.contains("streamIndex")) { |
||||
m_streamIndex = settings.m_streamIndex; |
||||
} |
||||
if (settingsKeys.contains("useReverseAPI")) { |
||||
m_useReverseAPI = settings.m_useReverseAPI; |
||||
} |
||||
if (settingsKeys.contains("reverseAPIAddress")) { |
||||
m_reverseAPIAddress = settings.m_reverseAPIAddress; |
||||
} |
||||
if (settingsKeys.contains("reverseAPIPort")) { |
||||
m_reverseAPIPort = settings.m_reverseAPIPort; |
||||
} |
||||
if (settingsKeys.contains("reverseAPIDeviceIndex")) { |
||||
m_reverseAPIDeviceIndex = settings.m_reverseAPIDeviceIndex; |
||||
} |
||||
if (settingsKeys.contains("reverseAPIChannelIndex")) { |
||||
m_reverseAPIChannelIndex = settings.m_reverseAPIChannelIndex; |
||||
} |
||||
if (settingsKeys.contains("workspaceIndex")) { |
||||
m_workspaceIndex = settings.m_workspaceIndex; |
||||
} |
||||
if (settingsKeys.contains("hidden")) { |
||||
m_hidden = settings.m_hidden; |
||||
} |
||||
} |
||||
|
||||
QString InmarsatDemodSettings::getDebugString(const QStringList& settingsKeys, bool force) const |
||||
{ |
||||
std::ostringstream ostr; |
||||
|
||||
if (settingsKeys.contains("inputFrequencyOffset") || force) { |
||||
ostr << " m_inputFrequencyOffset: " << m_inputFrequencyOffset; |
||||
} |
||||
if (settingsKeys.contains("rfBandwidth") || force) { |
||||
ostr << " m_rfBandwidth: " << m_rfBandwidth; |
||||
} |
||||
if (settingsKeys.contains("rrcRolloff") || force) { |
||||
ostr << " m_rrcRolloff: " << m_rrcRolloff; |
||||
} |
||||
if (settingsKeys.contains("pllBandwidth") || force) { |
||||
ostr << " m_pllBW: " << m_pllBW; |
||||
} |
||||
if (settingsKeys.contains("ssBandwidth") || force) { |
||||
ostr << " m_ssBW: " << m_ssBW; |
||||
} |
||||
if (settingsKeys.contains("filterType") || force) { |
||||
ostr << " m_filterType: " << m_filterType.toStdString(); |
||||
} |
||||
if (settingsKeys.contains("filterMessage") || force) { |
||||
ostr << " m_filterMessage: " << m_filterMessage.toStdString(); |
||||
} |
||||
if (settingsKeys.contains("udpEnabled") || force) { |
||||
ostr << " m_udpEnabled: " << m_udpEnabled; |
||||
} |
||||
if (settingsKeys.contains("udpAddress") || force) { |
||||
ostr << " m_udpAddress: " << m_udpAddress.toStdString(); |
||||
} |
||||
if (settingsKeys.contains("udpPort") || force) { |
||||
ostr << " m_udpPort: " << m_udpPort; |
||||
} |
||||
if (settingsKeys.contains("logFilename") || force) { |
||||
ostr << " m_logFilename: " << m_logFilename.toStdString(); |
||||
} |
||||
if (settingsKeys.contains("logEnabled") || force) { |
||||
ostr << " m_logEnabled: " << m_logEnabled; |
||||
} |
||||
if (settingsKeys.contains("useFileTime") || force) { |
||||
ostr << " m_useFileTime: " << m_useFileTime; |
||||
} |
||||
if (settingsKeys.contains("rgbColor") || force) { |
||||
ostr << " m_rgbColor: " << m_rgbColor; |
||||
} |
||||
if (settingsKeys.contains("title") || force) { |
||||
ostr << " m_title: " << m_title.toStdString(); |
||||
} |
||||
if (settingsKeys.contains("streamIndex") || force) { |
||||
ostr << " m_streamIndex: " << m_streamIndex; |
||||
} |
||||
if (settingsKeys.contains("useReverseAPI") || force) { |
||||
ostr << " m_useReverseAPI: " << m_useReverseAPI; |
||||
} |
||||
if (settingsKeys.contains("reverseAPIAddress") || force) { |
||||
ostr << " m_reverseAPIAddress: " << m_reverseAPIAddress.toStdString(); |
||||
} |
||||
if (settingsKeys.contains("reverseAPIPort") || force) { |
||||
ostr << " m_reverseAPIPort: " << m_reverseAPIPort; |
||||
} |
||||
if (settingsKeys.contains("reverseAPIDeviceIndex") || force) { |
||||
ostr << " m_reverseAPIDeviceIndex: " << m_reverseAPIDeviceIndex; |
||||
} |
||||
if (settingsKeys.contains("reverseAPIChannelIndex") || force) { |
||||
ostr << " m_reverseAPIChannelIndex: " << m_reverseAPIChannelIndex; |
||||
} |
||||
if (settingsKeys.contains("workspaceIndex") || force) { |
||||
ostr << " m_workspaceIndex: " << m_workspaceIndex; |
||||
} |
||||
if (settingsKeys.contains("hidden") || force) { |
||||
ostr << " m_hidden: " << m_hidden; |
||||
} |
||||
|
||||
return QString(ostr.str().c_str()); |
||||
} |
||||
@ -0,0 +1,88 @@
@@ -0,0 +1,88 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
||||
// written by Christian Daniel //
|
||||
// Copyright (C) 2015-2022 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
||||
// Copyright (C) 2021-2026 Jon Beniston, M7RCE <jon@beniston.com> //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_INMARSATDEMODSETTINGS_H |
||||
#define INCLUDE_INMARSATDEMODSETTINGS_H |
||||
|
||||
#include <QByteArray> |
||||
|
||||
#include "dsp/dsptypes.h" |
||||
|
||||
class Serializable; |
||||
|
||||
// Number of columns in the table
|
||||
#define INMARSATDEMOD_MESSAGES_COLUMNS 8 |
||||
#define INMARSATDEMOD_PACKETS_COLUMNS 15 |
||||
|
||||
struct InmarsatDemodSettings |
||||
{ |
||||
qint32 m_inputFrequencyOffset; |
||||
float m_rfBandwidth; |
||||
float m_rrcRolloff; |
||||
float m_pllBW; //!< Costas loop bandwidth in rad/sample
|
||||
float m_ssBW; //!< Symbol sync bandwidth normalised to symbol rate (E.g. 0.05 for 5%)
|
||||
QString m_filterType; |
||||
QString m_filterMessage; |
||||
bool m_udpEnabled; |
||||
QString m_udpAddress; |
||||
uint16_t m_udpPort; |
||||
QString m_logFilename; |
||||
bool m_logEnabled; |
||||
bool m_useFileTime; |
||||
QList<int> m_packetsColumnIndexes;//!< How the columns are ordered in the table
|
||||
QList<int> m_packetsColumnSizes; //!< Size of the columns in the table
|
||||
QList<int> m_messagesColumnIndexes; |
||||
QList<int> m_messagesColumnSizes; |
||||
|
||||
quint32 m_rgbColor; |
||||
QString m_title; |
||||
Serializable *m_channelMarker; |
||||
int m_streamIndex; //!< MIMO channel. Not relevant when connected to SI (single Rx).
|
||||
bool m_useReverseAPI; |
||||
QString m_reverseAPIAddress; |
||||
uint16_t m_reverseAPIPort; |
||||
uint16_t m_reverseAPIDeviceIndex; |
||||
uint16_t m_reverseAPIChannelIndex; |
||||
|
||||
Serializable *m_scopeGUI; |
||||
Serializable *m_rollupState; |
||||
int m_workspaceIndex; |
||||
QByteArray m_geometryBytes; |
||||
bool m_hidden; |
||||
|
||||
static const int CHANNEL_SAMPLE_RATE = 48000; |
||||
static const int BAUD_RATE = 1200; |
||||
static const int m_scopeStreams = 11; |
||||
|
||||
InmarsatDemodSettings(); |
||||
void resetToDefaults(); |
||||
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; } |
||||
void setRollupState(Serializable *rollupState) { m_rollupState = rollupState; } |
||||
void setScopeGUI(Serializable *scopeGUI) { m_scopeGUI = scopeGUI; } |
||||
QByteArray serialize() const; |
||||
bool deserialize(const QByteArray& data); |
||||
void applySettings(const QStringList& settingsKeys, const InmarsatDemodSettings& settings); |
||||
QString getDebugString(const QStringList& settingsKeys, bool force = false) const; |
||||
void appendDefaultColumnSettings(); |
||||
void appendDefaultColumnIndexes(QList<int>& list, int size); |
||||
void appendDefaultColumnSizes(QList<int>& list, int size); |
||||
}; |
||||
|
||||
#endif /* INCLUDE_INMARSATDEMODSETTINGS_H */ |
||||
@ -0,0 +1,521 @@
@@ -0,0 +1,521 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2021-2026 Jon Beniston, M7RCE <jon@beniston.com> //
|
||||
// Copyright (C) 2021-2022 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QDebug> |
||||
|
||||
#include "dsp/datafifo.h" |
||||
#include "dsp/scopevis.h" |
||||
#include "dsp/fftfactory.h" |
||||
#include "dsp/dspengine.h" |
||||
#include "util/db.h" |
||||
#include "device/deviceapi.h" |
||||
#include "channel/channelwebapiutils.h" |
||||
#include "maincore.h" |
||||
|
||||
#include "inmarsatdemod.h" |
||||
#include "inmarsatdemodsink.h" |
||||
|
||||
AGC::AGC() : |
||||
m_gain(1.0f) |
||||
{ |
||||
} |
||||
|
||||
Complex AGC::processOneSample(const Complex& iq, bool locked) |
||||
{ |
||||
Complex z = m_gain * iq; |
||||
|
||||
m_agcMovingAverage(abs(z)); |
||||
//qDebug() << "abs" << abs(z) << "m_agcGain" << m_agcGain << "m_agcMovingAverage.instantAverage()" << m_agcMovingAverage.instantAverage();
|
||||
|
||||
Real agcRef = 0.6f; // Target amplitude
|
||||
Real agcMu = locked ? 0.01 : 0.1; // How fast we want to respond to changes in average
|
||||
Real agcEr = agcRef - m_agcMovingAverage.instantAverage(); // Error between target and average
|
||||
|
||||
m_gain += agcMu * agcEr; |
||||
m_gain = std::clamp(m_gain, 0.01f, 100.0f); // 20dB max enough?
|
||||
|
||||
return z; |
||||
} |
||||
|
||||
FrequencyOffsetEstimate::FrequencyOffsetEstimate() : |
||||
m_fftSequence(-1), |
||||
m_fft(nullptr), |
||||
m_fftCounter(0), |
||||
m_fftSize(2048), // 23Hz per bin - which is roughly pull in range of costas loop
|
||||
m_freqOffsetBin(-1), |
||||
m_freqOffsetHz(0.0f), |
||||
m_currentFreqOffsetHz(0.0f), |
||||
m_freqMagSq(0.0f), |
||||
m_currentFreqMagSq(0.0) |
||||
{ |
||||
FFTFactory *fftFactory = DSPEngine::instance()->getFFTFactory(); |
||||
m_fftSequence = fftFactory->getEngine(m_fftSize, false, &m_fft); |
||||
m_fftCounter = 0; |
||||
m_fftWindow.create(FFTWindow::Rectangle, m_fftSize); |
||||
} |
||||
|
||||
FrequencyOffsetEstimate::~FrequencyOffsetEstimate() |
||||
{ |
||||
if (m_fftSequence >= 0) |
||||
{ |
||||
FFTFactory *fftFactory = DSPEngine::instance()->getFFTFactory(); |
||||
fftFactory->releaseEngine(m_fftSize, false, m_fftSequence); |
||||
} |
||||
} |
||||
|
||||
void FrequencyOffsetEstimate::processOneSample(Complex& iq, bool locked) |
||||
{ |
||||
// Square signal to remove modulation
|
||||
Complex cSquared = iq * iq; |
||||
|
||||
// FFT of squared signal for coarse frequency offset estimation
|
||||
m_fft->in()[m_fftCounter] = cSquared; |
||||
m_fftCounter++; |
||||
if (m_fftCounter == m_fftSize) |
||||
{ |
||||
// Apply windowing function
|
||||
m_fftWindow.apply(m_fft->in()); |
||||
|
||||
// Perform FFT
|
||||
m_fft->transform(); |
||||
|
||||
// Find peak
|
||||
int maxIdx = -1; |
||||
Real maxVal = 0; |
||||
for (int i = 0; i < m_fftSize; i++) |
||||
{ |
||||
Complex co = m_fft->out()[i]; |
||||
Real v = co.real() * co.real() + co.imag() * co.imag(); |
||||
Real magsq = v / (m_fftSize * m_fftSize); |
||||
if (magsq > maxVal) |
||||
{ |
||||
maxIdx = i; |
||||
maxVal = magsq; |
||||
} |
||||
} |
||||
|
||||
// Calculate power for current peak bin and frequency we're locked too
|
||||
m_currentFreqMagSq = magSq(maxIdx); |
||||
m_freqMagSq = magSq(m_freqOffsetBin); |
||||
|
||||
Real hzPerBin = InmarsatDemodSettings::CHANNEL_SAMPLE_RATE / (Real) m_fftSize; |
||||
int idx = maxIdx; |
||||
if (maxIdx > m_fftSize / 2) { |
||||
idx -= m_fftSize; // Negative freqs are in second half
|
||||
} |
||||
m_currentFreqOffsetHz = ((idx * hzPerBin) / 2); // Divide by two, as the squaring operation doubles the freq
|
||||
//qDebug() << "Max val" << maxVal << "maxIdx" << maxIdx << "freqOffset" << m_freqOffsetHz;
|
||||
|
||||
Real magRatio = sqrt(m_currentFreqMagSq) / sqrt(m_freqMagSq); |
||||
|
||||
// Don't change frequency if Costas loop is locked, unless there's a big
|
||||
// signal more than 2 bins away. Costas loop locked signal can falsely indicate lock
|
||||
// if offset is multiple of data rate.
|
||||
if (!locked || ((magRatio >= 3) && (abs(maxIdx - m_freqOffsetBin) >= 2))) |
||||
{ |
||||
m_freqOffsetBin = maxIdx; |
||||
m_freqOffsetHz = m_currentFreqOffsetHz; |
||||
m_freqOffsetNCO.setFreq(-m_freqOffsetHz, InmarsatDemodSettings::CHANNEL_SAMPLE_RATE); |
||||
//qDebug() << "Setting CFO" << m_freqOffsetHz << "(" << CalcDb::dbPower(m_currentFreqMagSq) << "/" << CalcDb::dbPower(m_freqMagSq) << ")";
|
||||
} |
||||
|
||||
m_fftCounter = 0; |
||||
} |
||||
|
||||
// Correct for coarse frequency offset
|
||||
iq *= m_freqOffsetNCO.nextIQ(); |
||||
} |
||||
|
||||
Real FrequencyOffsetEstimate::magSq(int bin) const |
||||
{ |
||||
Complex c = m_fft->out()[bin]; |
||||
Real v = c.real() * c.real() + c.imag() * c.imag(); |
||||
return v / (m_fftSize * m_fftSize); |
||||
} |
||||
|
||||
InmarsatDemodSink::InmarsatDemodSink(InmarsatDemod *stdCDemod) : |
||||
m_scopeSink(nullptr), |
||||
m_inmarsatDemod(stdCDemod), |
||||
m_channelSampleRate(InmarsatDemodSettings::CHANNEL_SAMPLE_RATE), |
||||
m_channelFrequencyOffset(0), |
||||
m_magsqSum(0.0f), |
||||
m_magsqPeak(0.0f), |
||||
m_magsqCount(0), |
||||
m_messageQueueToChannel(nullptr), |
||||
m_decoder(9), |
||||
m_costasLoop(10*2*M_PI/100.0, 2), |
||||
m_rrcBufferIndex(0), |
||||
m_sampleBufferIndexA(0), |
||||
m_sampleBufferIndexB(0) |
||||
{ |
||||
m_magsq = 0.0; |
||||
|
||||
m_rrcFilter = new fftfilt(m_settings.m_rfBandwidth / (float) m_channelSampleRate, RRC_FILTER_SIZE); |
||||
|
||||
m_rrcI.create(m_settings.m_rrcRolloff, 5, SAMPLES_PER_SYMBOL, RootRaisedCosine<Real>::Gain); |
||||
m_rrcQ.create(m_settings.m_rrcRolloff, 5, SAMPLES_PER_SYMBOL, RootRaisedCosine<Real>::Gain); |
||||
|
||||
m_sampleIdx = 0; |
||||
|
||||
m_adjustedSPS = m_maxSamplesPerSymbol; // ok: 20, 15, fail: 10, 9, 5
|
||||
m_adjustment = 0; |
||||
m_totalSampleCount = 0; |
||||
m_error = 0; |
||||
m_errorSum = 0; |
||||
m_mu = 0.0; |
||||
m_bit = 0; |
||||
m_bitCount = 0; |
||||
m_filteredSamples.enqueue(0); // Prev sample for first iteration
|
||||
|
||||
for (int i = 0; i < InmarsatDemodSettings::m_scopeStreams; i++) { |
||||
m_sampleBuffer[i].resize(SAMPLE_BUFFER_SIZE); |
||||
} |
||||
|
||||
applySettings(m_settings, QStringList(), true); |
||||
applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true); |
||||
|
||||
} |
||||
|
||||
InmarsatDemodSink::~InmarsatDemodSink() |
||||
{ |
||||
delete m_rrcFilter; |
||||
} |
||||
|
||||
void InmarsatDemodSink::sampleToScopeA(Complex sample, Real magsq, Complex postAGC, Real agcGain, Real agcAvg, Complex postCFO) |
||||
{ |
||||
if (m_scopeSink) |
||||
{ |
||||
m_sampleBuffer[0][m_sampleBufferIndexA] = sample; |
||||
m_sampleBuffer[1][m_sampleBufferIndexA] = Complex(magsq, 0.0f); |
||||
m_sampleBuffer[2][m_sampleBufferIndexA] = postAGC; |
||||
m_sampleBuffer[3][m_sampleBufferIndexA] = Complex(agcGain, agcAvg); |
||||
m_sampleBuffer[4][m_sampleBufferIndexA] = postCFO; |
||||
m_sampleBufferIndexA++; |
||||
} |
||||
} |
||||
|
||||
void InmarsatDemodSink::sampleToScopeB(Complex rrc, Complex tedError, Complex tedErrorSum, Complex ref, Complex derot, int bit, Real mu) |
||||
{ |
||||
if (m_scopeSink) |
||||
{ |
||||
m_sampleBuffer[5][m_sampleBufferIndexB] = rrc; |
||||
m_sampleBuffer[6][m_sampleBufferIndexB] = tedError; |
||||
m_sampleBuffer[7][m_sampleBufferIndexB] = tedErrorSum; |
||||
m_sampleBuffer[8][m_sampleBufferIndexB] = ref; |
||||
m_sampleBuffer[9][m_sampleBufferIndexB] = derot; |
||||
m_sampleBuffer[10][m_sampleBufferIndexB] = Complex(bit, mu); |
||||
m_sampleBufferIndexB++; |
||||
if (m_sampleBufferIndexB == SAMPLE_BUFFER_SIZE) |
||||
{ |
||||
std::vector<ComplexVector::const_iterator> vbegin; |
||||
|
||||
for (int i = 0; i < InmarsatDemodSettings::m_scopeStreams; i++) { |
||||
vbegin.push_back(m_sampleBuffer[i].begin()); |
||||
} |
||||
|
||||
m_scopeSink->feed(vbegin, SAMPLE_BUFFER_SIZE); |
||||
if (m_sampleBufferIndexA != m_sampleBufferIndexB) { |
||||
qDebug() << "m_sampleBufferIndexA != m_sampleBufferIndexB" << m_sampleBufferIndexA << m_sampleBufferIndexB; |
||||
} |
||||
m_sampleBufferIndexA = 0; |
||||
m_sampleBufferIndexB = 0; |
||||
} |
||||
} |
||||
} |
||||
|
||||
void InmarsatDemodSink::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end) |
||||
{ |
||||
Complex ci; |
||||
|
||||
for (SampleVector::const_iterator it = begin; it != end; ++it) |
||||
{ |
||||
Complex c(it->real(), it->imag()); |
||||
c *= m_nco.nextIQ(); |
||||
|
||||
if (m_interpolatorDistance < 1.0f) // interpolate
|
||||
{ |
||||
while (!m_interpolator.interpolate(&m_interpolatorDistanceRemain, c, &ci)) |
||||
{ |
||||
processOneSample(ci); |
||||
m_interpolatorDistanceRemain += m_interpolatorDistance; |
||||
} |
||||
} |
||||
else // decimate
|
||||
{ |
||||
if (m_interpolator.decimate(&m_interpolatorDistanceRemain, c, &ci)) |
||||
{ |
||||
processOneSample(ci); |
||||
m_interpolatorDistanceRemain += m_interpolatorDistance; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
void InmarsatDemodSink::processOneSample(Complex &ci) |
||||
{ |
||||
// Calculate average and peak levels for level meter
|
||||
Real re = ci.real() / SDR_RX_SCALEF; |
||||
Real im = ci.imag() / SDR_RX_SCALEF; |
||||
Real magsq = re*re + im*im; |
||||
m_movingAverage(magsq); |
||||
m_magsq = m_movingAverage.asDouble(); |
||||
m_magsqSum += magsq; |
||||
if (magsq > m_magsqPeak) |
||||
{ |
||||
m_magsqPeak = magsq; |
||||
} |
||||
m_magsqCount++; |
||||
|
||||
// AGC
|
||||
|
||||
Complex cScaled = Complex(re, im); |
||||
Complex agcZ = m_agc.processOneSample(cScaled, m_locked); |
||||
|
||||
// Coarse frequency offset correction
|
||||
|
||||
Complex cCFO = agcZ; |
||||
m_frequencyOffsetEst.processOneSample(cCFO, m_locked); |
||||
|
||||
// Send signals to scope that are updated for each invocation of this method
|
||||
sampleToScopeA(cScaled, magsq, agcZ, m_agc.getGain(), m_agc.getAverage(), cCFO); |
||||
|
||||
// RRC Matched filter
|
||||
fftfilt::cmplx *rrcFilterOut = nullptr; |
||||
int n_out = m_rrcFilter->runFilt(cCFO, &rrcFilterOut); |
||||
|
||||
m_rrcBuffer[m_rrcBufferIndex++] = cCFO; |
||||
|
||||
if (m_rrcBufferIndex == RRC_FILTER_SIZE/2) |
||||
{ |
||||
n_out = m_rrcBufferIndex; |
||||
m_rrcBufferIndex = 0; |
||||
} |
||||
else |
||||
{ |
||||
n_out = 0; |
||||
} |
||||
|
||||
for (int i = 0; i < n_out; i++) |
||||
{ |
||||
//Complex rrc = rrcFilterOut[i];
|
||||
Complex rrc (m_rrcI.filter(m_rrcBuffer[i].real()), m_rrcQ.filter(m_rrcBuffer[i].imag())); |
||||
|
||||
// Symbol synchronizer
|
||||
|
||||
m_totalSampleCount++; |
||||
m_filteredSamples.enqueue(rrc); |
||||
while (m_filteredSamples.size() > m_maxSamplesPerSymbol) |
||||
{ |
||||
m_filteredSamples.dequeue(); |
||||
|
||||
if (m_sampleIdx == m_adjustedSPS - 1) |
||||
{ |
||||
// Gardner timing error detector
|
||||
|
||||
int currentIdx = m_filteredSamples.size()-1; |
||||
int midIdx = currentIdx - (SAMPLES_PER_SYMBOL/2.0f); |
||||
int previousIdx = currentIdx - SAMPLES_PER_SYMBOL; |
||||
|
||||
//qDebug() << "diff" << (m_prevTotalSampleCount - m_totalSampleCount);
|
||||
//qDebug() << "m_totalSampleCount" << m_totalSampleCount << "m_prevTotalSampleCount" << m_prevTotalSampleCount << "diff" << (m_prevTotalSampleCount - m_totalSampleCount) << "currentIdx" << currentIdx << "previousIdx" << previousIdx << "midIdx" << midIdx << "mu" << m_mu;
|
||||
|
||||
Complex previous = m_filteredSamples[previousIdx]; |
||||
Complex mid = m_filteredSamples[midIdx]; |
||||
Complex current = m_filteredSamples[currentIdx]; |
||||
|
||||
m_error = (current.real() - previous.real()) * mid.real() |
||||
+ (current.imag() - previous.imag()) * mid.imag(); |
||||
m_errorSum += m_error; |
||||
|
||||
// Symbol synchronizer adjustment
|
||||
|
||||
m_mu = m_kp * m_error + m_ki * m_errorSum; // Positive error is late
|
||||
//m_mu = std::clamp(m_mu, -0.5f, 0.5f);
|
||||
|
||||
int adjustment = (int)round(m_mu * SAMPLES_PER_SYMBOL); |
||||
|
||||
//qDebug() << "m_mu" << m_mu << "m_error" << m_error << "m_errorSum" << m_errorSum << "adjustment" << adjustment;
|
||||
|
||||
m_adjustedSPS = SAMPLES_PER_SYMBOL - m_adjustment; // Positve mu indicates late, so reduce time to next sample
|
||||
m_adjustment = adjustment; |
||||
m_prevTotalSampleCount = m_totalSampleCount; |
||||
|
||||
// Costas loop for fine phase/freq correction - runs at symbol rate
|
||||
|
||||
m_costasLoop.feed(current.real(), current.imag()); |
||||
m_ref = -std::conj(m_costasLoop.getComplex()); |
||||
m_derot = current * m_ref; |
||||
|
||||
// Determine whether Costas loop is locked - BPSK so Q part should average as zero when locked, and will be similar to I when not locked
|
||||
Real derotMag = abs(m_derot); |
||||
Real iNorm = abs(m_derot.real()) / derotMag; |
||||
Real qNorm = abs(m_derot.imag()) / derotMag; |
||||
m_lockAverage(iNorm - qNorm); |
||||
float lockThresh = 0.2; |
||||
m_locked = m_lockAverage.instantAverage() > lockThresh; |
||||
//qDebug() << "m_lockAverage.instantAverage()" << m_lockAverage.instantAverage();
|
||||
|
||||
// Symbol to bit
|
||||
m_bit = m_derot.real() >= 0; |
||||
m_bits[m_bitCount++] = m_bit; |
||||
|
||||
// Pass demodulated bits to decoder
|
||||
if (m_bitCount == DEMODULATOR_SYMBOLSPERCHUNK) |
||||
{ |
||||
decodeBits(); |
||||
m_bitCount = 0; |
||||
} |
||||
|
||||
m_sampleIdx = 0; |
||||
} |
||||
else |
||||
{ |
||||
m_sampleIdx++; |
||||
} |
||||
|
||||
} |
||||
|
||||
// Send signals to scope that are updated only whenever the RRC filter output is updated
|
||||
sampleToScopeB(rrc, m_error, m_errorSum, m_ref, m_derot, m_bit*2-1, m_mu); |
||||
} |
||||
} |
||||
|
||||
void InmarsatDemodSink::decodeBits() |
||||
{ |
||||
std::vector<inmarsatc::decoder::Decoder::decoder_result> decoderResults; |
||||
|
||||
decoderResults = m_decoder.decode(m_bits); |
||||
|
||||
if (decoderResults.size() > 0) |
||||
{ |
||||
for (int j = 0; j < decoderResults.size(); j++) |
||||
{ |
||||
QByteArray rxPacket; |
||||
rxPacket.resize(sizeof(inmarsatc::decoder::Decoder::decoder_result)); |
||||
memcpy(rxPacket.data(), &decoderResults[j], sizeof(inmarsatc::decoder::Decoder::decoder_result)); |
||||
|
||||
if (getMessageQueueToChannel()) |
||||
{ |
||||
QDateTime dateTime = QDateTime::currentDateTime(); |
||||
if (m_settings.m_useFileTime) |
||||
{ |
||||
QString hardwareId = m_inmarsatDemod->getDeviceAPI()->getHardwareId(); |
||||
|
||||
if ((hardwareId == "FileInput") || (hardwareId == "SigMFFileInput")) |
||||
{ |
||||
QString dateTimeStr; |
||||
int deviceIdx = m_inmarsatDemod->getDeviceSetIndex(); |
||||
|
||||
if (ChannelWebAPIUtils::getDeviceReportValue(deviceIdx, "absoluteTime", dateTimeStr)) { |
||||
dateTime = QDateTime::fromString(dateTimeStr, Qt::ISODateWithMs); |
||||
} |
||||
} |
||||
} |
||||
|
||||
MainCore::MsgPacket *msg = MainCore::MsgPacket::create(m_inmarsatDemod, rxPacket, dateTime); |
||||
getMessageQueueToChannel()->push(msg); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
void InmarsatDemodSink::getPLLStatus(bool &locked, Real &coarseFreqCurrent, Real &coarseFreqCurrentPower, Real &coarseFreq, Real &coarseFreqPower, Real &fineFreq) const |
||||
{ |
||||
locked = m_locked; |
||||
coarseFreqCurrent = m_frequencyOffsetEst.getCurrentFreqHz(); |
||||
coarseFreqCurrentPower = m_frequencyOffsetEst.getCurrentFreqMagSq(); |
||||
coarseFreq = m_frequencyOffsetEst.getFreqHz(); |
||||
coarseFreqPower = m_frequencyOffsetEst.getFreqMagSq(); |
||||
fineFreq = m_costasLoop.getFreq() * COSTAS_LOOP_RATE / (2 * M_PI); |
||||
} |
||||
|
||||
void InmarsatDemodSink::applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force) |
||||
{ |
||||
qDebug() << "InmarsatDemodSink::applyChannelSettings:" |
||||
<< " channelSampleRate: " << channelSampleRate |
||||
<< " channelFrequencyOffset: " << channelFrequencyOffset; |
||||
|
||||
if ((m_channelFrequencyOffset != channelFrequencyOffset) || |
||||
(m_channelSampleRate != channelSampleRate) || force) |
||||
{ |
||||
m_nco.setFreq(-channelFrequencyOffset, channelSampleRate); |
||||
} |
||||
|
||||
if ((m_channelSampleRate != channelSampleRate) || force) |
||||
{ |
||||
m_interpolator.create(16, channelSampleRate, m_settings.m_rfBandwidth / 2.2); |
||||
m_interpolatorDistance = (Real) channelSampleRate / (Real) InmarsatDemodSettings::CHANNEL_SAMPLE_RATE; |
||||
m_interpolatorDistanceRemain = m_interpolatorDistance; |
||||
} |
||||
|
||||
m_channelSampleRate = channelSampleRate; |
||||
m_channelFrequencyOffset = channelFrequencyOffset; |
||||
} |
||||
|
||||
void InmarsatDemodSink::applySettings(const InmarsatDemodSettings& settings, const QStringList& settingsKeys, bool force) |
||||
{ |
||||
qDebug() << "InmarsatDemodSink::applySettings:" |
||||
<< settings.getDebugString(settingsKeys, force) |
||||
<< " force: " << force; |
||||
|
||||
if (settingsKeys.contains("rfBandwidth") || force) |
||||
{ |
||||
m_interpolator.create(16, m_channelSampleRate, settings.m_rfBandwidth / 2.2); |
||||
m_interpolatorDistance = (Real) m_channelSampleRate / (Real) InmarsatDemodSettings::CHANNEL_SAMPLE_RATE; |
||||
m_interpolatorDistanceRemain = m_interpolatorDistance; |
||||
|
||||
// Limit costas loop frequency range to stay within RF bandwidth - it probably can't track this far anyway
|
||||
Real freqMaxHz = (settings.m_rfBandwidth / 2.0f - InmarsatDemodSettings::BAUD_RATE / 2.0f); |
||||
//qDebug() << "InmarsatDemodSink::applySettings: Costas loop freq limit: +/-" << freqMaxHz << "Hz";
|
||||
Real freqMax = freqMaxHz * 2 * M_PI / COSTAS_LOOP_RATE; |
||||
m_costasLoop.setMaxFreq(freqMax); |
||||
m_costasLoop.setMinFreq(-freqMax); |
||||
} |
||||
|
||||
if (settingsKeys.contains("rfBandwidth") || settingsKeys.contains("rrcRolloff") || force) { |
||||
m_rrcFilter->create_rrc_filter(settings.m_rfBandwidth / (float) m_channelSampleRate, settings.m_rrcRolloff); |
||||
} |
||||
|
||||
if (settingsKeys.contains("pllBandwidth") || force) { |
||||
m_costasLoop.computeCoefficients(settings.m_pllBW); |
||||
} |
||||
|
||||
if (settingsKeys.contains("ssBandwidth") || force) |
||||
{ |
||||
/*
|
||||
float kd = 1.5f; // TED gain
|
||||
float zeta = 1.0f / sqrtf(2.0f); // Damping factor - critical damping
|
||||
float theta = (m_settings.m_ssBW / SAMPLES_PER_SYMBOL) / (zeta + (1.0f / (4.0f * zeta))); |
||||
float denom = ((1.0f + 2.0f * zeta * theta + theta * theta) * kd); |
||||
|
||||
m_kp = (4.0f * zeta * theta) / denom; |
||||
m_ki = (4.0f * theta * theta) / denom; |
||||
|
||||
qDebug() << "m_kp" << m_kp << "m_ki" << m_ki; |
||||
*/ |
||||
|
||||
m_kp = 0.1f; |
||||
m_ki = 0.01f; |
||||
} |
||||
|
||||
if (force) { |
||||
m_settings = settings; |
||||
} else { |
||||
m_settings.applySettings(settingsKeys, settings); |
||||
} |
||||
} |
||||
@ -0,0 +1,198 @@
@@ -0,0 +1,198 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019-2021 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
||||
// Copyright (C) 2020-2026 Jon Beniston, M7RCE <jon@beniston.com> //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_INMARSATDEMODSINK_H |
||||
#define INCLUDE_INMARSATDEMODSINK_H |
||||
|
||||
#include <inmarsatc_decoder.h> |
||||
#include <inmarsatc_parser.h> |
||||
|
||||
#include "dsp/channelsamplesink.h" |
||||
#include "dsp/nco.h" |
||||
#include "dsp/interpolator.h" |
||||
#include "dsp/fftfilt.h" |
||||
#include "dsp/fftengine.h" |
||||
#include "dsp/fftwindow.h" |
||||
#include "dsp/costasloop.h" |
||||
#include "dsp/rootraisedcosine.h" |
||||
#include "util/movingaverage.h" |
||||
#include "util/messagequeue.h" |
||||
|
||||
#include "inmarsatdemodsettings.h" |
||||
|
||||
class ChannelAPI; |
||||
class InmarsatDemod; |
||||
class ScopeVis; |
||||
|
||||
class AGC { |
||||
public: |
||||
AGC(); |
||||
Complex processOneSample(const Complex &iq, bool locked); |
||||
Real getGain() const { return m_gain; } |
||||
Real getAverage() const { return m_agcMovingAverage.instantAverage(); } |
||||
|
||||
private: |
||||
Real m_gain; |
||||
MovingAverageUtil<Real, double, 200> m_agcMovingAverage; |
||||
}; |
||||
|
||||
class FrequencyOffsetEstimate { |
||||
public: |
||||
FrequencyOffsetEstimate(); |
||||
~FrequencyOffsetEstimate(); |
||||
void processOneSample(Complex& iq, bool locked); |
||||
Real getFreqHz() const { return m_freqOffsetHz; } |
||||
Real getCurrentFreqHz() const { return m_currentFreqOffsetHz; } |
||||
Real getFreqMagSq() const { return m_freqMagSq; } |
||||
Real getCurrentFreqMagSq() const { return m_currentFreqMagSq; } |
||||
|
||||
private: |
||||
int m_fftSequence; |
||||
FFTEngine *m_fft; |
||||
int m_fftCounter; |
||||
FFTWindow m_fftWindow; |
||||
int m_fftSize; |
||||
int m_freqOffsetBin; |
||||
Real m_freqOffsetHz; |
||||
Real m_currentFreqOffsetHz; |
||||
Real m_freqMagSq; |
||||
Real m_currentFreqMagSq; |
||||
NCO m_freqOffsetNCO; |
||||
|
||||
Real magSq(int bin) const; |
||||
}; |
||||
|
||||
class InmarsatDemodSink : public ChannelSampleSink { |
||||
public: |
||||
InmarsatDemodSink(InmarsatDemod *stdcDemod); |
||||
~InmarsatDemodSink(); |
||||
|
||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end); |
||||
|
||||
void setScopeSink(ScopeVis* scopeSink) { m_scopeSink = scopeSink; } |
||||
void applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force = false); |
||||
void applySettings(const InmarsatDemodSettings& settings, const QStringList& settingsKeys, bool force = false); |
||||
void setMessageQueueToChannel(MessageQueue *messageQueue) { m_messageQueueToChannel = messageQueue; } |
||||
void setChannel(ChannelAPI *channel) { m_channel = channel; } |
||||
|
||||
double getMagSq() const { return m_magsq; } |
||||
|
||||
void getMagSqLevels(double& avg, double& peak, int& nbSamples) |
||||
{ |
||||
if (m_magsqCount > 0) |
||||
{ |
||||
m_magsq = m_magsqSum / m_magsqCount; |
||||
m_magSqLevelStore.m_magsq = m_magsq; |
||||
m_magSqLevelStore.m_magsqPeak = m_magsqPeak; |
||||
} |
||||
|
||||
avg = m_magSqLevelStore.m_magsq; |
||||
peak = m_magSqLevelStore.m_magsqPeak; |
||||
nbSamples = m_magsqCount == 0 ? 1 : m_magsqCount; |
||||
|
||||
m_magsqSum = 0.0f; |
||||
m_magsqPeak = 0.0f; |
||||
m_magsqCount = 0; |
||||
} |
||||
|
||||
void getPLLStatus(bool &locked, Real &coarseFreqCurrent, Real &coarseFreqCurrentPower, Real &coarseFreq, Real &coarseFreqPower, Real &fineFreq) const; |
||||
|
||||
private: |
||||
struct MagSqLevelsStore |
||||
{ |
||||
MagSqLevelsStore() : |
||||
m_magsq(1e-12), |
||||
m_magsqPeak(1e-12) |
||||
{} |
||||
double m_magsq; |
||||
double m_magsqPeak; |
||||
}; |
||||
|
||||
ScopeVis* m_scopeSink; // Scope GUI to display baseband waveform
|
||||
InmarsatDemod *m_inmarsatDemod; |
||||
InmarsatDemodSettings m_settings; |
||||
ChannelAPI *m_channel; |
||||
int m_channelSampleRate; |
||||
int m_channelFrequencyOffset; |
||||
|
||||
NCO m_nco; |
||||
Interpolator m_interpolator; |
||||
Real m_interpolatorDistance; |
||||
Real m_interpolatorDistanceRemain; |
||||
|
||||
double m_magsq; |
||||
double m_magsqSum; |
||||
double m_magsqPeak; |
||||
int m_magsqCount; |
||||
MagSqLevelsStore m_magSqLevelStore; |
||||
|
||||
MessageQueue *m_messageQueueToChannel; |
||||
|
||||
MovingAverageUtil<Real, double, 16> m_movingAverage; |
||||
|
||||
inmarsatc::decoder::Decoder m_decoder; |
||||
inmarsatc::frameParser::PacketDecoder m_parser; |
||||
|
||||
CostasLoop m_costasLoop; |
||||
Complex m_ref; |
||||
Complex m_derot; |
||||
MovingAverageUtil<Real, double, 1000> m_lockAverage; |
||||
bool m_locked; |
||||
|
||||
static const int RRC_FILTER_SIZE = 256; |
||||
fftfilt *m_rrcFilter; |
||||
Complex m_rrcBuffer[RRC_FILTER_SIZE]; |
||||
RootRaisedCosine<Real> m_rrcI; //!< Square root raised cosine filter for I samples
|
||||
RootRaisedCosine<Real> m_rrcQ; //!< Square root raised cosine filter for Q samples
|
||||
int m_rrcBufferIndex; |
||||
|
||||
static const int SAMPLES_PER_SYMBOL = InmarsatDemodSettings::CHANNEL_SAMPLE_RATE / InmarsatDemodSettings::BAUD_RATE; |
||||
static const int m_maxSamplesPerSymbol = SAMPLES_PER_SYMBOL * 2; |
||||
static const int COSTAS_LOOP_RATE = InmarsatDemodSettings::BAUD_RATE; // Costas loop is run at symbol rate
|
||||
|
||||
int m_sampleIdx; |
||||
QQueue<Complex> m_filteredSamples; |
||||
float m_ki; |
||||
float m_kp; |
||||
Real m_error; |
||||
Real m_errorSum; |
||||
Real m_mu; |
||||
int m_adjustedSPS; |
||||
int m_adjustment; |
||||
qint64 m_totalSampleCount; |
||||
qint64 m_prevTotalSampleCount; |
||||
int m_bit; |
||||
uint8_t m_bits[DEMODULATOR_SYMBOLSPERCHUNK]; |
||||
int m_bitCount; |
||||
|
||||
AGC m_agc; |
||||
FrequencyOffsetEstimate m_frequencyOffsetEst; |
||||
|
||||
ComplexVector m_sampleBuffer[InmarsatDemodSettings::m_scopeStreams]; |
||||
static const int SAMPLE_BUFFER_SIZE = RRC_FILTER_SIZE * 10; // Needs to be a multiple of m_rrcFilterSize, so A & B fill up at the same time
|
||||
int m_sampleBufferIndexA; |
||||
int m_sampleBufferIndexB; |
||||
|
||||
void processOneSample(Complex &ci); |
||||
void decodeBits(); |
||||
MessageQueue *getMessageQueueToChannel() { return m_messageQueueToChannel; } |
||||
void sampleToScopeA(Complex sample, Real magsq, Complex postAGC, Real agcGain, Real agcAvg, Complex postCFO); |
||||
void sampleToScopeB(Complex rrc, Complex tedError, Complex tedErrorSum, Complex ref, Complex derot, int bit, Real mu); |
||||
}; |
||||
|
||||
#endif // INCLUDE_INMARSATDEMODSINK_H
|
||||
@ -0,0 +1,54 @@
@@ -0,0 +1,54 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
||||
// written by Christian Daniel //
|
||||
// Copyright (C) 2015-2020 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
||||
// Copyright (C) 2021-2026 Jon Beniston, M7RCE <jon@beniston.com> //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "SWGChannelSettings.h" |
||||
#include "inmarsatdemod.h" |
||||
#include "inmarsatdemodwebapiadapter.h" |
||||
|
||||
InmarsatDemodWebAPIAdapter::InmarsatDemodWebAPIAdapter() |
||||
{} |
||||
|
||||
InmarsatDemodWebAPIAdapter::~InmarsatDemodWebAPIAdapter() |
||||
{} |
||||
|
||||
int InmarsatDemodWebAPIAdapter::webapiSettingsGet( |
||||
SWGSDRangel::SWGChannelSettings& response, |
||||
QString& errorMessage) |
||||
{ |
||||
(void) errorMessage; |
||||
response.setInmarsatDemodSettings(new SWGSDRangel::SWGInmarsatDemodSettings()); |
||||
response.getInmarsatDemodSettings()->init(); |
||||
InmarsatDemod::webapiFormatChannelSettings(response, m_settings); |
||||
|
||||
return 200; |
||||
} |
||||
|
||||
int InmarsatDemodWebAPIAdapter::webapiSettingsPutPatch( |
||||
bool force, |
||||
const QStringList& channelSettingsKeys, |
||||
SWGSDRangel::SWGChannelSettings& response, |
||||
QString& errorMessage) |
||||
{ |
||||
(void) force; |
||||
(void) errorMessage; |
||||
InmarsatDemod::webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response); |
||||
|
||||
return 200; |
||||
} |
||||
@ -0,0 +1,50 @@
@@ -0,0 +1,50 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
||||
// Copyright (C) 2020-2026 Jon Beniston, M7RCE <jon@beniston.com> //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_INMARSATDEMOD_WEBAPIADAPTER_H |
||||
#define INCLUDE_INMARSATDEMOD_WEBAPIADAPTER_H |
||||
|
||||
#include "channel/channelwebapiadapter.h" |
||||
#include "inmarsatdemodsettings.h" |
||||
|
||||
/**
|
||||
* Standalone API adapter only for the settings |
||||
*/ |
||||
class InmarsatDemodWebAPIAdapter : public ChannelWebAPIAdapter { |
||||
public: |
||||
InmarsatDemodWebAPIAdapter(); |
||||
virtual ~InmarsatDemodWebAPIAdapter(); |
||||
|
||||
virtual QByteArray serialize() const { return m_settings.serialize(); } |
||||
virtual bool deserialize(const QByteArray& data) { return m_settings.deserialize(data); } |
||||
|
||||
virtual int webapiSettingsGet( |
||||
SWGSDRangel::SWGChannelSettings& response, |
||||
QString& errorMessage); |
||||
|
||||
virtual int webapiSettingsPutPatch( |
||||
bool force, |
||||
const QStringList& channelSettingsKeys, |
||||
SWGSDRangel::SWGChannelSettings& response, |
||||
QString& errorMessage); |
||||
|
||||
private: |
||||
InmarsatDemodSettings m_settings; |
||||
}; |
||||
|
||||
#endif // INCLUDE_INMARSATDEMOD_WEBAPIADAPTER_H
|
||||
@ -0,0 +1,102 @@
@@ -0,0 +1,102 @@
|
||||
<h1>Inmarsat C Demodulator Plugin</h1> |
||||
|
||||
<h2>Introduction</h2> |
||||
|
||||
This plugin can be used to demodulate Inmarsat C data packets. They are transmitted by four geostationary satellites. |
||||
|
||||
The packets are BPSK modulated with a symbol rate of 1,200 symbols/s and a data rate of 600 bit/s. |
||||
|
||||
Satellites / frequencies are: |
||||
|
||||
| Atlantic Ocean West | AOR-W | Inmarsat-4 F3 | 98W | 1,537.70 MHz | |
||||
| Atlantic Ocean East | AOR-E | Inmarsat-3 F5 | 54W | 1,541.45 MHz | |
||||
| Pacific Ocean | POR | Inmarsat-4 F1 | 178E | 1,541.45 MHz | |
||||
| Indian Ocean | IOR | Inmarsat-4A F4 / Alphasat | 25E | 1,537.10 MHz | |
||||
|
||||
Messages containing coordinates in the address or message fields can be displayed on the [Map Feature](../../feature/map/readme.md): |
||||
|
||||
 |
||||
|
||||
More information about the encoding of EGC (Enhanced Group Call) messages can be found in: |
||||
[Safety NET Manual](https://www.navcen.uscg.gov/sites/default/files/pdf/gmdss/Safety_NET_Manual.pdf) |
||||
|
||||
<h2>Interface</h2> |
||||
|
||||
The top and bottom bars of the channel window are described [here](../../../sdrgui/channel/readme.md) |
||||
|
||||
 |
||||
|
||||
<h3>1: Frequency shift from center frequency of reception</h3> |
||||
|
||||
Use the wheels to adjust the frequency shift in Hz from the center frequency of reception. Left click on a digit sets the cursor position at this digit. Right click on a digit sets all digits on the right to zero. This effectively floors value at the digit position. Wheels are moved with the mousewheel while pointing at the wheel or by selecting the wheel with the left mouse click and using the keyboard arrows. Pressing shift simultaneously moves digit by 5 and pressing control moves it by 2. |
||||
|
||||
<h3>2: Channel power</h3> |
||||
|
||||
Average total power in dB relative to a +/- 1.0 amplitude signal received in the pass band. |
||||
|
||||
<h3>3: Level meter in dB</h3> |
||||
|
||||
- top bar (green): average value |
||||
- bottom bar (blue green): instantaneous peak value |
||||
- tip vertical bar (bright green): peak hold value |
||||
|
||||
<h3>4: RF Bandwidth</h3> |
||||
|
||||
This specifies the bandwidth of a LPF that is applied to the input signal to limit the RF bandwidth. This should be at least 3 kHz. |
||||
|
||||
<h3>5: PLL Status</h3> |
||||
|
||||
The PLL status icon shows whether the Costas Loop in the demodulator is locked. When unlocked, the padlock icon will appear unlocked. When locked, the padlock icon will appear locked and the background will be green. |
||||
|
||||
Checking the icon will diplay additional PLL status and parameters, but these typically shouldn't require modification. |
||||
|
||||
<h3>6: UDP</h3> |
||||
|
||||
When checked, received packets are forwarded to the specified UDP address (7) and port (8). |
||||
|
||||
<h3>7: UDP address</h3> |
||||
|
||||
IP address of the host to forward received packets to via UDP. |
||||
|
||||
<h3>8: UDP port</h3> |
||||
|
||||
UDP port number to forward received packets to. |
||||
|
||||
<h3>9: Filter Packets by Type</h3> |
||||
|
||||
Entering a regular expression in the Type field displays only packets where the type, displayed in the Type column, matches the regular expression. |
||||
|
||||
<h3>10: Filter Packets by Message</h3> |
||||
|
||||
Entering a regular expression in the Message field displays only packets where the message, displayed in the Message column, matches the regular expression. |
||||
|
||||
<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 |
||||
packet reception time is taken from the file playback time. Otherwise, the current system clock time is used. |
||||
|
||||
<h3>12: Start/stop Logging Packets to .csv File</h3> |
||||
|
||||
When checked, writes all received packets to a .csv file. |
||||
|
||||
<h3>13: .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> |
||||
|
||||
Click to specify a previously written .csv log file, which is read and used to update the table. |
||||
|
||||
<h3>15: Clear Packets from table</h3> |
||||
|
||||
Pressing this button clears all packets from the tables. |
||||
|
||||
<h3>Received Packets</h3> |
||||
|
||||
The received packets area has two tabs, which each contain a table. The Packets table displays the contents of all packets that have been received. The Messages table displays only packets that contain messages. |
||||
Left clicking a row in the table will highlight it. The highlighted packet will be decoded in the area below the tables. |
||||
|
||||
Right click on the table headers to select which columns are visible. Columns can be resized and reordered by dragging. |
||||
|
||||
Right clicking on a cell in the table will show a context menu, allowing the contents to be copied. |
||||
If the message contains coordinates, an option to find that location on the [Map Feature](../../feature/map/readme.md) will be shown. |
||||
Loading…
Reference in new issue