From 70bf67057f18702601f3f90cb014f90e21fe5fa3 Mon Sep 17 00:00:00 2001 From: Benjamin HUMEAU Date: Fri, 2 Oct 2026 13:29:16 +0200 Subject: [PATCH 1/6] Add Linux ARM64 CI build --- .github/workflows/sdrangel.yml | 14 ++++++++++++-- debian/rules | 9 ++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sdrangel.yml b/.github/workflows/sdrangel.yml index 13deaad3b..7adf67e15 100644 --- a/.github/workflows/sdrangel.yml +++ b/.github/workflows/sdrangel.yml @@ -139,9 +139,18 @@ jobs: make -j3 build_linux: - runs-on: ubuntu-24.04 + name: Linux-${{ matrix.arch }} + runs-on: ${{ matrix.runner }} permissions: contents: read + strategy: + fail-fast: false + matrix: + include: + - arch: x64 + runner: ubuntu-24.04 + - arch: arm64 + runner: ubuntu-24.04-arm steps: - uses: actions/checkout@v4 with: @@ -168,7 +177,8 @@ jobs: libavahi-client-dev libavahi-common-dev libaio-dev \ python3-mako python3-cheetah python3-numpy \ autoconf automake libtool ninja-build - bash cmake/ci/build_sdrplay.sh + - name: Install SDRplay API + run: bash cmake/ci/build_sdrplay.sh - name: Build SDRangel on Linux run: | debuild -i -us -uc -b diff --git a/debian/rules b/debian/rules index edb5ad6e6..c722e0569 100755 --- a/debian/rules +++ b/debian/rules @@ -3,6 +3,13 @@ # Override with "debuild -eQT_VERSION=6 ..." to build the Qt6 package. QT_VERSION ?= 5 +DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) +ARCH_OPT := nehalem +ifeq ($(DEB_HOST_ARCH),arm64) +# ARM64 runners cannot compile with the x86-specific nehalem target. +ARCH_OPT := armv8-a +endif + ifeq ($(QT_VERSION),5) QT_CMAKE_OPTION := -DENABLE_QT6=OFF QT_RUNTIME_DEPENDS := libqt5multimedia5-plugins, qtspeech5-speechd-plugin, qml-module-qtlocation, qml-module-qtpositioning, qml-module-qtquick-window2, qml-module-qtquick-dialogs, qml-module-qtquick-controls, qml-module-qtquick-controls2, qml-module-qtquick-layouts, qml-module-qtgraphicaleffects @@ -17,7 +24,7 @@ endif dh $@ --parallel --buildsystem=cmake+ninja override_dh_auto_configure: - dh_auto_configure -- -DARCH_OPT=nehalem $(QT_CMAKE_OPTION) -DENABLE_EXTERNAL_LIBRARIES=AUTO -DDEBUG_OUTPUT=ON -DBUILD_SERVER=OFF + dh_auto_configure -- -DARCH_OPT=$(ARCH_OPT) $(QT_CMAKE_OPTION) -DENABLE_EXTERNAL_LIBRARIES=AUTO -DDEBUG_OUTPUT=ON -DBUILD_SERVER=OFF override_dh_gencontrol: dh_gencontrol -- -Vqt:Depends='$(QT_RUNTIME_DEPENDS)' From f52214babcbc03b1aae3365c47e420a8859ec97d Mon Sep 17 00:00:00 2001 From: Benjamin HUMEAU Date: Fri, 2 Oct 2026 13:48:16 +0200 Subject: [PATCH 2/6] Fix RNNoise build on non-x86 Linux --- external/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 903861a43..9ee4c83dc 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -1069,7 +1069,11 @@ if(ENABLE_FEATURE_DENOISER) set(RNNOISE_ARGS "-DRNN_ENABLE_X86_RTCD=OFF") elseif (LINUX) set(RNNOISE_LIBRARIES "${EXTERNAL_BUILD_LIBRARIES}/lib${LIB_SUFFIX}/librnnoise${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "") - set(RNNOISE_ARGS "-DRNN_ENABLE_X86_RTCD=ON") + if (ARCHITECTURE_x86 OR ARCHITECTURE_x86_64) + set(RNNOISE_ARGS "-DRNN_ENABLE_X86_RTCD=ON") + else() + set(RNNOISE_ARGS "-DRNN_ENABLE_X86_RTCD=OFF") + endif() elseif (APPLE) set(RNNOISE_LIBRARIES "${EXTERNAL_BUILD_LIBRARIES}/rnnoise/src/rnnoise-build/librnnoise${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "") set(RNNOISE_ARGS "-DRNN_ENABLE_X86_RTCD=OFF") From e28d47b3ed5a01bbe31f94539ea6472cb19e3fe0 Mon Sep 17 00:00:00 2001 From: Benjamin HUMEAU Date: Fri, 2 Oct 2026 13:55:31 +0200 Subject: [PATCH 3/6] Fix LimeSuite build on non-x86 platforms --- external/CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 9ee4c83dc..07ac143e5 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -1206,6 +1206,11 @@ else() endif() # Device interface libraries. +set(LIMESUITE_SIMD_ARGS) +if (ARCHITECTURE_x86 OR ARCHITECTURE_x86_64) + set(LIMESUITE_SIMD_ARGS "-DENABLE_SIMD_FLAGS=SSE3") +endif() + if (LINUX) # apt install liblimesuite-dev (only on ubuntu 18.04). Can be picky on version though so let's build it. # needs pkgconfig and libusb @@ -1227,7 +1232,7 @@ if (LINUX) -DENABLE_QUICKTEST=OFF -DENABLE_EXAMPLES=OFF -DENABLE_LIME_UTIL=OFF - -DENABLE_SIMD_FLAGS=SSE3 + ${LIMESUITE_SIMD_ARGS} BUILD_BYPRODUCTS "${LIMESUITE_LIBRARY}" INSTALL_COMMAND "" TEST_COMMAND "" @@ -1439,7 +1444,7 @@ if (WIN32 OR APPLE) -DENABLE_QUICKTEST=OFF -DENABLE_EXAMPLES=OFF -DENABLE_LIME_UTIL=ON - -DENABLE_SIMD_FLAGS=SSE3 + ${LIMESUITE_SIMD_ARGS} -DENABLE_FX3=ON -DFX3_SDK_PATH=${FX3SDK_DIR} -DLIBUSB_1_LIBRARY=${LIBUSB_LIBRARIES} From 71c6099b5e98349ce1223332c004ad4b5ca44867 Mon Sep 17 00:00:00 2001 From: Benjamin HUMEAU Date: Fri, 2 Oct 2026 15:19:20 +0200 Subject: [PATCH 4/6] Make Debian architecture optimization portable --- debian/rules | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/debian/rules b/debian/rules index c722e0569..8ef69f461 100755 --- a/debian/rules +++ b/debian/rules @@ -3,10 +3,12 @@ # Override with "debuild -eQT_VERSION=6 ..." to build the Qt6 package. QT_VERSION ?= 5 -DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) +include /usr/share/dpkg/architecture.mk + +ARCH_OPT := +ifeq ($(DEB_HOST_ARCH),amd64) ARCH_OPT := nehalem -ifeq ($(DEB_HOST_ARCH),arm64) -# ARM64 runners cannot compile with the x86-specific nehalem target. +else ifeq ($(DEB_HOST_ARCH),arm64) ARCH_OPT := armv8-a endif From b8b5c44e8b26664590f1d5e45657add826ecd1c7 Mon Sep 17 00:00:00 2001 From: Benjamin HUMEAU Date: Fri, 2 Oct 2026 16:42:04 +0200 Subject: [PATCH 5/6] Add ARM64 Linux Qt6 release build --- .github/workflows/linux-qt6.yml | 21 ++++++++++++++------- .github/workflows/sdrangel.yml | 14 ++------------ 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/.github/workflows/linux-qt6.yml b/.github/workflows/linux-qt6.yml index a0240bb6c..29433f78a 100644 --- a/.github/workflows/linux-qt6.yml +++ b/.github/workflows/linux-qt6.yml @@ -11,11 +11,18 @@ on: jobs: build_deb: + name: Linux Qt6 ${{ matrix.arch }} strategy: fail-fast: false matrix: - os: [ubuntu-26.04] - runs-on: ${{ matrix.os }} + include: + - os: ubuntu-26.04 + runner: ubuntu-26.04 + arch: amd64 + - os: ubuntu-26.04 + runner: ubuntu-26.04-arm + arch: arm64 + runs-on: ${{ matrix.runner }} steps: - uses: actions/checkout@v4 with: @@ -52,7 +59,7 @@ jobs: rsync -a --delete . /tmp/build/sdrangel/ cd /tmp/build/sdrangel debuild -eQT_VERSION=6 -i -us -uc -b - cp ../sdrangel_*_amd64.deb "$GITHUB_WORKSPACE"/ + cp ../sdrangel_*_${{ matrix.arch }}.deb "$GITHUB_WORKSPACE"/ else debuild -eQT_VERSION=6 -i -us -uc -b fi @@ -65,14 +72,14 @@ jobs: echo "version=$(echo ${{github.ref_name}} | cut -c2-)" >> $GITHUB_OUTPUT fi - name: Rename - run: mv ../sdrangel_*_amd64.deb sdrangel_${{ steps.get_version.outputs.version }}_${{ matrix.os }}_amd64.deb + run: mv ../sdrangel_*_${{ matrix.arch }}.deb sdrangel_${{ steps.get_version.outputs.version }}_${{ matrix.os }}_${{ matrix.arch }}.deb - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: sdrangel_${{ steps.get_version.outputs.version }}_${{ matrix.os }}_amd64.deb - path: sdrangel_${{ steps.get_version.outputs.version }}_${{ matrix.os }}_amd64.deb + name: sdrangel_${{ steps.get_version.outputs.version }}_${{ matrix.os }}_${{ matrix.arch }}.deb + path: sdrangel_${{ steps.get_version.outputs.version }}_${{ matrix.os }}_${{ matrix.arch }}.deb - name: Upload release if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v2 with: - files: sdrangel_${{ steps.get_version.outputs.version }}_${{ matrix.os }}_amd64.deb + files: sdrangel_${{ steps.get_version.outputs.version }}_${{ matrix.os }}_${{ matrix.arch }}.deb diff --git a/.github/workflows/sdrangel.yml b/.github/workflows/sdrangel.yml index 7adf67e15..13deaad3b 100644 --- a/.github/workflows/sdrangel.yml +++ b/.github/workflows/sdrangel.yml @@ -139,18 +139,9 @@ jobs: make -j3 build_linux: - name: Linux-${{ matrix.arch }} - runs-on: ${{ matrix.runner }} + runs-on: ubuntu-24.04 permissions: contents: read - strategy: - fail-fast: false - matrix: - include: - - arch: x64 - runner: ubuntu-24.04 - - arch: arm64 - runner: ubuntu-24.04-arm steps: - uses: actions/checkout@v4 with: @@ -177,8 +168,7 @@ jobs: libavahi-client-dev libavahi-common-dev libaio-dev \ python3-mako python3-cheetah python3-numpy \ autoconf automake libtool ninja-build - - name: Install SDRplay API - run: bash cmake/ci/build_sdrplay.sh + bash cmake/ci/build_sdrplay.sh - name: Build SDRangel on Linux run: | debuild -i -us -uc -b From 9e003d8bc73057f565bd328b2be0c98dfe18990d Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Fri, 2 Oct 2026 18:10:13 +0100 Subject: [PATCH 6/6] Pager: Add FLEX support. --- doc/img/PagerDemod_plugin.png | Bin 15729 -> 29846 bytes plugins/channelrx/demodpager/CMakeLists.txt | 4 + plugins/channelrx/demodpager/pagerdemod.cpp | 32 +- plugins/channelrx/demodpager/pagerdemod.h | 31 +- .../channelrx/demodpager/pagerdemodbch.cpp | 165 +++ plugins/channelrx/demodpager/pagerdemodbch.h | 43 + .../channelrx/demodpager/pagerdemodflex.cpp | 1220 +++++++++++++++++ plugins/channelrx/demodpager/pagerdemodflex.h | 307 +++++ .../channelrx/demodpager/pagerdemodgui.cpp | 74 +- plugins/channelrx/demodpager/pagerdemodgui.h | 6 +- plugins/channelrx/demodpager/pagerdemodgui.ui | 73 +- .../demodpager/pagerdemodsettings.cpp | 9 + .../channelrx/demodpager/pagerdemodsettings.h | 22 +- .../channelrx/demodpager/pagerdemodsink.cpp | 335 ++--- plugins/channelrx/demodpager/pagerdemodsink.h | 11 +- plugins/channelrx/demodpager/readme.md | 47 +- .../doc/swagger/include/PagerDemod.yaml | 9 + .../api/swagger/include/PagerDemod.yaml | 9 + .../code/qt5/client/SWGPagerDemodSettings.cpp | 22 + .../code/qt5/client/SWGPagerDemodSettings.h | 6 + 20 files changed, 2163 insertions(+), 262 deletions(-) create mode 100644 plugins/channelrx/demodpager/pagerdemodbch.cpp create mode 100644 plugins/channelrx/demodpager/pagerdemodbch.h create mode 100644 plugins/channelrx/demodpager/pagerdemodflex.cpp create mode 100644 plugins/channelrx/demodpager/pagerdemodflex.h diff --git a/doc/img/PagerDemod_plugin.png b/doc/img/PagerDemod_plugin.png index e5af0073962da41b373b69c1c199a80c164b1ced..35354eb51e153b5b7d1b56c1b4fe27dc5b79b51a 100644 GIT binary patch literal 29846 zcmb5W1yq$$_dbY%N~a**Aq|&qQ97klkhp|&HyEUpbhngrHwc&Rl9cZ56k*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umY;l<3~2`YQ4&Ivdpse$b| z2j^`?U4e?%WvQ1+mtBn)p{EHup%7_mKm%g+1n1`csz31P+H98op006JKIl6AWWKL; zY&P*dzP4KNcfdD?O;LwtA}X8n;d@w;6L=qeWu+CCNJHR8&)TCH+7m zIAF}fHx(_!g$STLm-&zwFfQdXW2^#ymMqZ#1)R>Z{({W?YQwsDVgjny2c2IzDZOa! z6b$XbXQgMpoBVA1P8qe|mdGwiwnnxHmquB#v*^bJNc-5PNg#dN&vZJ6mj)Z>e@Mvt z^kn_8Qdb94V9>As!@>{W;0%hZg}-A>f#y!H8s|25OzuCsFI9dUHuUJmp%uy%zv_8| zce{)DrCqQ8W?_yY9R9yj)vu2m!1;fUoPq^W}uJ}v7%`)8<2nR#`-P3?|AM$xI2m6oAB_QFK z7EA<7-?rkq<>}#XZ$p|-D9r1w)|XG8AiZ{d8SgVflAm6B5{{_jST{rGp!e>`I$a`oY+XVBd==5RF_Wf8(bG*@o?6CkXYKqZG)&eZ^r zfP_;vzps)|@{bF&5eDK;=WyGk5V)gz@K%%sXnZ%2+vZ}#lplTz5?2$n$NE;*erWX2 z@sUm}5d($@j}Q6x%C8x%GbM z&U?LZ4mIjNZPq`!7YW{Q=h3Fb+push(msg); } + bool flex = report.getProtocol() == PagerDemodSettings::FLEX; + QString address = PagerDemodSettings::formatAddress(report.getAddress(), report.getProtocol()); + // Function bits only exist in POCSAG + QString functionBits = flex ? QString() : QString::number(report.getFunctionBits()); + QString protocol = PagerDemodSettings::protocolName(report.getProtocol()); + // Forward via UDP if (m_settings.m_udpEnabled) { @@ -184,14 +190,18 @@ bool PagerDemod::handleMessage(const Message& cmd) message.append('\0'); message.append(report.getDateTime().time().toString().toLatin1()); message.append('\0'); - message.append(QString("%1").arg(report.getAddress(), 7, 10, QChar('0')).toLatin1()); + message.append(address.toLatin1()); message.append('\0'); - message.append(QString::number(report.getFunctionBits()).toLatin1()); + message.append(functionBits.toLatin1()); message.append('\0'); message.append(report.getAlphaMessage().toLatin1()); message.append('\0'); message.append(report.getNumericMessage().toLatin1()); message.append('\0'); + message.append(protocol.toLatin1()); + message.append('\0'); + message.append(report.getType().toLatin1()); + message.append('\0'); m_udpSocket.writeDatagram(message.data(), message.size(), QHostAddress(m_settings.m_udpAddress), m_settings.m_udpPort); } @@ -201,13 +211,16 @@ bool PagerDemod::handleMessage(const Message& cmd) { m_logStream << report.getDateTime().date().toString() << "," << report.getDateTime().time().toString() << "," - << QString("%1").arg(report.getAddress(), 7, 10, QChar('0')) << "," - << QString::number(report.getFunctionBits()) << "," + << address << "," + << functionBits << "," << CSV::escape(report.getAlphaMessage()) << "," << report.getNumericMessage() << "," << QString::number(report.getEvenParityErrors()) << "," << QString::number(report.getBCHParityErrors()) << "," - << QString::number(report.getBaud()) << "\n"; + << QString::number(report.getBaud()) << "," + << protocol << "," + << CSV::escape(report.getType()) << "," + << report.getFrame() << "\n"; m_logStream.flush(); } @@ -294,7 +307,7 @@ void PagerDemod::applySettings(const QStringList& settingsKeys, const PagerDemod if (newFile) { // Write header - m_logStream << "Date,Time,Address,Function Bits,Alpha,Numeric,Even Parity Errors,BCH Parity Errors,Baud\n"; + m_logStream << "Date,Time,Address,Function Bits,Alpha,Numeric,Even Parity Errors,BCH Parity Errors,Baud,Protocol,Type,Frame\n"; } } else @@ -413,6 +426,9 @@ void PagerDemod::webapiUpdateChannelSettings( const QStringList& channelSettingsKeys, SWGSDRangel::SWGChannelSettings& response) { + if (channelSettingsKeys.contains("modulation")) { + settings.m_modulation = (PagerDemodSettings::Modulation) response.getPagerDemodSettings()->getModulation(); + } if (channelSettingsKeys.contains("decode")) { settings.m_decode = (PagerDemodSettings::Decode) response.getPagerDemodSettings()->getDecode(); } @@ -480,6 +496,7 @@ void PagerDemod::webapiUpdateChannelSettings( void PagerDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const PagerDemodSettings& settings) { + response.getPagerDemodSettings()->setModulation((int) settings.m_modulation); response.getPagerDemodSettings()->setDecode((int) settings.m_decode); response.getPagerDemodSettings()->setReverse(settings.m_reverse ? 1 : 0); response.getPagerDemodSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset); @@ -617,6 +634,9 @@ void PagerDemod::webapiFormatChannelSettings( // transfer data that has been modified. When force is on transfer all data except reverse API data + if (channelSettingsKeys.contains("modulation") || force) { + swgPagerDemodSettings->setModulation((int) settings.m_modulation); + } if (channelSettingsKeys.contains("decode") || force) { swgPagerDemodSettings->setDecode((int) settings.m_decode); } diff --git a/plugins/channelrx/demodpager/pagerdemod.h b/plugins/channelrx/demodpager/pagerdemod.h index 9bd410b77..3ce63e9a9 100644 --- a/plugins/channelrx/demodpager/pagerdemod.h +++ b/plugins/channelrx/demodpager/pagerdemod.h @@ -76,23 +76,29 @@ public: MESSAGE_CLASS_DECLARATION public: - int getAddress() const { return m_address; } + qint64 getAddress() const { return m_address; } int getFunctionBits() const { return m_functionBits; } QString getAlphaMessage() const { return m_alphaMessage; } QString getNumericMessage() const { return m_numericMessage; } int getEvenParityErrors() const { return m_evenParityErrors; } int getBCHParityErrors() const { return m_bchParityErrors; } int getBaud() const { return m_baud; } + PagerDemodSettings::Modulation getProtocol() const { return m_protocol; } + QString getType() const { return m_type; } + QString getFrame() const { return m_frame; } QDateTime getDateTime() const { return m_dateTime; } static MsgPagerMessage* create( - int address, + qint64 address, int functionBits, const QString& alphaMessage, const QString& numericMessage, int evenParityErrors, int bchParityErrors, - int baud + int baud, + PagerDemodSettings::Modulation protocol = PagerDemodSettings::POCSAG, + const QString& type = QString(), + const QString& frame = QString() ) { return new MsgPagerMessage( @@ -103,21 +109,29 @@ public: evenParityErrors, bchParityErrors, baud, + protocol, + type, + frame, QDateTime::currentDateTime() ); } private: - int m_address; - int m_functionBits; + qint64 m_address; //!< POCSAG address or FLEX capcode + int m_functionBits; //!< POCSAG only QString m_alphaMessage; QString m_numericMessage; int m_evenParityErrors; int m_bchParityErrors; - int m_baud; + int m_baud; //!< POCSAG baud rate or FLEX bit rate + PagerDemodSettings::Modulation m_protocol; + QString m_type; //!< FLEX message type. Empty for POCSAG, where it's ambiguous + QString m_frame; //!< FLEX cycle/frame and phase QDateTime m_dateTime; - MsgPagerMessage(int address, int functionBits, const QString& alphaMessage, const QString& numericMessage, int evenParityErrors, int bchParityErrors, int baud, QDateTime dateTime) : + MsgPagerMessage(qint64 address, int functionBits, const QString& alphaMessage, const QString& numericMessage, + int evenParityErrors, int bchParityErrors, int baud, PagerDemodSettings::Modulation protocol, + const QString& type, const QString& frame, QDateTime dateTime) : Message(), m_address(address), m_functionBits(functionBits), @@ -126,6 +140,9 @@ public: m_evenParityErrors(evenParityErrors), m_bchParityErrors(bchParityErrors), m_baud(baud), + m_protocol(protocol), + m_type(type), + m_frame(frame), m_dateTime(dateTime) { } diff --git a/plugins/channelrx/demodpager/pagerdemodbch.cpp b/plugins/channelrx/demodpager/pagerdemodbch.cpp new file mode 100644 index 000000000..8ee0255d9 --- /dev/null +++ b/plugins/channelrx/demodpager/pagerdemodbch.cpp @@ -0,0 +1,165 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2021-2026 Jon Beniston, M7RCE // +// Some code by AI // +// // +// 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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#include "pagerdemodbch.h" + +// XOR bits together for parity check +int PagerDemodBCH::xorBits(quint32 word, int firstBit, int lastBit) +{ + int x = 0; + for (int i = firstBit; i <= lastBit; i++) + { + x ^= (word >> i) & 1; + } + return x; +} + +// Check for even parity +bool PagerDemodBCH::evenParity(quint32 word, int firstBit, int lastBit, int parityBit) +{ + return xorBits(word, firstBit, lastBit) == parityBit; +} + +// Reverse order of bits +quint32 PagerDemodBCH::reverse(quint32 x) +{ + x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); + x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); + x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); + x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); + return((x >> 16) | (x << 16)); +} + +// Calculate BCH parity bits +quint32 PagerDemodBCH::encode(const quint32 cw) +{ + quint32 bit = 0; + quint32 localCW = cw & 0xFFFFF800; // Mask off BCH parity and even parity bits + quint32 cwE = localCW; + + // Calculate BCH bits + for (bit = 1; bit <= 21; bit++) + { + if (cwE & 0x80000000) { + cwE ^= 0xED200000; + } + cwE <<= 1; + } + localCW |= (cwE >> 21); + + return localCW; +} + +// Use BCH decoding to try to fix any bit errors +// Returns true if able to be decode/repair successful +// See: https://www.eevblog.com/forum/microcontrollers/practical-guides-to-bch-fec/ +bool PagerDemodBCH::decode(const quint32 cw, quint32& correctedCW) +{ + // Calculate syndrome + // We do this by recalculating the BCH parity bits and XORing them against the received ones + quint32 syndrome = ((encode(cw) ^ cw) >> 1) & 0x3FF; + + if (syndrome == 0) + { + // Syndrome of zero indicates no repair required + correctedCW = cw; + return true; + } + + // Meggitt decoder + + quint32 result = 0; + quint32 damagedCW = cw; + + // Calculate BCH bits + for (quint32 xbit = 0; xbit < 31; xbit++) + { + // Produce the next corrected bit in the high bit of the result + result <<= 1; + if ((syndrome == 0x3B4) || // 0x3B4: Syndrome when a single error is detected in the MSB + (syndrome == 0x26E) || // 0x26E: Two adjacent errors + (syndrome == 0x359) || // 0x359: Two errors, one OK bit between + (syndrome == 0x076) || // 0x076: Two errors, two OK bits between + (syndrome == 0x255) || // 0x255: Two errors, three OK bits between + (syndrome == 0x0F0) || // 0x0F0: Two errors, four OK bits between + (syndrome == 0x216) || + (syndrome == 0x365) || + (syndrome == 0x068) || + (syndrome == 0x25A) || + (syndrome == 0x343) || + (syndrome == 0x07B) || + (syndrome == 0x1E7) || + (syndrome == 0x129) || + (syndrome == 0x14E) || + (syndrome == 0x2C9) || + (syndrome == 0x0BE) || + (syndrome == 0x231) || + (syndrome == 0x0C2) || + (syndrome == 0x20F) || + (syndrome == 0x0DD) || + (syndrome == 0x1B4) || + (syndrome == 0x2B4) || + (syndrome == 0x334) || + (syndrome == 0x3F4) || + (syndrome == 0x394) || + (syndrome == 0x3A4) || + (syndrome == 0x3BC) || + (syndrome == 0x3B0) || + (syndrome == 0x3B6) || + (syndrome == 0x3B5) + ) + { + // Syndrome matches an error in the MSB + // Correct that error and adjust the syndrome to account for it + syndrome ^= 0x3B4; + result |= (~damagedCW & 0x80000000) >> 30; + } + else + { + // No error + result |= (damagedCW & 0x80000000) >> 30; + } + damagedCW <<= 1; + + // Handle syndrome shift register feedback + if (syndrome & 0x200) + { + syndrome <<= 1; + syndrome ^= 0x769; // 0x769 = POCSAG generator polynomial -- x^10 + x^9 + x^8 + x^6 + x^5 + x^3 + 1 + } + else + { + syndrome <<= 1; + } + // Mask off bits which fall off the end of the syndrome shift register + syndrome &= 0x3FF; + } + + // Check if error correction was successful + if (syndrome != 0) + { + // Syndrome nonzero at end indicates uncorrectable errors + correctedCW = cw; + return false; + } + + // The BCH decoder operates on bits 31 through 1. Preserve the separate + // overall parity bit in bit 0 so it can be checked after correction. + correctedCW = result | (cw & 0x1); + return true; +} diff --git a/plugins/channelrx/demodpager/pagerdemodbch.h b/plugins/channelrx/demodpager/pagerdemodbch.h new file mode 100644 index 000000000..7d4e124af --- /dev/null +++ b/plugins/channelrx/demodpager/pagerdemodbch.h @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2021-2026 Jon Beniston, M7RCE // +// Some code by AI // +// // +// 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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#ifndef INCLUDE_PAGERDEMODBCH_H +#define INCLUDE_PAGERDEMODBCH_H + +#include + +// BCH(31,21) code plus an even parity bit, as used by both POCSAG and FLEX. +// +// Codewords are in POCSAG bit order: bit 31 is transmitted first, bits 31-11 are data, +// bits 10-1 are the BCH check bits and bit 0 is even parity over the whole word. +// FLEX transmits codewords LSB first, so FLEX words are bit reversed with reverse() +// before and after decoding. +class PagerDemodBCH +{ +public: + //!< Returns cw with the BCH check bits (10-1) calculated. Parity bit 0 is cleared + static quint32 encode(quint32 cw); + //!< Corrects up to two bit errors in bits 31-1. Bit 0 is passed through unchanged. + //!< Returns false if the errors are uncorrectable, in which case correctedCW = cw + static bool decode(quint32 cw, quint32& correctedCW); + static quint32 reverse(quint32 x); + static int xorBits(quint32 word, int firstBit, int lastBit); + static bool evenParity(quint32 word, int firstBit, int lastBit, int parityBit); +}; + +#endif // INCLUDE_PAGERDEMODBCH_H diff --git a/plugins/channelrx/demodpager/pagerdemodflex.cpp b/plugins/channelrx/demodpager/pagerdemodflex.cpp new file mode 100644 index 000000000..62305cbe9 --- /dev/null +++ b/plugins/channelrx/demodpager/pagerdemodflex.cpp @@ -0,0 +1,1220 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2026 Jon Beniston, M7RCE // +// Some code by AI // +// // +// 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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#include + +#include +#include +#include + +#include "pagerdemodbch.h" +#include "pagerdemodflex.h" + +// 4-bit BCD. 0xC is fill +const char PagerDemodFlexDecoder::m_numericChars[17] = "0123456789 U -]["; + +bool PagerDemodFlexMessage::isNumeric() const +{ + return (m_type == Tone) + || (m_type == StandardNumeric) + || (m_type == SpecialNumeric) + || (m_type == NumberedNumeric); +} + +QString PagerDemodFlexMessage::typeName(Type type) +{ + switch (type) + { + case Secure: + return "Secure"; + case ShortInstruction: + return "Instruction"; + case Tone: + return "Tone"; + case StandardNumeric: + return "Numeric"; + case SpecialNumeric: + return "Special Numeric"; + case Alphanumeric: + return "Alpha"; + case Binary: + return "Binary"; + case NumberedNumeric: + return "Numbered Numeric"; + } + return ""; +} + +bool PagerDemodFlexDecoder::checksumValid(quint32 data) +{ + quint32 sum = (data & 0xf) + + ((data >> 4) & 0xf) + + ((data >> 8) & 0xf) + + ((data >> 12) & 0xf) + + ((data >> 16) & 0xf) + + ((data >> 20) & 0x1); + return (sum & 0xf) == 0xf; +} + +quint32 PagerDemodFlexDecoder::setChecksum(quint32 data) +{ + data &= 0x1ffff0; + quint32 sum = ((data >> 4) & 0xf) + + ((data >> 8) & 0xf) + + ((data >> 12) & 0xf) + + ((data >> 16) & 0xf) + + ((data >> 20) & 0x1); + return data | ((0xf - (sum & 0xf)) & 0xf); +} + +bool PagerDemodFlexDecoder::correct(quint32 word, quint32& data, bool& parityError) +{ + // Received LSB first, so reverse to the bit order the BCH decoder uses + quint32 cw = PagerDemodBCH::reverse(word); + quint32 corrected; + bool ok = PagerDemodBCH::decode(cw, corrected); + + data = PagerDemodBCH::reverse(corrected) & 0x1fffff; + parityError = !PagerDemodBCH::evenParity(corrected, 1, 31, corrected & 1); + return ok; +} + +quint32 PagerDemodFlexDecoder::encode(quint32 data) +{ + quint32 cw = PagerDemodBCH::encode(PagerDemodBCH::reverse(data & 0x1fffff)); + cw |= PagerDemodBCH::xorBits(cw, 1, 31); + return PagerDemodBCH::reverse(cw); +} + +bool PagerDemodFlexDecoder::isLongAddress(quint32 addressWord) +{ + return (addressWord < 0x008001) + || ((addressWord > 0x1e0000) && (addressWord < 0x1f0001)) + || (addressWord > 0x1f7ffe); +} + +void PagerDemodFlexDecoder::reset() +{ + m_fragments.clear(); + + for (auto& group : m_groupCalls) { + group = Group(); + } +} + +QList PagerDemodFlexDecoder::decodeFrame(const Frame& frame) +{ + QList timedOut; + const int framesPerHour = m_cycles * m_framesPerCycle; + int frameIndex = frame.m_cycle * m_framesPerCycle + frame.m_frame; + + // Output fragmented messages whose next part is overdue + for (auto it = m_fragments.begin(); it != m_fragments.end(); ) + { + int age = (frameIndex - it->m_frameIndex + framesPerHour) % framesPerHour; + + if (age > m_fragmentTimeoutFrames) + { + it->m_message.m_incomplete = true; + timedOut.append(it->m_message); + it = m_fragments.erase(it); + } + else + { + ++it; + } + } + + // Expand group calls before their groups can expire + QList messages = expandGroups(timedOut); + expireGroups(frameIndex); + + m_codewords = 0; + m_uncorrectable = 0; + QList decoded; + + for (const auto& phase : frame.m_phases) { + decodePhase(frame, phase, decoded); + } + + messages.append(expandGroups(decoded)); + return messages; +} + +QList PagerDemodFlexDecoder::flush() +{ + QList messages; + + for (auto& fragment : m_fragments) + { + fragment.m_message.m_incomplete = true; + messages.append(fragment.m_message); + } + + m_fragments.clear(); + return expandGroups(messages); +} + +// Short instruction vector: instruction (bits 7-9). Instruction 0 assigns the address to +// a temporary address (bits 17-20) for a frame (bits 10-16) in this cycle or the next +void PagerDemodFlexDecoder::assignGroup(const Frame& frame, qint64 capcode, quint32 viw) +{ + if (((viw >> 7) & 0x7) != 0) { + return; + } + + int assignedFrame = (viw >> 10) & 0x7f; + int group = (viw >> 17) & 0xf; + int cycle = frame.m_cycle; + + if (assignedFrame <= frame.m_frame) { + cycle = (cycle + 1) % m_cycles; + } + + int frameIndex = cycle * m_framesPerCycle + assignedFrame; + Group& groupCall = m_groupCalls[group]; + + // A temporary address is only used for one call at a time, so an assignment + // for a different frame starts a new group + if (groupCall.m_frameIndex != frameIndex) + { + groupCall.m_capcodes.clear(); + groupCall.m_frameIndex = frameIndex; + } + + if (!groupCall.m_capcodes.contains(capcode) && (groupCall.m_capcodes.size() < m_maxGroupMembers)) { + groupCall.m_capcodes.append(capcode); + } +} + +// Forget groups whose frame has passed without a call, unless the call is a fragmented +// message that is still being received +void PagerDemodFlexDecoder::expireGroups(int frameIndex) +{ + const int framesPerHour = m_cycles * m_framesPerCycle; + + for (int g = 0; g < m_groups; g++) + { + Group& groupCall = m_groupCalls[g]; + + if ((groupCall.m_frameIndex >= 0) && !m_fragments.contains(m_groupCapcodeFirst + g)) + { + int age = (frameIndex - groupCall.m_frameIndex + framesPerHour) % framesPerHour; + + if ((age > 0) && (age < framesPerHour / 2)) + { + qDebug() << "PagerDemodFlexDecoder::expireGroups: Group call missed. Temporary address" << g + << "for" << groupCall.m_capcodes.size() << "capcodes"; + groupCall = Group(); + } + } + } +} + +// Replace messages to temporary addresses, that start in the frame the group was assigned +// for, with a copy for each capcode in the group +QList PagerDemodFlexDecoder::expandGroups(const QList& messages) +{ + QList expanded; + + for (const auto& message : messages) + { + if ((message.m_capcode < m_groupCapcodeFirst) || (message.m_capcode >= m_groupCapcodeFirst + m_groups)) + { + expanded.append(message); + continue; + } + + int group = (int) (message.m_capcode - m_groupCapcodeFirst); + Group& groupCall = m_groupCalls[group]; + PagerDemodFlexMessage groupMessage = message; + groupMessage.m_group = group; + int frameIndex = message.m_cycle * m_framesPerCycle + message.m_frame; + + if (groupCall.m_capcodes.isEmpty() || (groupCall.m_frameIndex != frameIndex)) + { + // Assignments not received, or for a later call, which they're kept for + expanded.append(groupMessage); + } + else + { + for (qint64 capcode : groupCall.m_capcodes) + { + groupMessage.m_capcode = capcode; + expanded.append(groupMessage); + } + + groupCall = Group(); + } + } + + return expanded; +} + +void PagerDemodFlexDecoder::decodePhase(const Frame& frame, const Phase& phase, QList& messages) +{ + quint32 data[m_wordsPerPhase]; + bool valid[m_wordsPerPhase]; + bool parity[m_wordsPerPhase]; + + for (int i = 0; i < m_wordsPerPhase; i++) + { + bool parityError; + bool ok = correct(phase.m_words[i], data[i], parityError); + + m_codewords++; + if (!ok && !phase.m_erased[i]) { + m_uncorrectable++; + } + + // About half of random words pass BCH correction, so words received after the + // carrier was lost are never trusted. Uncorrectable words keep their received + // bits, so message text stays aligned + valid[i] = ok && !phase.m_erased[i]; + parity[i] = valid[i] && parityError; + } + + // Block information word + quint32 biw = data[0]; + + if (!valid[0] || !checksumValid(biw)) { + return; + } + + int aoffset = ((biw >> 8) & 0x3) + 1; // Address field start, after any extra BIWs + int voffset = (biw >> 10) & 0x3f; // Vector field start + int addressWords = voffset - aoffset; + + // Each address word has a vector word at the same offset into the vector field + if ((addressWords < 0) || (voffset + addressWords > m_wordsPerPhase)) { + return; + } + + int frameIndex = frame.m_cycle * m_framesPerCycle + frame.m_frame; + // Message field follows the vector field. Vectors may only point in to it, apart from + // long addresses, which have the first word of their message in the second vector word + int messageField = voffset + addressWords; + + for (int i = aoffset; i < voffset; i++) + { + int j = voffset + i - aoffset; + quint32 aw = data[i]; + + if (!valid[i] || (aw == 0) || (aw == 0x1fffff)) { + continue; // Idle or unknown address + } + + PagerDemodFlexMessage message; + message.m_longAddress = isLongAddress(aw); + message.m_bitRate = frame.m_bitRate; + message.m_cycle = frame.m_cycle; + message.m_frame = frame.m_frame; + message.m_phase = phase.m_name; + + if (message.m_longAddress) + { + // Long addresses use two address words and two vector words + i++; + + if ((i >= voffset) || !valid[i]) { + continue; + } + + message.m_capcode = (qint64) aw + ((qint64) (data[i] ^ 0x1fffff) << 15) + 0x1f9000; + } + else + { + message.m_capcode = (qint64) aw - 0x8000; + } + + // Vector word. Its checksum guards against phantom pages from damaged address words + if (!valid[j] || !checksumValid(data[j])) { + continue; + } + + quint32 viw = data[j]; + message.m_type = (PagerDemodFlexMessage::Type) ((viw >> 4) & 0x7); + + auto countErrors = [&](int w) { + if (!valid[w]) { + message.m_bchErrors++; + } else if (parity[w]) { + message.m_parityErrors++; + } + }; + + switch (message.m_type) + { + case PagerDemodFlexMessage::Alphanumeric: + case PagerDemodFlexMessage::Secure: + case PagerDemodFlexMessage::Binary: + { + int mw1 = (viw >> 7) & 0x7f; // First word of message field + int len = (viw >> 14) & 0x7f; // Words, including the header + int hdr; + + // The header is in the second vector word for long addresses, + // otherwise it's the first word of the message field + if (message.m_longAddress) + { + hdr = j + 1; + } + else + { + hdr = mw1; + mw1++; + } + if (len >= 1) { + len--; + } + + if ((!message.m_longAddress && (hdr < messageField)) + || (hdr >= m_wordsPerPhase) + || ((len > 0) && (mw1 < messageField)) + || (mw1 + len > m_wordsPerPhase)) { + continue; + } + + // Header: fragment check (bits 0-9), continued (10), fragment number (11-12), + // message number (13-18). An unreadable header is taken as a whole message + quint32 header = data[hdr]; + int fragment = valid[hdr] ? (header >> 11) & 0x3 : 3; + bool continued = valid[hdr] && ((header >> 10) & 0x1); + int messageNumber = (header >> 13) & 0x3f; + countErrors(hdr); + + for (int w = mw1; w < mw1 + len; w++) + { + countErrors(w); + quint32 dw = data[w]; + + if (message.m_type == PagerDemodFlexMessage::Binary) + { + if (!message.m_text.isEmpty()) { + message.m_text.append(' '); + } + message.m_text.append(QString("%1").arg(dw, 6, 16, QChar('0')).toUpper()); + } + else + { + for (int c = 0; c < 3; c++) + { + // The first character of a message's first fragment is its signature + if ((c == 0) && (w == mw1) && (fragment == 3)) { + continue; + } + + char ch = (dw >> (7 * c)) & 0x7f; + + // NUL and ETX are used as fill + if ((ch != 0x00) && (ch != 0x03)) { + message.m_text.append(QChar(ch)); + } + } + } + } + + if (message.m_type == PagerDemodFlexMessage::Binary) { + messages.append(message); + } else { + addFragment(message, fragment, continued, messageNumber, frameIndex, messages); + } + break; + } + + case PagerDemodFlexMessage::StandardNumeric: + case PagerDemodFlexMessage::SpecialNumeric: + case PagerDemodFlexMessage::NumberedNumeric: + { + int w1 = (viw >> 7) & 0x7f; + int w2 = ((viw >> 14) & 0x7) + w1; + std::vector words; + + // For long addresses, the first digits are in the second vector word + if (message.m_longAddress) + { + words.push_back(j + 1); + for (int w = w1; w < w2; w++) { + words.push_back(w); + } + } + else + { + for (int w = w1; w <= w2; w++) { + words.push_back(w); + } + } + + bool inMessageField = std::all_of(words.begin(), words.end(), [&](int w) { + return (w >= messageField) || (message.m_longAddress && (w == j + 1)); + }); + + if (!inMessageField || (words.back() >= m_wordsPerPhase)) { + continue; + } + + // Digits are 4 bits, LSB first, after a 2-bit header (10 bits for numbered numeric) + int count = 4 + ((message.m_type == PagerDemodFlexMessage::NumberedNumeric) ? 10 : 2); + unsigned int digit = 0; + + for (int w : words) + { + countErrors(w); + quint32 dw = data[w]; + + for (int k = 0; k < 21; k++) + { + digit = (digit >> 1) & 0x7; + if (dw & 1) { + digit |= 0x8; + } + dw >>= 1; + + if (--count == 0) + { + if (digit != 0xc) { + message.m_text.append(m_numericChars[digit]); + } + count = 4; + } + } + } + + messages.append(message); + break; + } + + case PagerDemodFlexMessage::Tone: + { + // Short message type 0 carries 3 digits in the vector word (8 for long addresses). + // Other types are tone only + if (((viw >> 7) & 0x3) == 0) + { + for (int b = 9; b <= 17; b += 4) + { + unsigned int digit = (viw >> b) & 0xf; + if (digit != 0xc) { + message.m_text.append(m_numericChars[digit]); + } + } + + if (message.m_longAddress) + { + countErrors(j + 1); + for (int b = 0; b <= 16; b += 4) + { + unsigned int digit = (data[j + 1] >> b) & 0xf; + if (digit != 0xc) { + message.m_text.append(m_numericChars[digit]); + } + } + } + } + + messages.append(message); + break; + } + + case PagerDemodFlexMessage::ShortInstruction: + assignGroup(frame, message.m_capcode, viw); + break; + } + } +} + +// Alphanumeric messages can be split over several frames. The first fragment is numbered 3, +// subsequent fragments 0, 1, 2, 0..., and all but the last have the continued flag set. +// All fragments of a message have the same message number +void PagerDemodFlexDecoder::addFragment(PagerDemodFlexMessage& message, int fragment, bool continued, int messageNumber, int frameIndex, QList& messages) +{ + auto it = m_fragments.find(message.m_capcode); + + // A continuation of a different message means the rest of the earlier one was lost + if ((fragment != 3) && (it != m_fragments.end()) && (it->m_messageNumber != messageNumber)) + { + it->m_message.m_incomplete = true; + messages.append(it->m_message); + m_fragments.erase(it); + it = m_fragments.end(); + } + + if (fragment == 3) + { + // A new message, so any earlier one for this capcode won't be completed + if (it != m_fragments.end()) + { + it->m_message.m_incomplete = true; + messages.append(it->m_message); + m_fragments.erase(it); + } + + if (continued) { + m_fragments.insert(message.m_capcode, Fragment{message, messageNumber, 0, frameIndex}); + } else { + messages.append(message); + } + } + else if (it == m_fragments.end()) + { + // The start of the message was missed + message.m_incomplete = true; + + if (continued) { + m_fragments.insert(message.m_capcode, Fragment{message, messageNumber, (fragment + 1) % 3, frameIndex}); + } else { + messages.append(message); + } + } + else + { + Fragment& part = *it; + + if (fragment != part.m_nextFragment) { + part.m_message.m_incomplete = true; + } + + part.m_message.m_text.append(message.m_text); + part.m_message.m_bchErrors += message.m_bchErrors; + part.m_message.m_parityErrors += message.m_parityErrors; + part.m_nextFragment = (fragment + 1) % 3; + part.m_frameIndex = frameIndex; + + if (!continued) + { + messages.append(part.m_message); + m_fragments.erase(it); + } + } +} + +PagerDemodFlex::PagerDemodFlex(int sampleRate) : + m_sampleRate(sampleRate), + m_sps1600(sampleRate / 1600) +{ + int histSize = 1; + while (histSize <= m_syncBits * m_sps1600) { + histSize <<= 1; + } + + m_fm.resize(histSize); + m_magsq.resize(histSize); + m_mfHist.resize(histSize); + // Large enough for the flywheel's widest search window + int candidateSize = 2 * m_sps1600 * m_flywheelFrames + 2; + m_candidateMetric.resize(candidateSize); + m_candidateCode.resize(candidateSize); + m_candidateInverted.resize(candidateSize); + m_candidateDC.resize(candidateSize); + m_candidatePower.resize(candidateSize); + m_histMask = histSize - 1; + m_syncReg.resize(m_sps1600); + reset(); +} + +void PagerDemodFlex::reset() +{ + std::fill(m_fm.begin(), m_fm.end(), 0.0f); + std::fill(m_magsq.begin(), m_magsq.end(), 0.0f); + std::fill(m_mfHist.begin(), m_mfHist.end(), 0.0f); + std::fill(m_syncReg.begin(), m_syncReg.end(), 0); + m_sum1600 = 0.0; + m_sum3200 = 0.0; + m_sumSync = 0.0; + m_sumMagsqSync = 0.0; + m_mf1600 = 0.0f; + m_mf3200 = 0.0f; + m_sampleCount = 0; + m_state = Hunting; + m_candidate = false; + m_flywheel = false; + m_decoder.reset(); + m_messages.clear(); + m_frameCount = 0; + m_lastFrameSample = 0; + m_lastFrame = FrameInfo(); +} + +int PagerDemodFlex::popcount64(quint64 x) +{ + return (int) std::bitset<64>(x).count(); +} + +// 64-bit sync code: 16-bit mode code, 0xA6C6AAAA, then the inverted mode code +bool PagerDemodFlex::syncMatch(quint64 reg, quint16& code) +{ + quint32 marker = (reg >> 16) & 0xffffffff; + quint16 high = (reg >> 48) & 0xffff; + quint16 low = ~reg & 0xffff; + + if ((popcount64(marker ^ 0xa6c6aaaa) < 4) && (popcount64(high ^ low) < 4)) + { + code = high; + return true; + } + + return false; +} + +bool PagerDemodFlex::mode(quint16& code, int& baud, int& levels) +{ + static const struct { + quint16 m_code; + int m_baud; + int m_levels; + } modes[] = { + {0x870c, 1600, 2}, + {0xb068, 1600, 4}, + {0x7b18, 3200, 2}, + {0xdea0, 3200, 4} + }; + + for (const auto& m : modes) + { + if (popcount64(code ^ m.m_code) <= 3) + { + code = m.m_code; + baud = m.m_baud; + levels = m.m_levels; + return true; + } + } + + return false; +} + +void PagerDemodFlex::process(float fm, float magsq) +{ + qint64 n = m_sampleCount++; + const int syncSamples = m_syncBits * m_sps1600; + int idx = n & m_histMask; + + // Running sums for the matched filters (a boxcar over one symbol), and the mean + // frequency and power over the sync code, which has as many 1s as 0s + float old1600 = m_fm[(n - m_sps1600) & m_histMask]; + float old3200 = m_fm[(n - m_sps1600 / 2) & m_histMask]; + float oldSync = m_fm[(n - syncSamples) & m_histMask]; + float oldMagsq = m_magsq[(n - syncSamples) & m_histMask]; + m_fm[idx] = fm; + m_magsq[idx] = magsq; + m_sum1600 += fm - old1600; + m_sum3200 += fm - old3200; + m_sumSync += fm - oldSync; + m_sumMagsqSync += magsq - oldMagsq; + + // Recalculate the sums occasionally, so rounding errors can't accumulate + if ((n & 0xfffff) == 0) + { + m_sum1600 = m_sum3200 = m_sumSync = m_sumMagsqSync = 0.0; + for (int i = 0; i < syncSamples; i++) + { + int j = (n - i) & m_histMask; + if (i < m_sps1600) { + m_sum1600 += m_fm[j]; + } + if (i < m_sps1600 / 2) { + m_sum3200 += m_fm[j]; + } + m_sumSync += m_fm[j]; + m_sumMagsqSync += m_magsq[j]; + } + } + + m_mf1600 = m_sum1600 / m_sps1600; + m_mf3200 = m_sum3200 / (m_sps1600 / 2); + m_mfHist[idx] = m_mf1600; + + // Sync 1 is searched for on every sample phase of the 1600 bit/s stream. + // Bits are 1 for low frequency, which is multimon-ng's normal polarity + float dc = m_sumSync / syncSamples; + quint64& reg = m_syncReg[n % m_sps1600]; + reg = (reg << 1) | ((m_mf1600 < dc) ? 1 : 0); + + switch (m_state) + { + case Hunting: + hunt(n, reg, dc); + break; + + case FIW: + if (n >= std::llround(m_nextBitSample)) { + fiwBit(m_mf1600); + } + break; + + case Data: + dataSample((m_info.m_baud == 3200) ? m_mf3200 : m_mf1600, magsq); + break; + } +} + +void PagerDemodFlex::hunt(qint64 n, quint64 reg, float dc) +{ + const int syncSamples = m_syncBits * m_sps1600; + quint16 code; + bool inverted = false; + bool match = syncMatch(reg, code); + + if (!match) + { + match = syncMatch(~reg, code); + inverted = match; + } + + int baud, levels; + if (match && !mode(code, baud, levels)) { + match = false; // Unsupported mode, e.g. ReFLEX + } + + if (match) + { + // A sync match takes precedence over the flywheel's prediction + if (!m_candidate || m_candidateFlywheel) { + openCandidate(n, n + m_sps1600, false); + } + + // Matches occur on a run of consecutive sample phases. With a good signal, that's + // nearly all of them, so the best timing is where the matched filter output over + // the sync code is largest. Phases at the edges of the run, where bit decisions + // are marginal, can read the mode code with errors, so the mode is taken from + // the best phase too + int i = (int) (n - m_candidateFirst); + float metric = 0.0f; + + for (int k = 0; k < m_syncBits; k++) { + metric += std::fabs(m_mfHist[(n - k * m_sps1600) & m_histMask] - dc); + } + + m_candidateMetric[i] = metric; + m_candidateCode[i] = code; + m_candidateInverted[i] = inverted; + m_candidateDC[i] = dc; + m_candidatePower[i] = m_sumMagsqSync / syncSamples; + } + else if (m_flywheel && (!m_candidate || m_candidateFlywheel)) + { + flywheelSample(n, reg, dc); + } + + if (m_candidate && (n + 1 >= m_candidateEnd)) + { + m_candidate = false; + + if (*std::max_element(m_candidateMetric.begin(), m_candidateMetric.end()) > 0.0f) { + startFrame(); + } + } + + // The decoder times fragments out in frames, which it only sees while frames are + // received, so output any still waiting once that long has passed without a frame + const qint64 fragmentTimeout = (qint64) PagerDemodFlexDecoder::m_fragmentTimeoutFrames * m_sampleRate * 15 / 8; + + if (((n & 0xffff) == 0) && m_decoder.hasFragments() && (n - m_lastFrameSample > fragmentTimeout)) { + m_messages.append(m_decoder.flush()); + } +} + +void PagerDemodFlex::openCandidate(qint64 first, qint64 end, bool flywheel) +{ + m_candidate = true; + m_candidateFlywheel = flywheel; + m_candidateFirst = first; + m_candidateEnd = end; + std::fill(m_candidateMetric.begin(), m_candidateMetric.end(), 0.0f); +} + +// Search for the predicted sync code, with many more bit errors allowed than for a sync match +void PagerDemodFlex::flywheelSample(qint64 n, quint64 reg, float dc) +{ + const int frameSamples = m_sampleRate * 15 / 8; + // The window widens with time since the last frame, to allow for clock error + double halfWidth = m_sps1600 * m_flywheelPeriods; + qint64 first = (qint64) std::floor(m_flywheelSyncEnd - halfWidth); + qint64 last = (qint64) std::ceil(m_flywheelSyncEnd + halfWidth); + + if (n > last) + { + // Nothing found, so predict the frame after + if (m_flywheelPeriods < m_flywheelFrames) + { + m_flywheelPeriods++; + m_flywheelSyncEnd += frameSamples; + if (++m_flywheelFrame == PagerDemodFlexDecoder::m_framesPerCycle) + { + m_flywheelFrame = 0; + m_flywheelCycle = (m_flywheelCycle + 1) % PagerDemodFlexDecoder::m_cycles; + } + } + else + { + m_flywheel = false; + } + return; + } + + if (n < first) { + return; + } + + if (!m_candidate) { + openCandidate(n, last + 1, true); + } + + quint64 expected = ((quint64) m_flywheelCode << 48) | (0xa6c6aaaaULL << 16) | (quint16) ~m_flywheelCode; + quint64 received = m_flywheelInverted ? ~reg : reg; + + if (popcount64(received ^ expected) > m_flywheelSyncErrors) { + return; + } + + // Correlate with the expected code, as with bit errors, the matched filter energy alone + // doesn't indicate the right timing. Sync bits are 1 for low frequency + float metric = 0.0f; + + for (int k = 0; k < m_syncBits; k++) + { + bool low = (((expected >> k) & 1) != 0) != m_flywheelInverted; + float v = m_mfHist[(n - k * m_sps1600) & m_histMask] - dc; + metric += low ? -v : v; + } + + if (metric > 0.0f) + { + int i = (int) (n - m_candidateFirst); + m_candidateMetric[i] = metric; + m_candidateCode[i] = m_flywheelCode; + m_candidateInverted[i] = m_flywheelInverted; + m_candidateDC[i] = dc; + m_candidatePower[i] = m_sumMagsqSync / (m_syncBits * m_sps1600); + } +} + +void PagerDemodFlex::startFrame() +{ + // Peak of the sync code energy, refined by fitting a parabola. The matched filter output + // at m_syncEnd is the mean over the last bit of the sync code + int length = (int) (m_candidateEnd - m_candidateFirst); + int best = (int) (std::max_element(m_candidateMetric.begin(), m_candidateMetric.begin() + length) - m_candidateMetric.begin()); + double fraction = 0.0; + + m_info = FrameInfo(); + m_info.m_code = m_candidateCode[best]; + m_info.m_inverted = m_candidateInverted[best]; + m_info.m_flywheel = m_candidateFlywheel; + mode(m_info.m_code, m_info.m_baud, m_info.m_levels); + + if ((best > 0) && (best < length - 1) && (m_candidateMetric[best - 1] > 0.0f) && (m_candidateMetric[best + 1] > 0.0f)) + { + float left = m_candidateMetric[best - 1]; + float centre = m_candidateMetric[best]; + float right = m_candidateMetric[best + 1]; + float denom = left - 2.0f * centre + right; + + if (denom < 0.0f) { + fraction = std::max(-0.5f, std::min(0.5f, 0.5f * (left - right) / denom)); + } + } + + m_syncEnd = m_candidateFirst + best + fraction; + m_info.m_syncSample = std::llround(m_syncEnd); + m_dc = m_candidateDC[best]; + m_syncPower = m_candidatePower[best]; + + // Data bits are 1 for high frequency, the opposite of the sync code + m_polarity = m_info.m_inverted ? -1.0f : 1.0f; + + m_bitIndex = 0; + m_nextBitSample = m_syncEnd + m_sps1600; + m_deviationSum = 0.0; + m_fiw = 0; + m_state = FIW; +} + +void PagerDemodFlex::fiwBit(float mf) +{ + float r = (mf - m_dc) * m_polarity; + m_deviationSum += std::fabs(r); + + if ((m_bitIndex >= m_syncTailBits) && (r > 0.0f)) { + m_fiw |= 1u << (m_bitIndex - m_syncTailBits); + } + + m_bitIndex++; + m_nextBitSample += m_sps1600; + + if (m_bitIndex < m_syncTailBits + m_fiwBits) { + return; + } + + // Frame information word: checksum (bits 0-3), cycle (4-7), frame (8-14) + quint32 fiw; + bool parityError; + + if (!PagerDemodFlexDecoder::correct(m_fiw, fiw, parityError) || !PagerDemodFlexDecoder::checksumValid(fiw)) + { + m_state = Hunting; + return; + } + + m_info.m_cycle = (fiw >> 4) & 0xf; + m_info.m_frame = (fiw >> 8) & 0x7f; + + if (m_info.m_cycle >= PagerDemodFlexDecoder::m_cycles) + { + m_state = Hunting; + return; + } + + // A frame found by the flywheel must be the one predicted + if (m_info.m_flywheel && ((m_info.m_cycle != m_flywheelCycle) || (m_info.m_frame != m_flywheelFrame))) + { + m_state = Hunting; + return; + } + + m_deviation = m_deviationSum / m_bitIndex; + m_info.m_deviation = m_deviation; + m_info.m_offset = m_dc; + + if (m_deviation <= 0.0f) + { + m_state = Hunting; + return; + } + + // Sync 2 starts at the end of the FIW, at the data symbol rate + double fiwEnd = m_nextBitSample - m_sps1600; + m_sps = m_sampleRate / m_info.m_baud; + m_timing = fiwEnd + m_sps - (m_sampleCount - 1); + m_gotMid = false; + m_havePrevSymbol = false; + m_prevMf = (m_info.m_baud == 3200) ? m_mf3200 : m_mf1600; + m_symbolIndex = 0; + m_sync2Symbols = m_info.m_baud * 25 / 1000; + m_dataSymbols = m_info.m_baud * 1760 / 1000; + + for (int b = 0; b < m_blocks; b++) + { + m_blockPower[b] = 0.0; + m_blockSamples[b] = 0; + } + + // Phases in transmission order. At 3200 baud, symbols alternate between A/B and C/D. + // With 4 levels, the second bit of each symbol carries B (or D) + static const char phaseNames[2][2][4] = { + {{'A'}, {'A', 'B'}}, + {{'A', 'C'}, {'A', 'B', 'C', 'D'}} + }; + int fast = (m_info.m_baud == 3200) ? 1 : 0; + int fourLevel = (m_info.m_levels == 4) ? 1 : 0; + int phases = (1 + fast) * (1 + fourLevel); + + m_frame = PagerDemodFlexDecoder::Frame(); + m_frame.m_cycle = m_info.m_cycle; + m_frame.m_frame = m_info.m_frame; + m_frame.m_bitRate = m_info.m_baud * (m_info.m_levels == 4 ? 2 : 1); + m_frame.m_phases.resize(phases); + + for (int p = 0; p < phases; p++) { + m_frame.m_phases[p].m_name = phaseNames[fast][fourLevel][p]; + } + + m_state = Data; +} + +void PagerDemodFlex::dataSample(float mf, float magsq) +{ + // Measure power per block, to detect loss of carrier + int dataIndex = m_symbolIndex - m_sync2Symbols; + + if (dataIndex >= 0) + { + int bitIndex = (m_info.m_baud == 3200) ? (dataIndex >> 1) : dataIndex; + int block = bitIndex >> 8; + + if (block < m_blocks) + { + m_blockPower[block] += magsq; + m_blockSamples[block]++; + } + } + + // Matched filter output at the symbol instants and midway between them, + // interpolated between samples + m_timing -= 1.0; + + if (!m_gotMid && (m_timing <= m_sps / 2.0)) + { + float f = m_sps / 2.0 - m_timing; + m_mid = mf * (1.0f - f) + m_prevMf * f; + m_gotMid = true; + } + + if (m_timing <= 0.0) + { + float f = -m_timing; + float y = mf * (1.0f - f) + m_prevMf * f; + m_timing += m_sps; + m_gotMid = false; + symbol(y); + } + + m_prevMf = mf; +} + +void PagerDemodFlex::symbol(float value) +{ + // Normalise so the outer levels are +/-1, with the highest frequency positive + float r = (value - m_dc) * m_polarity / m_deviation; + float mid = (m_mid - m_dc) * m_polarity / m_deviation; + int sym; + float level; + + if (m_info.m_levels == 4) + { + if (r > 2.0f / 3.0f) + { + sym = 3; + level = 1.0f; + } + else if (r > 0.0f) + { + sym = 2; + level = 1.0f / 3.0f; + } + else if (r > -2.0f / 3.0f) + { + sym = 1; + level = -1.0f / 3.0f; + } + else + { + sym = 0; + level = -1.0f; + } + } + else + { + sym = (r > 0.0f) ? 3 : 0; + level = (r > 0.0f) ? 1.0f : -1.0f; + } + + // Timing: midway between two symbols, the matched filter output is their average when + // on time, and moves towards the later symbol by the fraction of a symbol we are late. + // Only transitions of at least two levels are used, as they have the best SNR + if (m_havePrevSymbol) + { + float diff = r - m_prevSymbol; + + if (std::fabs(diff) >= 1.0f) + { + float e = (mid - (r + m_prevSymbol) / 2.0f) / diff; + e = std::max(-0.5f, std::min(0.5f, e)); + m_timing -= m_timingGain * e * m_sps; + } + } + + m_prevSymbol = r; + m_havePrevSymbol = true; + + // Track the slicer levels: the offset from every decision, the deviation from outer levels + float err = r - level; + m_dc += m_levelGain * err * m_deviation * m_polarity; + + if (std::fabs(level) == 1.0f) { + m_deviation += m_levelGain * (std::fabs(r) - 1.0f) * m_deviation; + } + + int dataIndex = m_symbolIndex - m_sync2Symbols; + m_symbolIndex++; + + if (dataIndex < 0) { + return; // Sync 2 + } + + // Each phase's 88 words are sent in 11 blocks of 8, interleaved a bit at a time + int half = 0; + int bitIndex = dataIndex; + + if (m_info.m_baud == 3200) + { + half = dataIndex & 1; + bitIndex = dataIndex >> 1; + } + + int word = ((bitIndex >> 8) * PagerDemodFlexDecoder::m_wordsPerBlock) + (bitIndex & 7); + int bit = (bitIndex >> 3) & 31; + quint32 a = (sym > 1) ? 1 : 0; + quint32 b = ((sym == 1) || (sym == 2)) ? 1 : 0; + int p = half * ((m_info.m_levels == 4) ? 2 : 1); + + m_frame.m_phases[p].m_words[word] |= a << bit; + if (m_info.m_levels == 4) { + m_frame.m_phases[p + 1].m_words[word] |= b << bit; + } + + if (dataIndex + 1 == m_dataSymbols) { + endFrame(); + } +} + +void PagerDemodFlex::endFrame() +{ + // Erase blocks where the carrier was lost + float threshold = m_syncPower * std::pow(10.0f, -m_carrierLossDB / 10.0f); + int erasedBlocks = 0; + + for (int b = 0; b < m_blocks; b++) + { + if ((m_blockSamples[b] > 0) && (m_blockPower[b] / m_blockSamples[b] < threshold)) + { + erasedBlocks++; + + for (auto& phase : m_frame.m_phases) + { + for (int w = 0; w < PagerDemodFlexDecoder::m_wordsPerBlock; w++) { + phase.m_erased[b * PagerDemodFlexDecoder::m_wordsPerBlock + w] = true; + } + } + } + } + + m_messages.append(m_decoder.decodeFrame(m_frame)); + + m_info.m_codewords = m_decoder.getCodewords(); + m_info.m_uncorrectable = m_decoder.getUncorrectable(); + m_info.m_erasedBlocks = erasedBlocks; + m_lastFrame = m_info; + m_lastFrameSample = m_sampleCount; + m_frameCount++; + + // Predict the next frame + m_flywheel = true; + m_flywheelSyncEnd = m_syncEnd + m_sampleRate * 15.0 / 8.0; + m_flywheelPeriods = 1; + m_flywheelCode = m_info.m_code; + m_flywheelInverted = m_info.m_inverted; + m_flywheelFrame = m_info.m_frame + 1; + m_flywheelCycle = m_info.m_cycle; + if (m_flywheelFrame == PagerDemodFlexDecoder::m_framesPerCycle) + { + m_flywheelFrame = 0; + m_flywheelCycle = (m_flywheelCycle + 1) % PagerDemodFlexDecoder::m_cycles; + } + + m_state = Hunting; +} diff --git a/plugins/channelrx/demodpager/pagerdemodflex.h b/plugins/channelrx/demodpager/pagerdemodflex.h new file mode 100644 index 000000000..d8ca383d1 --- /dev/null +++ b/plugins/channelrx/demodpager/pagerdemodflex.h @@ -0,0 +1,307 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2026 Jon Beniston, M7RCE // +// Some code by AI // +// // +// 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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#ifndef INCLUDE_PAGERDEMODFLEX_H +#define INCLUDE_PAGERDEMODFLEX_H + +#include +#include +#include + +#include + +// FLEX paging protocol receiver. +// +// A FLEX frame is 1.875s long: sync 1 and the frame information word (FIW) at 1600 bit/s +// 2-level FSK, then sync 2 and 11 blocks of data at the frame's own symbol rate (1600 or +// 3200 baud) and number of levels (2 or 4). This gives four modes: 1600/2, 1600/4, 3200/2 +// and 3200/4, carrying 1, 2, 2 and 4 interleaved phases (A to D) of 88 codewords each. +// +// Codewords are BCH(31,21) plus even parity, the same code as POCSAG, but transmitted LSB +// first. Field definitions follow ARIB RCR STD-43A; message layout and the handling of +// corner cases follow multimon-ng's demod_flex.c, so decodes are comparable with it. + +// A message decoded from a FLEX frame +struct PagerDemodFlexMessage +{ + // Vector types, as transmitted + enum Type { + Secure = 0, + ShortInstruction = 1, + Tone = 2, + StandardNumeric = 3, + SpecialNumeric = 4, + Alphanumeric = 5, + Binary = 6, + NumberedNumeric = 7 + }; + + qint64 m_capcode = 0; + bool m_longAddress = false; + Type m_type = Alphanumeric; + QString m_text; //!< 7-bit characters (alphanumeric, secure), digits (numeric, tone) or hex (binary) + int m_bchErrors = 0; //!< Uncorrectable codewords in the message + int m_parityErrors = 0; //!< Corrected codewords failing even parity + int m_bitRate = 0; //!< Data bit rate of the frame: 1600, 3200 or 6400 + int m_cycle = 0; //!< Cycle number (0-14) of the first fragment + int m_frame = 0; //!< Frame number (0-127) of the first fragment + char m_phase = 'A'; + bool m_incomplete = false; //!< One or more fragments of a multi-frame message were lost + int m_group = -1; //!< Temporary address (0-15) of a group call, or -1 + + bool isNumeric() const; //!< Whether m_text holds digits rather than characters + static QString typeName(Type type); +}; + +// Decodes the codewords of a received frame into messages, including reassembly of +// alphanumeric messages that are fragmented over several frames. +// +// Group calls: a short instruction vector assigns a pager's capcode to one of 16 temporary +// addresses, for a given frame. A message sent to that temporary address in that frame is +// for every pager assigned to it, so it is output once for each of their capcodes. If no +// assignments were received, it is output with the temporary address as the capcode. +class PagerDemodFlexDecoder +{ +public: + static const int m_wordsPerPhase = 88; + static const int m_wordsPerBlock = 8; + static const int m_framesPerCycle = 128; + static const int m_cycles = 15; + //!< A fragmented message whose next fragment hasn't arrived after this many frames + //!< (one minute) is output marked incomplete + static const int m_fragmentTimeoutFrames = 32; + //!< Capcodes of the temporary addresses used for group calls + static const qint64 m_groupCapcodeFirst = 2029568; + static const int m_groups = 16; + static const int m_maxGroupMembers = 1000; + + struct Phase { + char m_name = 'A'; + quint32 m_words[m_wordsPerPhase] = {}; //!< Received codewords, first received bit in bit 0 + bool m_erased[m_wordsPerPhase] = {}; //!< Codeword received while the carrier was lost + }; + + struct Frame { + int m_cycle = 0; + int m_frame = 0; + int m_bitRate = 1600; + std::vector m_phases; + }; + + //!< Decode a frame. Returns completed messages, including fragmented messages that timed out + QList decodeFrame(const Frame& frame); + //!< Output any partly received fragmented messages, marked incomplete + QList flush(); + bool hasFragments() const { return !m_fragments.isEmpty(); } + void reset(); + + // Codeword statistics for the last decoded frame + int getCodewords() const { return m_codewords; } + int getUncorrectable() const { return m_uncorrectable; } + + //!< The 4-bit checksum used by the FIW, BIW and vector words: nibble sum of the 21 data bits is 0xF + static bool checksumValid(quint32 data); + //!< Set the checksum bits (3-0) of a 21-bit data word, so checksumValid() is true + static quint32 setChecksum(quint32 data); + //!< Correct a received codeword (first received bit in bit 0). Returns false if uncorrectable + static bool correct(quint32 word, quint32& data, bool& parityError); + //!< Encode 21 data bits as a codeword, first transmitted bit in bit 0 + static quint32 encode(quint32 data); + static bool isLongAddress(quint32 addressWord); + + static const char m_numericChars[17]; + +private: + struct Fragment { + PagerDemodFlexMessage m_message; + int m_messageNumber; //!< From the header, to tell parts of different messages apart + int m_nextFragment; //!< Expected fragment number of the next part + int m_frameIndex; //!< Absolute frame index (cycle * 128 + frame) of the last part + }; + + struct Group { + QList m_capcodes; //!< Capcodes assigned to the temporary address + int m_frameIndex = -1; //!< Absolute frame index of the group call, -1 if none + }; + + QHash m_fragments; //!< Fragmented messages being reassembled, by capcode + Group m_groupCalls[m_groups]; + int m_codewords = 0; + int m_uncorrectable = 0; + + void decodePhase(const Frame& frame, const Phase& phase, QList& messages); + void addFragment(PagerDemodFlexMessage& message, int fragment, bool continued, int messageNumber, int frameIndex, QList& messages); + void assignGroup(const Frame& frame, qint64 capcode, quint32 viw); + void expireGroups(int frameIndex); + QList expandGroups(const QList& messages); +}; + +// Recovers FLEX frames from FM discriminator output and passes them to the decoder. +// +// Sync 1 is found by a 64-bit correlator on each sample phase of the 1600 bit/s stream. Of +// the phases that match, the one with the largest matched filter output over the sync code +// gives the symbol timing, and the DC offset and +// deviation are measured from sync 1 and the FIW. Data symbols are then tracked by a timing +// loop that uses transitions of at least two levels, and the slicer levels are tracked by +// decision direction, so a frame survives receiver clock and carrier frequency errors. +// +// Frames are sent every 1.875s, so once a frame has been received, the flywheel predicts +// when the next sync 1 should end. Around that time, a much weaker match to the expected +// sync code is accepted, for frames where sync 1 is damaged (e.g. by a transmitter keying +// up). To keep this from creating frames from noise, such a frame is only received if its +// FIW has the expected cycle and frame number. +class PagerDemodFlex +{ +public: + // Information about a received frame, for diagnostics and tests + struct FrameInfo { + qint64 m_syncSample = 0; //!< Sample index of the end of the sync 1 code + quint16 m_code = 0; //!< Sync 1 mode code + bool m_inverted = false; //!< Whether the sync was received with inverted polarity + int m_baud = 0; + int m_levels = 0; + int m_cycle = 0; + int m_frame = 0; + int m_codewords = 0; //!< Codewords in the frame (88 per phase) + int m_uncorrectable = 0; //!< Codewords with uncorrectable errors (not counting erasures) + int m_erasedBlocks = 0; //!< Blocks where the carrier was lost + float m_deviation = 0.0f; //!< Measured outer level deviation, in discriminator units + float m_offset = 0.0f; //!< Measured DC offset, in discriminator units + bool m_flywheel = false; //!< Sync 1 was found by the flywheel + }; + + explicit PagerDemodFlex(int sampleRate = 38400); + void reset(); + //!< Process one sample of FM discriminator output, with its magnitude squared + void process(float fm, float magsq); + //!< True from finding sync 1 to the end of the frame + bool isReceiving() const { return m_state != Hunting; } + bool hasMessages() const { return !m_messages.isEmpty(); } + PagerDemodFlexMessage takeMessage() { return m_messages.takeFirst(); } + int getFrameCount() const { return m_frameCount; } //!< Frames whose FIW decoded + const FrameInfo& getLastFrame() const { return m_lastFrame; } + + //!< Blocks whose mean power is this far below sync 1 are treated as lost + static constexpr float m_carrierLossDB = 15.0f; + //!< Frame periods after the last frame received that the flywheel predicts sync for + static const int m_flywheelFrames = 4; + //!< Bit errors allowed in the 64-bit sync code, when found by the flywheel + static const int m_flywheelSyncErrors = 16; + +private: + enum State { + Hunting, //!< Searching for sync 1 + FIW, //!< Receiving the rest of sync 1 and the FIW at 1600 bit/s + Data //!< Receiving sync 2 and the data blocks + }; + + static const int m_syncBits = 64; + static const int m_syncTailBits = 16; //!< Bits after the 64-bit sync code, before the FIW + static const int m_fiwBits = 32; + static const int m_blocks = 11; + + int m_sampleRate; + int m_sps1600; //!< Samples per symbol at 1600 baud + State m_state; + qint64 m_sampleCount; + + // History of FM samples and running sums, for the matched filters and the DC estimate + std::vector m_fm; + std::vector m_magsq; + std::vector m_mfHist; //!< 1600 baud matched filter output + int m_histMask; + double m_sum1600; //!< Over one symbol at 1600 baud + double m_sum3200; //!< Over one symbol at 3200 baud + double m_sumSync; //!< Over the 64-bit sync code + double m_sumMagsqSync; + float m_mf1600; //!< Matched filter outputs (mean over a symbol) + float m_mf3200; + + // Sync 1 search + std::vector m_syncReg; //!< One shift register per sample phase + bool m_candidate; + bool m_candidateFlywheel; //!< Candidate is the flywheel's search window, rather than a sync match + qint64 m_candidateFirst; + qint64 m_candidateEnd; + // Per sample of the candidate + std::vector m_candidateMetric; //!< Matched filter output over the sync code. 0 if no match + std::vector m_candidateCode; //!< Mode code, corrected + std::vector m_candidateInverted; + std::vector m_candidateDC; + std::vector m_candidatePower; + + // Flywheel + bool m_flywheel; //!< Next sync is predicted + double m_flywheelSyncEnd; //!< Predicted end of the next sync code + int m_flywheelPeriods; //!< Frame periods since the last frame + quint16 m_flywheelCode; + bool m_flywheelInverted; + int m_flywheelCycle; //!< Expected cycle and frame of the predicted frame + int m_flywheelFrame; + + // Current frame + FrameInfo m_info; + double m_syncEnd; //!< Sample at which the last bit of the sync code ends + float m_polarity; //!< +1 or -1, so the highest level is positive + float m_dc; + float m_deviation; + float m_syncPower; + int m_bitIndex; //!< Bit counter for sync tail and FIW + double m_nextBitSample; + double m_deviationSum; + quint32 m_fiw; + + // Data symbol recovery + int m_sps; //!< Samples per symbol + double m_timing; //!< Samples until the next symbol instant + bool m_gotMid; + float m_mid; //!< Matched filter output midway between symbols + float m_prevSymbol; + bool m_havePrevSymbol; + float m_prevMf; + int m_symbolIndex; + int m_sync2Symbols; + int m_dataSymbols; + double m_blockPower[m_blocks]; + int m_blockSamples[m_blocks]; + PagerDemodFlexDecoder::Frame m_frame; + + PagerDemodFlexDecoder m_decoder; + QList m_messages; + qint64 m_lastFrameSample; //!< When the last frame ended, to time out fragments if transmission stops + int m_frameCount; + FrameInfo m_lastFrame; + + static constexpr float m_timingGain = 0.05f; //!< Fraction of the timing error corrected per transition + static constexpr float m_levelGain = 0.01f; //!< Slicer level tracking per symbol + + void hunt(qint64 n, quint64 reg, float dc); + void flywheelSample(qint64 n, quint64 reg, float dc); + void openCandidate(qint64 first, qint64 end, bool flywheel); + void startFrame(); + void fiwBit(float mf); + void dataSample(float mf, float magsq); + void symbol(float value); + void endFrame(); + static bool syncMatch(quint64 reg, quint16& code); + //!< Find the mode closest to a received code. Returns false if none is within 3 bits + static bool mode(quint16& code, int& baud, int& levels); + static int popcount64(quint64 x); +}; + +#endif // INCLUDE_PAGERDEMODFLEX_H diff --git a/plugins/channelrx/demodpager/pagerdemodgui.cpp b/plugins/channelrx/demodpager/pagerdemodgui.cpp index fe76b5904..b8c36255c 100644 --- a/plugins/channelrx/demodpager/pagerdemodgui.cpp +++ b/plugins/channelrx/demodpager/pagerdemodgui.cpp @@ -58,14 +58,17 @@ void PagerDemodGUI::resizeTable() ui->messages->setRowCount(row + 1); ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_DATE, new QTableWidgetItem("Fri Apr 15 2016--")); ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_TIME, new QTableWidgetItem("10:17:00")); - ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_ADDRESS, new QTableWidgetItem("1000000")); + ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_ADDRESS, new QTableWidgetItem("100000000")); ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_MESSAGE, new QTableWidgetItem("ABCEDGHIJKLMNOPQRSTUVWXYZABCEDGHIJKLMNOPQRSTUVWXYZ")); ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_FUNCTION, new QTableWidgetItem("0")); ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_ALPHA, new QTableWidgetItem("ABCEDGHIJKLMNOPQRSTUVWXYZABCEDGHIJKLMNOPQRSTUVWXYZ")); ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_NUMERIC, new QTableWidgetItem("123456789123456789123456789123456789123456789123456789")); ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_EVEN_PE, new QTableWidgetItem("0")); ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_BCH_PE, new QTableWidgetItem("0")); - ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_BAUD, new QTableWidgetItem("2400-")); + ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_BAUD, new QTableWidgetItem("6400-")); + ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_PROTOCOL, new QTableWidgetItem("POCSAG-")); + ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_TYPE, new QTableWidgetItem("Alpha (group, partial)")); + ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_FRAME, new QTableWidgetItem("14/127 D-")); ui->messages->resizeColumnsToContents(); ui->messages->removeRow(row); } @@ -222,12 +225,35 @@ QString PagerDemodGUI::selectMessage(int functionBits, const QString &numericMes } // Add row to table -void PagerDemodGUI::messageReceived(const QDateTime dateTime, int address, int functionBits, int baud, +void PagerDemodGUI::messageReceived(const QDateTime dateTime, qint64 address, int functionBits, int baud, const QString &numericMessage, const QString &alphaMessage, - int evenParityErrors, int bchParityErrors) + int evenParityErrors, int bchParityErrors, + PagerDemodSettings::Modulation protocol, const QString &type, const QString &frame) { - QString message = selectMessage(functionBits, numericMessage, alphaMessage); - QString addressString = QString("%1").arg(address, 7, 10, QChar('0')); + bool flex = protocol == PagerDemodSettings::FLEX; + QString message; + QString typeString = type; + + if (flex) + { + // FLEX states the message type, so only one of alpha and numeric is set + message = alphaMessage.isEmpty() ? numericMessage : alphaMessage; + } + else + { + message = selectMessage(functionBits, numericMessage, alphaMessage); + + if (typeString.isEmpty()) + { + if (numericMessage.isEmpty() && alphaMessage.isEmpty()) { + typeString = "Tone"; + } else { + typeString = (message == numericMessage) ? "Numeric" : "Alpha"; + } + } + } + + QString addressString = PagerDemodSettings::formatAddress(address, protocol); // Should we ignore the message if it is a duplicate? if (m_settings.m_filterDuplicates) @@ -283,6 +309,9 @@ void PagerDemodGUI::messageReceived(const QDateTime dateTime, int address, int f QTableWidgetItem *evenPEItem = new QTableWidgetItem(); QTableWidgetItem *bchPEItem = new QTableWidgetItem(); QTableWidgetItem *baudItem = new QTableWidgetItem(); + QTableWidgetItem *protocolItem = new QTableWidgetItem(); + QTableWidgetItem *typeItem = new QTableWidgetItem(); + QTableWidgetItem *frameItem = new QTableWidgetItem(); ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_DATE, dateItem); ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_TIME, timeItem); ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_ADDRESS, addressItem); @@ -293,16 +322,22 @@ void PagerDemodGUI::messageReceived(const QDateTime dateTime, int address, int f ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_EVEN_PE, evenPEItem); ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_BCH_PE, bchPEItem); ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_BAUD, baudItem); + ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_PROTOCOL, protocolItem); + ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_TYPE, typeItem); + ui->messages->setItem(row, PagerDemodSettings::MESSAGE_COL_FRAME, frameItem); dateItem->setText(dateTime.date().toString()); timeItem->setText(dateTime.time().toString()); addressItem->setText(addressString); messageItem->setText(message); - functionItem->setText(QString("%1").arg(functionBits)); + functionItem->setText(flex ? QString() : QString("%1").arg(functionBits)); // Function bits are POCSAG only alphaItem->setText(alphaMessage); numericItem->setText(numericMessage); evenPEItem->setText(QString("%1").arg(evenParityErrors)); bchPEItem->setText(QString("%1").arg(bchParityErrors)); baudItem->setData(Qt::DisplayRole, baud); + protocolItem->setText(PagerDemodSettings::protocolName(protocol)); + typeItem->setText(typeString); + frameItem->setText(frame); if (!m_loadingData) { filterRow(row); @@ -333,7 +368,8 @@ bool PagerDemodGUI::handleMessage(const Message& message) const PagerDemod::MsgPagerMessage& report = (const PagerDemod::MsgPagerMessage&) message; messageReceived(report.getDateTime(), report.getAddress(), report.getFunctionBits(), report.getBaud(), report.getNumericMessage(), report.getAlphaMessage(), - report.getEvenParityErrors(), report.getBCHParityErrors()); + report.getEvenParityErrors(), report.getBCHParityErrors(), + report.getProtocol(), report.getType(), report.getFrame()); return true; } else if (DSPSignalNotification::match(message)) @@ -399,6 +435,12 @@ void PagerDemodGUI::on_fmDev_valueChanged(int value) applySettings(QStringList("fmDeviation")); } +void PagerDemodGUI::on_modulation_currentIndexChanged(int index) +{ + m_settings.m_modulation = (PagerDemodSettings::Modulation)index; + applySettings(QStringList("modulation")); +} + void PagerDemodGUI::on_decode_currentIndexChanged(int index) { m_settings.m_decode = (PagerDemodSettings::Decode)index; @@ -675,6 +717,7 @@ void PagerDemodGUI::displaySettings() ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); + ui->modulation->setCurrentIndex((int)m_settings.m_modulation); ui->decode->setCurrentIndex((int)m_settings.m_decode); ui->rfBWText->setText(QString("%1k").arg(m_settings.m_rfBandwidth / 1000.0, 0, 'f', 1)); @@ -841,7 +884,11 @@ void PagerDemodGUI::on_logOpen_clicked() int numericCol = colIndexes.value("Numeric"); int evenCol = colIndexes.value("Even Parity Errors"); int bchCol = colIndexes.value("BCH Parity Errors"); + // Columns absent from logs written before they were recorded int baudCol = colIndexes.value("Baud", -1); + int protocolCol = colIndexes.value("Protocol", -1); + int typeCol = colIndexes.value("Type", -1); + int frameCol = colIndexes.value("Frame", -1); int maxCol = std::max({dateCol, timeCol, addressCol, functionCol, alphaCol, numericCol, evenCol, bchCol}); QMessageBox dialog(this); @@ -866,18 +913,22 @@ void PagerDemodGUI::on_logOpen_clicked() QDate date = QDate::fromString(cols[dateCol]); QTime time = QTime::fromString(cols[timeCol]); QDateTime dateTime(date, time); - int address = cols[addressCol].toInt(); + qint64 address = cols[addressCol].toLongLong(); int functionBits = cols[functionCol].toInt(); int evenErrors = cols[evenCol].toInt(); int bchErrors = cols[bchCol].toInt(); - // Baud is absent from logs written before it was recorded int baud = ((baudCol >= 0) && (baudCol < cols.size())) ? cols[baudCol].toInt() : 0; + PagerDemodSettings::Modulation protocol = ((protocolCol >= 0) && (protocolCol < cols.size()) && (cols[protocolCol] == "FLEX")) + ? PagerDemodSettings::FLEX : PagerDemodSettings::POCSAG; + QString type = ((typeCol >= 0) && (typeCol < cols.size())) ? cols[typeCol] : QString(); + QString frame = ((frameCol >= 0) && (frameCol < cols.size())) ? cols[frameCol] : QString(); messageReceived(dateTime, address, functionBits, baud, cols[numericCol], cols[alphaCol], - evenErrors, bchErrors); + evenErrors, bchErrors, + protocol, type, frame); if (count % 1000 == 0) { @@ -914,6 +965,7 @@ void PagerDemodGUI::makeUIConnections() QObject::connect(ui->deltaFrequency, &ValueDialZ::changed, this, &PagerDemodGUI::on_deltaFrequency_changed); QObject::connect(ui->rfBW, &QSlider::valueChanged, this, &PagerDemodGUI::on_rfBW_valueChanged); QObject::connect(ui->fmDev, &QSlider::valueChanged, this, &PagerDemodGUI::on_fmDev_valueChanged); + QObject::connect(ui->modulation, QOverload::of(&QComboBox::currentIndexChanged), this, &PagerDemodGUI::on_modulation_currentIndexChanged); QObject::connect(ui->decode, QOverload::of(&QComboBox::currentIndexChanged), this, &PagerDemodGUI::on_decode_currentIndexChanged); QObject::connect(ui->charset, &QToolButton::clicked, this, &PagerDemodGUI::on_charset_clicked); QObject::connect(ui->filterAddress, &QLineEdit::editingFinished, this, &PagerDemodGUI::on_filterAddress_editingFinished); diff --git a/plugins/channelrx/demodpager/pagerdemodgui.h b/plugins/channelrx/demodpager/pagerdemodgui.h index 827943bc8..e6535ee86 100644 --- a/plugins/channelrx/demodpager/pagerdemodgui.h +++ b/plugins/channelrx/demodpager/pagerdemodgui.h @@ -107,9 +107,10 @@ private: void applySettings(const QStringList& settingsKeys, bool force = false); void displaySettings(); QString selectMessage(int functionBits, const QString &numericMessage, const QString &alphaMessage) const; - void messageReceived(const QDateTime dateTime, int address, int functionBits, int baud, + void messageReceived(const QDateTime dateTime, qint64 address, int functionBits, int baud, const QString &numericMessage, const QString &alphaMessage, - int evenParityErrors, int bchParityErrors); + int evenParityErrors, int bchParityErrors, + PagerDemodSettings::Modulation protocol, const QString &type, const QString &frame); bool handleMessage(const Message& message); void makeUIConnections(); void updateAbsoluteCenterFrequency(); @@ -132,6 +133,7 @@ private slots: void on_deltaFrequency_changed(qint64 value); void on_rfBW_valueChanged(int index); void on_fmDev_valueChanged(int value); + void on_modulation_currentIndexChanged(int index); void on_decode_currentIndexChanged(int index); void on_charset_clicked(); void on_filterAddress_editingFinished(); diff --git a/plugins/channelrx/demodpager/pagerdemodgui.ui b/plugins/channelrx/demodpager/pagerdemodgui.ui index 61c3296e4..34ac8b09d 100644 --- a/plugins/channelrx/demodpager/pagerdemodgui.ui +++ b/plugins/channelrx/demodpager/pagerdemodgui.ui @@ -343,7 +343,7 @@ - Mod + Mode @@ -356,20 +356,23 @@ - Pager modulation + Pager protocols to receive. Auto receives both POCSAG and FLEX + + + Auto + + POCSAG - - - - - - Qt::Orientation::Vertical - + + + FLEX + + @@ -395,7 +398,7 @@ - How to choose between decoding a message as numeric or alphanumeric + How to choose between decoding a POCSAG message as numeric or alphanumeric. FLEX messages state their type @@ -725,16 +728,16 @@ 2 - 3 + 0 - 3 + 0 - 3 + 0 - 3 + 0 @@ -765,7 +768,7 @@ Address - 21-bit pager address the message is for + 21-bit POCSAG address or FLEX capcode the message is for @@ -778,7 +781,7 @@ Function - Function bits / source address + POCSAG function bits / source address @@ -818,7 +821,31 @@ Baud - Baud rate the message was received at, detected from the preamble + POCSAG baud rate, detected from the preamble, or FLEX bit rate + + + + + Protocol + + + Paging protocol: POCSAG or FLEX + + + + + Type + + + Message type. Partial indicates a fragment of a FLEX message was lost + + + + + Frame + + + FLEX cycle/frame and phase the message was received in @@ -1038,6 +1065,12 @@
gui/rollupcontents.h
1 + + ValueDialZ + QWidget +
gui/valuedialz.h
+ 1 +
ButtonSwitch QToolButton @@ -1049,12 +1082,6 @@
gui/levelmeter.h
1
- - ValueDialZ - QWidget -
gui/valuedialz.h
- 1 -
GLScope QWidget diff --git a/plugins/channelrx/demodpager/pagerdemodsettings.cpp b/plugins/channelrx/demodpager/pagerdemodsettings.cpp index 8c18fa5c3..ba70124cb 100644 --- a/plugins/channelrx/demodpager/pagerdemodsettings.cpp +++ b/plugins/channelrx/demodpager/pagerdemodsettings.cpp @@ -37,6 +37,7 @@ PagerDemodSettings::PagerDemodSettings() : void PagerDemodSettings::resetToDefaults() { m_inputFrequencyOffset = 0; + m_modulation = Auto; m_rfBandwidth = 20000.0f; m_fmDeviation = 4500.0f; m_decode = Standard; @@ -121,6 +122,7 @@ QByteArray PagerDemodSettings::serialize() const s.writeBool(32, m_filterDuplicates); s.writeBool(33, m_duplicateMatchMessageOnly); s.writeBool(34, m_duplicateMatchLastOnly); + s.writeS32(35, (int)m_modulation); for (int i = 0; i < PAGERDEMOD_MESSAGE_COLUMNS; i++) { s.writeS32(100 + i, m_messageColumnIndexes[i]); @@ -221,6 +223,7 @@ bool PagerDemodSettings::deserialize(const QByteArray& data) d.readBool(32, &m_filterDuplicates); d.readBool(33, &m_duplicateMatchMessageOnly); d.readBool(34, &m_duplicateMatchLastOnly); + d.readS32(35, (int*)&m_modulation, (int)Auto); for (int i = 0; i < PAGERDEMOD_MESSAGE_COLUMNS; i++) { d.readS32(100 + i, &m_messageColumnIndexes[i], i); @@ -244,6 +247,9 @@ void PagerDemodSettings::applySettings(const QStringList& settingsKeys, const Pa if (settingsKeys.contains("inputFrequencyOffset")) { m_inputFrequencyOffset = settings.m_inputFrequencyOffset; } + if (settingsKeys.contains("modulation")) { + m_modulation = settings.m_modulation; + } if (settingsKeys.contains("rfBandwidth")) { m_rfBandwidth = settings.m_rfBandwidth; } @@ -350,6 +356,9 @@ QString PagerDemodSettings::getDebugString(const QStringList& settingsKeys, bool if (settingsKeys.contains("inputFrequencyOffset") || force) { ostr << " m_inputFrequencyOffset: " << m_inputFrequencyOffset; } + if (settingsKeys.contains("modulation") || force) { + ostr << " m_modulation: " << m_modulation; + } if (settingsKeys.contains("rfBandwidth") || force) { ostr << " m_rfBandwidth: " << m_rfBandwidth; } diff --git a/plugins/channelrx/demodpager/pagerdemodsettings.h b/plugins/channelrx/demodpager/pagerdemodsettings.h index acb10b9b0..b0ef500e6 100644 --- a/plugins/channelrx/demodpager/pagerdemodsettings.h +++ b/plugins/channelrx/demodpager/pagerdemodsettings.h @@ -33,7 +33,7 @@ class QDataStream; class Serializable; // Number of columns in the tables -#define PAGERDEMOD_MESSAGE_COLUMNS 10 +#define PAGERDEMOD_MESSAGE_COLUMNS 13 struct PagerDemodSettings { @@ -47,7 +47,10 @@ struct PagerDemodSettings MESSAGE_COL_NUMERIC, MESSAGE_COL_EVEN_PE, MESSAGE_COL_BCH_PE, - MESSAGE_COL_BAUD + MESSAGE_COL_BAUD, + MESSAGE_COL_PROTOCOL, + MESSAGE_COL_TYPE, + MESSAGE_COL_FRAME }; struct NotificationSettings { @@ -68,6 +71,11 @@ struct PagerDemodSettings }; qint32 m_inputFrequencyOffset; + enum Modulation { + Auto, //!< Receive both POCSAG and FLEX + POCSAG, + FLEX + } m_modulation; Real m_rfBandwidth; Real m_fmDeviation; //> i) & 1; - } - return x; -} - -// Check for even parity -bool PagerDemodSink::evenParity(quint32 word, int firstBit, int lastBit, int parityBit) -{ - return xorBits(word, firstBit, lastBit) == parityBit; -} - -// Reverse order of bits -quint32 PagerDemodSink::reverse(quint32 x) -{ - x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); - x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); - x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); - x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); - return((x >> 16) | (x << 16)); -} - -// Calculate BCH parity and even parity bits -quint32 PagerDemodSink::bchEncode(const quint32 cw) -{ - quint32 bit = 0; - quint32 localCW = cw & 0xFFFFF800; // Mask off BCH parity and even parity bits - quint32 cwE = localCW; - - // Calculate BCH bits - for (bit = 1; bit <= 21; bit++) - { - if (cwE & 0x80000000) { - cwE ^= 0xED200000; - } - cwE <<= 1; - } - localCW |= (cwE >> 21); - - return localCW; -} - -// Use BCH decoding to try to fix any bit errors -// Returns true if able to be decode/repair successful -// See: https://www.eevblog.com/forum/microcontrollers/practical-guides-to-bch-fec/ -bool PagerDemodSink::bchDecode(const quint32 cw, quint32& correctedCW) -{ - // Calculate syndrome - // We do this by recalculating the BCH parity bits and XORing them against the received ones - quint32 syndrome = ((bchEncode(cw) ^ cw) >> 1) & 0x3FF; - - if (syndrome == 0) - { - // Syndrome of zero indicates no repair required - correctedCW = cw; - return true; - } - - // Meggitt decoder - - quint32 result = 0; - quint32 damagedCW = cw; - - // Calculate BCH bits - for (quint32 xbit = 0; xbit < 31; xbit++) - { - // Produce the next corrected bit in the high bit of the result - result <<= 1; - if ((syndrome == 0x3B4) || // 0x3B4: Syndrome when a single error is detected in the MSB - (syndrome == 0x26E) || // 0x26E: Two adjacent errors - (syndrome == 0x359) || // 0x359: Two errors, one OK bit between - (syndrome == 0x076) || // 0x076: Two errors, two OK bits between - (syndrome == 0x255) || // 0x255: Two errors, three OK bits between - (syndrome == 0x0F0) || // 0x0F0: Two errors, four OK bits between - (syndrome == 0x216) || - (syndrome == 0x365) || - (syndrome == 0x068) || - (syndrome == 0x25A) || - (syndrome == 0x343) || - (syndrome == 0x07B) || - (syndrome == 0x1E7) || - (syndrome == 0x129) || - (syndrome == 0x14E) || - (syndrome == 0x2C9) || - (syndrome == 0x0BE) || - (syndrome == 0x231) || - (syndrome == 0x0C2) || - (syndrome == 0x20F) || - (syndrome == 0x0DD) || - (syndrome == 0x1B4) || - (syndrome == 0x2B4) || - (syndrome == 0x334) || - (syndrome == 0x3F4) || - (syndrome == 0x394) || - (syndrome == 0x3A4) || - (syndrome == 0x3BC) || - (syndrome == 0x3B0) || - (syndrome == 0x3B6) || - (syndrome == 0x3B5) - ) - { - // Syndrome matches an error in the MSB - // Correct that error and adjust the syndrome to account for it - syndrome ^= 0x3B4; - result |= (~damagedCW & 0x80000000) >> 30; - } - else - { - // No error - result |= (damagedCW & 0x80000000) >> 30; - } - damagedCW <<= 1; - - // Handle syndrome shift register feedback - if (syndrome & 0x200) - { - syndrome <<= 1; - syndrome ^= 0x769; // 0x769 = POCSAG generator polynomial -- x^10 + x^9 + x^8 + x^6 + x^5 + x^3 + 1 - } - else - { - syndrome <<= 1; - } - // Mask off bits which fall off the end of the syndrome shift register - syndrome &= 0x3FF; - } - - // Check if error correction was successful - if (syndrome != 0) - { - // Syndrome nonzero at end indicates uncorrectable errors - correctedCW = cw; - return false; - } - - // The BCH decoder operates on bits 31 through 1. Preserve the separate - // overall parity bit in bit 0 so it can be checked after correction. - correctedCW = result | (cw & 0x1); - return true; -} - // Decode a batch of codewords to addresses and messages // Messages may be spreadout over multiple batches // https://www.itu.int/dms_pubrec/itu-r/rec/m/R-REC-M.584-1-198607-S!!PDF-E.pdf @@ -306,9 +162,9 @@ void PagerDemodSink::decodeBatch() } // Check parity bit - bool parityError = !evenParity(m_codeWords[i], 1, 31, m_codeWords[i] & 0x1); + bool parityError = !PagerDemodBCH::evenParity(m_codeWords[i], 1, 31, m_codeWords[i] & 0x1); - // The overall parity bit is preserved by bchDecode() so it can be + // The overall parity bit is preserved by PagerDemodBCH::decode() so it can be // reported separately. Ignore it when identifying the idle word. if ((m_codeWords[i] & 0xfffffffeU) == (PAGERDEMOD_POCSAG_IDLECODE & 0xfffffffeU)) { @@ -462,7 +318,7 @@ void PagerDemodSink::handleBit(int bit) else if (popcount((m_bits ^ PAGERDEMOD_POCSAG_SYNCCODE) & 0xfffffffeU) <= 2) { quint32 correctedCW; - if (bchDecode(m_bits, correctedCW) + if (PagerDemodBCH::decode(m_bits, correctedCW) && ((correctedCW & 0xfffffffeU) == (PAGERDEMOD_POCSAG_SYNCCODE & 0xfffffffeU))) { m_gotSOP = true; @@ -472,7 +328,7 @@ void PagerDemodSink::handleBit(int bit) else if (popcount((m_bits ^ PAGERDEMOD_POCSAG_SYNCCODE_INV) & 0xfffffffeU) <= 2) { quint32 correctedCW; - if (bchDecode(~m_bits, correctedCW) + if (PagerDemodBCH::decode(~m_bits, correctedCW) && ((correctedCW & 0xfffffffeU) == (PAGERDEMOD_POCSAG_SYNCCODE & 0xfffffffeU))) { m_gotSOP = true; @@ -496,7 +352,7 @@ void PagerDemodSink::handleBit(int bit) // to fix any bit errors quint32 cw = m_inverted ? ~m_bits : m_bits; quint32 correctedCW; - m_codeWordsBCHError[m_wordCount] = !bchDecode(cw, correctedCW); + m_codeWordsBCHError[m_wordCount] = !PagerDemodBCH::decode(cw, correctedCW); m_codeWords[m_wordCount] = correctedCW; m_wordCount++; @@ -542,20 +398,7 @@ void PagerDemodSink::sendMessage() m_numericMessage = m_numericMessage.trimmed(); // Remove trailing spaces if (getMessageQueueToChannel()) { - // Convert from 7-bit to UTF-8 using user specified encoding - for (int i = 0; i < m_alphaMessage.size(); i++) - { - QChar c = m_alphaMessage[i]; - int idx = m_settings.m_sevenbit.indexOf(c.toLatin1()); - if (idx >= 0) { - c = QChar(m_settings.m_unicode[idx]); - } - m_alphaMessage[i] = c; - } - // Reverse reading order, if required - if (m_settings.m_reverse) { - std::reverse(m_alphaMessage.begin(), m_alphaMessage.end()); - } + mapCharacters(m_alphaMessage); // Send to channel and GUI PagerDemod::MsgPagerMessage *msg = PagerDemod::MsgPagerMessage::create(m_address, m_functionBits, m_alphaMessage, m_numericMessage, m_parityErrors, m_bchErrors, m_baud); getMessageQueueToChannel()->push(msg); @@ -563,6 +406,76 @@ void PagerDemodSink::sendMessage() m_addressValid = false; } +// Convert from 7-bit to UTF-8 using user specified encoding, and reverse reading order, if required +void PagerDemodSink::mapCharacters(QString& message) const +{ + for (int i = 0; i < message.size(); i++) + { + QChar c = message[i]; + int idx = m_settings.m_sevenbit.indexOf(c.toLatin1()); + if (idx >= 0) { + c = QChar(m_settings.m_unicode[idx]); + } + message[i] = c; + } + if (m_settings.m_reverse) { + std::reverse(message.begin(), message.end()); + } +} + +void PagerDemodSink::sendFlexMessage(const PagerDemodFlexMessage& flexMessage) +{ + if (!getMessageQueueToChannel() || (flexMessage.m_type == PagerDemodFlexMessage::ShortInstruction)) { + return; + } + + // The vector type says how the message is encoded, so only one of alpha and numeric is set + QString alpha; + QString numeric; + + if (flexMessage.isNumeric()) + { + numeric = flexMessage.m_text.trimmed(); + } + else + { + alpha = flexMessage.m_text; + if (flexMessage.m_type != PagerDemodFlexMessage::Binary) { + mapCharacters(alpha); + } + } + + QString type = PagerDemodFlexMessage::typeName(flexMessage.m_type); + QStringList qualifiers; + if (flexMessage.m_group >= 0) { + qualifiers.append("group"); + } + if (flexMessage.m_incomplete) { + qualifiers.append("partial"); + } + if (!qualifiers.isEmpty()) { + type.append(QString(" (%1)").arg(qualifiers.join(", "))); + } + QString frame = QString("%1/%2 %3") + .arg(flexMessage.m_cycle) + .arg(flexMessage.m_frame, 3, 10, QChar('0')) + .arg(QChar(flexMessage.m_phase)); + + PagerDemod::MsgPagerMessage *msg = PagerDemod::MsgPagerMessage::create( + flexMessage.m_capcode, + 0, + alpha, + numeric, + flexMessage.m_parityErrors, + flexMessage.m_bchErrors, + flexMessage.m_bitRate, + PagerDemodSettings::FLEX, + type, + frame + ); + getMessageQueueToChannel()->push(msg); +} + // Decode the 20 message bits of a codeword as both numeric and 7-bit alphanumeric void PagerDemodSink::addMessageBits(int messageBits) { @@ -570,7 +483,7 @@ void PagerDemodSink::addMessageBits(int messageBits) for (int j = 16; j >= 0; j -= 4) { quint32 numericBits = (messageBits >> j) & 0xf; - numericBits = reverse(numericBits) >> (32-4); + numericBits = PagerDemodBCH::reverse(numericBits) >> (32-4); // Spec has 0xa as 'spare', but other decoders treat is as . const char numericChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', 'U', ' ', '-', ')', '(' @@ -587,7 +500,7 @@ void PagerDemodSink::addMessageBits(int messageBits) // Extract next 7-bit character from bit buffer char c = (m_alphaBitBuffer >> (m_alphaBitBufferBits-7)) & 0x7f; // Reverse bit ordering - c = reverse(c) >> (32-7); + c = PagerDemodBCH::reverse(c) >> (32-7); // Add to received message string (excluding, null, end of text, end ot transmission) if (c != 0 && c != 0x3 && c != 0x4) { m_alphaMessage.append(c); @@ -621,40 +534,70 @@ void PagerDemodSink::processOneSample(Complex &ci) m_magsqCount++; - // Detect the baud rate from the preamble. Only run while unsynced: that is when the - // rate can change, and it keeps the per-rate filters out of the decoding path - if (!m_gotSOP) + // FLEX frames are found by their 64-bit sync code, which is far less likely to occur + // by chance than POCSAG's 32-bit one, so FLEX takes over from POCSAG when it's found + bool flexReceiving = false; + + if (m_settings.m_modulation != PagerDemodSettings::POCSAG) { - int best = m_baudDetector.process(fmDemod); + bool wasReceiving = m_flex.isReceiving(); - if (m_baudDetector.metric(best) >= m_preambleThreshold) - { - int baud = PagerDemodBaudDetector::m_rates[best]; + m_flex.process(fmDemod, magsq); + flexReceiving = m_flex.isReceiving(); - if (baud != m_baud) { - setBaud(baud); + if (flexReceiving && !wasReceiving && m_gotSOP) + { + if (m_addressValid) { + sendMessage(); } + m_gotSOP = false; + m_addressValid = false; + } + + while (m_flex.hasMessages()) { + sendFlexMessage(m_flex.takeMessage()); } } - // Low pass filter - Real filt = m_lowpassBaud.filter(fmDemod); + Real filt = 0.0f; + int data = 0; + bool sample = false; - // An input frequency offset corresponds to a DC offset after FM demodulation - // To calculate what it is, we average part of the preamble, which should be zero - if (!m_gotSOP) + if ((m_settings.m_modulation != PagerDemodSettings::FLEX) && !flexReceiving) { - m_preambleMovingAverage(filt); - m_dcOffset = m_preambleMovingAverage.asDouble(); - } + // Detect the baud rate from the preamble. Only run while unsynced: that is when the + // rate can change, and it keeps the per-rate filters out of the decoding path + if (!m_gotSOP) + { + int best = m_baudDetector.process(fmDemod); - bool sample = false; + if (m_baudDetector.metric(best) >= m_preambleThreshold) + { + int baud = PagerDemodBaudDetector::m_rates[best]; - // Slice data - int data = (filt - m_dcOffset) >= 0.0; + if (baud != m_baud) { + setBaud(baud); + } + } + } + + // Low pass filter + filt = m_lowpassBaud.filter(fmDemod); - // Matched filter and timing recovery produce the bits - sample = matchedFilterAndDpll(filt - m_dcOffset); + // An input frequency offset corresponds to a DC offset after FM demodulation + // To calculate what it is, we average part of the preamble, which should be zero + if (!m_gotSOP) + { + m_preambleMovingAverage(filt); + m_dcOffset = m_preambleMovingAverage.asDouble(); + } + + // Slice data + data = (filt - m_dcOffset) >= 0.0; + + // Matched filter and timing recovery produce the bits + sample = matchedFilterAndDpll(filt - m_dcOffset); + } // Save data for edge detection // Select signals to feed to scope @@ -690,7 +633,7 @@ void PagerDemodSink::processOneSample(Complex &ci) scopeSample.real(m_bit); break; case 9: - scopeSample.real(m_gotSOP); + scopeSample.real(m_gotSOP || flexReceiving); break; } @@ -724,7 +667,7 @@ void PagerDemodSink::processOneSample(Complex &ci) scopeSample.imag(m_bit); break; case 9: - scopeSample.imag(m_gotSOP); + scopeSample.imag(m_gotSOP || flexReceiving); break; } @@ -795,6 +738,16 @@ void PagerDemodSink::applySettings(const QStringList& settingsKeys, const PagerD m_phaseDiscri.setFMScaling(PagerDemodSettings::m_channelSampleRate / (2.0f * settings.m_fmDeviation)); } + if ((settingsKeys.contains("modulation") && (settings.m_modulation != m_settings.m_modulation)) || force) + { + m_flex.reset(); + if (settings.m_modulation == PagerDemodSettings::FLEX) + { + m_gotSOP = false; + m_addressValid = false; + } + } + if (force) { // The baud rate is detected from the preamble rather than configured, as POCSAG diff --git a/plugins/channelrx/demodpager/pagerdemodsink.h b/plugins/channelrx/demodpager/pagerdemodsink.h index fae8b22da..794c2e555 100644 --- a/plugins/channelrx/demodpager/pagerdemodsink.h +++ b/plugins/channelrx/demodpager/pagerdemodsink.h @@ -35,6 +35,7 @@ #include "util/messagequeue.h" #include "pagerdemodsettings.h" +#include "pagerdemodflex.h" #define PAGERDEMOD_FRAMES_PER_BATCH 8 #define PAGERDEMOD_CODEWORDS_PER_FRAME 2 @@ -186,6 +187,7 @@ public: void setChannel(ChannelAPI *channel) { m_channel = channel; } double getMagSq() const { return m_magsq; } + const PagerDemodFlex& getFlex() const { return m_flex; } void getMagSqLevels(double& avg, double& peak, int& nbSamples) { @@ -285,6 +287,8 @@ private: quint32 m_alphaBitBuffer; // Bit buffer to 7-bit chars spread across codewords int m_alphaBitBufferBits; // Count of bits in m_alphaBitBuffer + PagerDemodFlex m_flex; // FLEX receiver, run on the same FM demodulator output + QVector m_demodBuffer; int m_demodBufferFill; ComplexVector m_sampleBuffer; @@ -296,15 +300,12 @@ private: void sampleToScope(Complex sample); void decodeBatch(); void sendMessage(); + void sendFlexMessage(const PagerDemodFlexMessage& flexMessage); + void mapCharacters(QString& message) const; void addMessageBits(int messageBits); void setBaud(int baud); void handleBit(int bit); bool matchedFilterAndDpll(Real v); - int xorBits(quint32 word, int firstBit, int lastBit); - bool evenParity(quint32 word, int firstBit, int lastBit, int parityBit); - quint32 reverse(quint32 x); - quint32 bchEncode(const quint32 cw); - bool bchDecode(const quint32 cw, quint32& correctedCW); }; diff --git a/plugins/channelrx/demodpager/readme.md b/plugins/channelrx/demodpager/readme.md index 2de3ac4ac..031ce439a 100644 --- a/plugins/channelrx/demodpager/readme.md +++ b/plugins/channelrx/demodpager/readme.md @@ -2,7 +2,7 @@

Introduction

-This plugin can be used to demodulate POCSAG pager messages. +This plugin can be used to demodulate POCSAG and FLEX pager messages.

Interface

@@ -30,11 +30,17 @@ This specifies the bandwidth of a LPF that is applied to the input signal to lim

5: Dev - Frequency deviation

-Adjusts the expected peak frequency deviation in 0.1 kHz steps from 1 to 6 kHz. POCSAG uses FSK with a ±4.5 kHz shift. +Adjusts the expected peak frequency deviation in 0.1 kHz steps from 1 to 6 kHz. +POCSAG uses FSK with a ±4.5 kHz shift. +FLEX measures its deviation from each frame's sync, so doesn't depend on this setting. -

6: Mod - Modulation

+

6: Mode

-Specifies the pager modulation. Currently only POCSAG is supported. +Specifies which pager protocols to receive: + +* Auto - Receive both POCSAG and FLEX, on the same channel. +* POCSAG - Receive POCSAG only. +* FLEX - Receive FLEX only. POCSAG uses FSK with 4.5kHz frequency shift, at 512, 1200 or 2400 baud. The baud rate is detected automatically from the preamble, as networks mix rates and a single channel can @@ -42,9 +48,21 @@ carry different rates at different times. High frequency is typically 0, with low 1, but occasionally this appears to be reversed, so the demodulator supports either. Data is framed as specified in [ITU-R M.584-2](https://www.itu.int/dms_pubrec/itu-r/rec/m/R-REC-M.584-2-199711-I!!PDF-E.pdf) +FLEX uses 2-level or 4-level FSK with a ±4.8 kHz shift, at 1600 or 3200 baud, giving 1600, 3200 or 6400 bit/s. +All four modes are supported, and are detected automatically from each frame's sync code, as is the polarity. +Messages are sent in 1.875 s frames, with 1 to 4 interleaved phases (A to D) per frame. Long alphanumeric messages +may be split over several frames; these are reassembled before being displayed. +Once a frame has been received, the start of following frames is predicted, so frames whose sync is damaged +(e.g. when a transmitter keys up) can still be received, provided they have the expected frame number. +Short and long addresses (capcodes), and alphanumeric, numeric, tone, secure and binary messages are supported. +Group calls are supported: pagers are first assigned to one of 16 temporary addresses for a particular frame, +and a message sent to that temporary address in that frame is displayed once for each assigned capcode. +If the assignments were not received, the message is displayed with the temporary address (2029568 to 2029583). +

7: Decode

-Specifies how messages are decoded in the Message column in the table: +Specifies how POCSAG messages are decoded in the Message column in the table. FLEX messages state their type, +so this setting doesn't apply to them: * Standard - As per ITU-R M.584-2 - Function 0 = numeric, function 1-3 = alphanumeric. * Inverted - Function 3 = numeric, function 0-2 = alphanumeric. @@ -74,7 +92,7 @@ Pressing this button clears all messages from the table. When checked, received messages are forwarded to the specified UDP address (12) and port (13). -The messages are forwarded as null terminated ASCII strings, in the format: data time address function alpha numeric +The messages are forwarded as null terminated ASCII strings, in the format: date time address function alpha numeric protocol type.

12: UDP address

@@ -134,13 +152,16 @@ The received messages table displays each pager message received. * Date - The date the message was received. * Time - The time the message was received. -* Address - The 21-bit pager address the message is for. -* Message - The decoded message, as per Decode setting (8). This will be empty for "tone only" messages (i.e. when the pager beeps without a message). -* Function - Function bits. In some instances this is used to specify the encoding of the message (Numeric/alphanumeric). In others, it is the pager source address. -* Alpha - Message decoded as alphanumeric text, regardless of Decode setting (8) -* Numeric - Message decoded as numeric, regardless of Decode setting (8). +* Address - The 21-bit POCSAG pager address (7 digits) or FLEX capcode (9 digits) the message is for. +* Message - The decoded message, as per Decode setting (7) for POCSAG. This will be empty for "tone only" messages (i.e. when the pager beeps without a message). +* Function - POCSAG function bits. In some instances this is used to specify the encoding of the message (Numeric/alphanumeric). In others, it is the pager source address. Blank for FLEX. +* Alpha - For POCSAG, the message decoded as alphanumeric text, regardless of Decode setting (7). For FLEX, the text of alphanumeric, secure and binary (shown as hex) messages. +* Numeric - For POCSAG, the message decoded as numeric, regardless of Decode setting (7). For FLEX, the digits of numeric and tone messages. * Even PE - Number of even parity errors detected in the code words of the message. -* BCH PE - Number of uncorrectable BCH parity errors detected in the code words of the message. -* Baud - The baud rate the message was received at, detected automatically from the preamble. +* BCH PE - Number of uncorrectable BCH parity errors detected in the code words of the message. For FLEX, this includes code words received after the carrier was lost. +* Baud - For POCSAG, the baud rate the message was received at, detected automatically from the preamble. For FLEX, the bit rate of the frame. +* Protocol - POCSAG or FLEX. +* Type - The message type: Alpha, Numeric or Tone for POCSAG, as chosen by the Decode setting (7); for FLEX, the type given in the message vector. For FLEX, "(group)" is appended to group calls and "(partial)" to messages where one or more fragments were lost. +* Frame - For FLEX, the cycle (0-14), frame (0-127) and phase (A-D) the message started in. Right clicking on the table header allows you to select which columns to show. The columns can be reordered by left clicking and dragging the column header. Right clicking on an item in the table allows you to copy the value to the clipboard. diff --git a/sdrbase/resources/webapi/doc/swagger/include/PagerDemod.yaml b/sdrbase/resources/webapi/doc/swagger/include/PagerDemod.yaml index 1151eb3a2..78f3a738c 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/PagerDemod.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/PagerDemod.yaml @@ -1,6 +1,15 @@ PagerDemodSettings: description: PagerDemod properties: + modulation: + type: integer + minimum: 0 + maximum: 2 + description: > + Pager protocols to receive + * 0 - Auto (POCSAG and FLEX) + * 1 - POCSAG + * 2 - FLEX decode: type: integer minimum: 0 diff --git a/swagger/sdrangel/api/swagger/include/PagerDemod.yaml b/swagger/sdrangel/api/swagger/include/PagerDemod.yaml index 74be63b83..b6ca1e890 100644 --- a/swagger/sdrangel/api/swagger/include/PagerDemod.yaml +++ b/swagger/sdrangel/api/swagger/include/PagerDemod.yaml @@ -1,6 +1,15 @@ PagerDemodSettings: description: PagerDemod properties: + modulation: + type: integer + minimum: 0 + maximum: 2 + description: > + Pager protocols to receive + * 0 - Auto (POCSAG and FLEX) + * 1 - POCSAG + * 2 - FLEX decode: type: integer minimum: 0 diff --git a/swagger/sdrangel/code/qt5/client/SWGPagerDemodSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGPagerDemodSettings.cpp index 49bf6ba30..0c900df1d 100644 --- a/swagger/sdrangel/code/qt5/client/SWGPagerDemodSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGPagerDemodSettings.cpp @@ -28,6 +28,8 @@ SWGPagerDemodSettings::SWGPagerDemodSettings(QString* json) { } SWGPagerDemodSettings::SWGPagerDemodSettings() { + modulation = 0; + m_modulation_isSet = false; decode = 0; m_decode_isSet = false; reverse = 0; @@ -78,6 +80,8 @@ SWGPagerDemodSettings::~SWGPagerDemodSettings() { void SWGPagerDemodSettings::init() { + modulation = 0; + m_modulation_isSet = false; decode = 0; m_decode_isSet = false; reverse = 0; @@ -172,6 +176,8 @@ SWGPagerDemodSettings::fromJson(QString &json) { void SWGPagerDemodSettings::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(&modulation, pJson["modulation"], "qint32", ""); + ::SWGSDRangel::setValue(&decode, pJson["decode"], "qint32", ""); ::SWGSDRangel::setValue(&reverse, pJson["reverse"], "qint32", ""); @@ -230,6 +236,9 @@ SWGPagerDemodSettings::asJson () QJsonObject* SWGPagerDemodSettings::asJsonObject() { QJsonObject* obj = new QJsonObject(); + if(m_modulation_isSet){ + obj->insert("modulation", QJsonValue(modulation)); + } if(m_decode_isSet){ obj->insert("decode", QJsonValue(decode)); } @@ -297,6 +306,16 @@ SWGPagerDemodSettings::asJsonObject() { return obj; } +qint32 +SWGPagerDemodSettings::getModulation() { + return modulation; +} +void +SWGPagerDemodSettings::setModulation(qint32 modulation) { + this->modulation = modulation; + this->m_modulation_isSet = true; +} + qint32 SWGPagerDemodSettings::getDecode() { return decode; @@ -512,6 +531,9 @@ bool SWGPagerDemodSettings::isSet(){ bool isObjectUpdated = false; do{ + if(m_modulation_isSet){ + isObjectUpdated = true; break; + } if(m_decode_isSet){ isObjectUpdated = true; break; } diff --git a/swagger/sdrangel/code/qt5/client/SWGPagerDemodSettings.h b/swagger/sdrangel/code/qt5/client/SWGPagerDemodSettings.h index 62db5082f..a72289b58 100644 --- a/swagger/sdrangel/code/qt5/client/SWGPagerDemodSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGPagerDemodSettings.h @@ -45,6 +45,9 @@ public: virtual void fromJsonObject(QJsonObject &json) override; virtual SWGPagerDemodSettings* fromJson(QString &jsonString) override; + qint32 getModulation(); + void setModulation(qint32 modulation); + qint32 getDecode(); void setDecode(qint32 decode); @@ -112,6 +115,9 @@ public: virtual bool isSet() override; private: + qint32 modulation; + bool m_modulation_isSet; + qint32 decode; bool m_decode_isSet;