Browse Source

Merge branch 'master' into fixes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chirpmodem-v8.1.0
Jon Beniston 1 month ago
parent
commit
2c7d57d9cc
  1. 20
      .codacy.yaml
  2. 49
      .codacy/instructions/review.md
  3. 49
      .gitattributes
  4. 8
      .githooks/pre-commit
  5. 276
      .github/workflows/coverity.sh
  6. 55
      .github/workflows/coverity.yml
  7. 43
      .github/workflows/git-attributes.yml
  8. 23
      .github/workflows/linux-qt6.yml
  9. 151
      .github/workflows/linux.yml
  10. 8
      .github/workflows/mac.yml
  11. 77
      .github/workflows/packet-demod.yml
  12. 42
      .github/workflows/sdrangel.yml
  13. 1
      .travis.yml
  14. 49
      CMakeLists.txt
  15. 3
      CMakePresets.json
  16. 20
      FIXME-notes.md
  17. 10
      Readme.md
  18. 134
      android/qt6/AndroidManifest.xml
  19. 2
      android/qt6/res/mipmap-anydpi-v26/ic_launcher.xml
  20. 52
      app/crashhandler.h
  21. 25
      app/main.cpp
  22. 2
      cmake/Modules/FindCM256cc.cmake
  23. 2
      cmake/Modules/FindCodec2.cmake
  24. 13
      cmake/Modules/FindFAAD.cmake
  25. 113
      cmake/Modules/FindFDKAAC.cmake
  26. 2
      cmake/Modules/FindFFmpeg.cmake
  27. 2
      cmake/Modules/FindLibMbe.cmake
  28. 2
      cmake/Modules/FindLibXTRX.cmake
  29. 2
      cmake/Modules/FindLimeSuite.cmake
  30. 2
      cmake/Modules/FindOpus.cmake
  31. 2
      cmake/Modules/FindSerialDV.cmake
  32. 19
      cmake/cpack/CMakeLists.txt
  33. 41
      cmake/cpack/claude_extension.nsh.in
  34. 6
      cmake/cpack/deploy_mac.cmake.in
  35. 1
      cmake/cpack/sdrangel.desktop.in
  36. 2
      cmake/include/uninstall.cmake.in
  37. 2
      debian/compat
  38. 1
      debian/control
  39. 11
      debian/rules
  40. 2
      debian/source/format
  41. 1
      devices/plutosdr/deviceplutosdrshared.cpp
  42. 11
      devices/plutosdr/deviceplutosdrshared.h
  43. 2
      devices/usrp/CMakeLists.txt
  44. 248
      devices/usrp/deviceusrp.cpp
  45. 35
      devices/usrp/deviceusrp.h
  46. 90
      devices/usrp/deviceusrpparam.cpp
  47. 60
      devices/usrp/deviceusrpparam.h
  48. 4
      devices/usrp/deviceusrpshared.cpp
  49. 133
      devices/usrp/deviceusrpshared.h
  50. 115
      devices/usrp/deviceusrpstreamstats.cpp
  51. 64
      devices/usrp/deviceusrpstreamstats.h
  52. BIN
      doc/img/BFMMmod_audio_tab.png
  53. BIN
      doc/img/BFMMmod_morse_tab.png
  54. BIN
      doc/img/BFMMmod_plugin.png
  55. BIN
      doc/img/BFMMmod_rds_tab.png
  56. BIN
      doc/img/DRMDemod_journaline.png
  57. BIN
      doc/img/DRMDemod_messages.png
  58. BIN
      doc/img/DRMDemod_plugin.png
  59. BIN
      doc/img/DRMDemod_slideshow.png
  60. BIN
      doc/img/DRMDemod_status.png
  61. BIN
      doc/img/DRMDemod_website.png
  62. BIN
      doc/img/DSCDemod_plugin.png
  63. BIN
      doc/img/DVBDemod_charts.png
  64. BIN
      doc/img/DVBDemod_dialog_epg.png
  65. BIN
      doc/img/DVBDemod_dvbs.png
  66. BIN
      doc/img/DVBDemod_dvbt.png
  67. BIN
      doc/img/DVBDemod_history.png
  68. BIN
      doc/img/DVBDemod_nowandnext.png
  69. BIN
      doc/img/DVBDemod_onscreen_epg.png
  70. BIN
      doc/img/DVBDemod_plugin.png
  71. BIN
      doc/img/DVBDemod_table.png
  72. BIN
      doc/img/DVBDemod_video.png
  73. BIN
      doc/img/DroneIDDemod_plugin.png
  74. BIN
      doc/img/DroneIDDemod_table.png
  75. BIN
      doc/img/MCPServer_plugin.png
  76. BIN
      doc/img/PSK31Demod_plugin.png
  77. BIN
      doc/img/PagerDemod_plugin.png
  78. BIN
      doc/img/SELCALDemod_audio_spectrum.png
  79. BIN
      doc/img/SELCALDemod_audio_tones.png
  80. BIN
      doc/img/SELCALDemod_calls.png
  81. BIN
      doc/img/SELCALDemod_plugin.png
  82. BIN
      doc/img/WefaxDemod_plugin.png
  83. 2
      doc/model/SDRAngel.mdj
  84. 24
      exports/export.h
  85. 148
      external/CMakeLists.txt
  86. 16
      external/copy_headers.cmake
  87. 2
      external/windows
  88. 5
      flatpak/org.sdrangel.SDRangel.yaml
  89. 2
      ft8/fft.h
  90. 13
      ft8/ft4.cpp
  91. 20
      ft8/ft8.cpp
  92. 1
      httpserver/httpconnectionhandler.cpp
  93. 3
      httpserver/httpcookie.cpp
  94. 2
      json_udp_data_format.readme.md
  95. 100
      logging/bufferlogger.cpp
  96. 92
      logging/bufferlogger.h
  97. 2
      logging/readme.md
  98. 103
      modemdrm/CMakeLists.txt
  99. 333
      modemdrm/drmacquisition.cpp
  100. 98
      modemdrm/drmacquisition.h
  101. Some files were not shown because too many files have changed in this diff Show More

20
.codacy.yaml

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
---
# Codacy exclusions for files that should not be analyzed.
# These paths are either vendored third-party content or generated code.
exclude_paths:
# Vendored Cesium content. This code is maintained upstream and is not
# part of the SDRangel source code being developed in this repository.
- "plugins/feature/map/Cesium/**"
# Generated Swagger UI files. These files are generated from the Swagger
# definition and should not be modified or analyzed as source code.
- "sdrbase/resources/webapi/doc/swagger-ui/**"
# Generated Swagger documentation. The contents are generated from the
# API definition rather than maintained manually.
- "sdrbase/resources/webapi/doc/swagger/**"
# Generated Swagger client code. This code is produced by the Swagger
# code generator and should not be analyzed as manually maintained code.
- "swagger/sdrangel/code/**"

49
.codacy/instructions/review.md

@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
Review SDRangel pull requests using the repository and current PR as context.
Focus on finding real defects, regressions, compatibility problems, and relevant documentation inconsistencies in the changes being reviewed. Use repository-specific conventions and architecture only when they are relevant to the changed code. If everything looks OK, be as brief as possible.
Focus on the current PR, not on producing general SDRangel documentation.
Cover:
- **PR context**: What the PR changes, which subsystems it affects, and any repository-specific context needed to review it correctly.
- **Relevant architecture**: Describe only the SDRangel architecture relevant to the changed code. Use concrete concepts such as plugins, devices, channels, features, DSP components, GUI components, message queues, FIFOs, worker threads, or WebAPI where applicable. Do not force the code into generic patterns such as MVC, MVVM, or monorepo architecture.
- **Relevant code structure**: Identify the classes, interfaces, directories, message types, queues, build files, generated code, or other components that matter to the PR. Do not describe unrelated parts of the repository.
- **Inheritance and existing infrastructure**: Before reporting missing functionality in a derived class, inspect its base classes and inherited methods, slots, signals, constructors, and established initialization paths. Do not request derived-class implementations when the required behavior is already provided by inherited code.
- **Relevant dependencies and tooling**: Mention Qt, CMake, external libraries, hardware APIs, generated code, CI, static analysis, sanitizers, or other tooling only when relevant to the PR.
- **Testing and validation**: SDRangel does not have an established unit-test or automated regression-test framework for its DSP, device, channel, feature, or GUI code. Do not request, recommend, or criticize a PR for missing unit tests, regression tests, test fixtures, or new test infrastructure. Do not turn manual validation requirements into requests to write automated tests. Compilation, CI, cppcheck, Coverity, OpenGrep, sanitizers, and similar automated checks are not testing recommendations for the PR review. Instead, identify appropriate directed manual validation for the actual changes, using SDRangel, relevant features, devices, signal sources, hardware, WebAPI, or existing operational workflows as appropriate. Manual test scenarios are valid review guidance; requests to implement those scenarios as automated tests are not.
- **Testing expectations**: Review whether the changed behavior can be meaningfully validated through the project's existing manual testing practices. The absence of an automated test framework is not a deficiency and must not be presented as a reason to add one. When validation is relevant, describe the concrete manual scenario to perform rather than suggesting automated test development.
- **No automated-test recommendations**: Never add a “Test suggestions” section recommending unit tests, regression tests, automated verification, test harnesses, or new testing infrastructure for SDRangel source changes. If validation is appropriate, describe the concrete **manual test scenario** the contributor or reviewer should perform instead. For example, say “Manually verify VHF DSC demodulation with 1300/2100 Hz tones” rather than “Unit test VHF DSC demodulation.” Do not convert each manual validation scenario into a separate automated-test recommendation.
- **Relevant conventions and pitfalls**: Identify established SDRangel conventions and concrete risks relevant to the changed code, such as thread/lifetime races, message ownership, queue handling, startup/shutdown ordering, Qt ownership, DSP/device lifecycle, settings serialization, API compatibility, generated code, or CMake dependencies. Only include issues relevant to the PR.
- **Scope discipline**: Review the changes in the PR rather than looking for unrelated existing issues. Do not report pre-existing problems unless the PR introduces, exposes, or materially changes them.
- **Documentation consistency**: Use relevant repository documentation, developer notes, and wiki material as review context. Assume the current code is authoritative when documentation or wiki content disagrees with it. Do not flag correct code merely because it differs from stale documentation. Instead, point out the documentation discrepancy when the PR changes or exposes behavior that is documented incorrectly or incompletely. Do not require documentation changes for purely internal implementation changes.
- **Generated and third-party code**: Identify generated, vendored, or externally maintained code relevant to the PR. Do not apply normal SDRangel source-review expectations to such code unless the PR intentionally modifies or integrates it.
- **Out of scope**: Do not request unrelated refactoring, broad modernization, new abstractions, architectural redesign, new automated tests, new test infrastructure, or generic best-practice changes. Do not flag missing unit or regression tests when they are not an established requirement for the affected code.
Rules:
Rules:
- Output only the Markdown content, with no preamble or explanation.
- Be concise. Every line should earn its place.
- Prefer concrete, actionable findings tied to changed code over speculative concerns or hypothetical future problems.
- Use short sections and bullets.
- Make the result specific to reviewing this PR, not a generic SDRangel architecture document.
- Before reporting a defect involving an existing class, method, or API, inspect its implementation and relevant callers when necessary to establish its actual behavior. Follow relevant ownership, lifetime, locking, cleanup, synchronization, inheritance, virtual methods, signals, slots, and initialization paths outside the diff. Do not infer behavior or missing functionality from method names, types, or changed code alone.
- Review changed code in the context of the actual repository implementation, including code outside the PR when it defines the behavior of changed code. Use that code to determine whether the PR introduces a defect, but do not report unrelated pre-existing issues.
- Base statements on actual repository code, documentation, and established project practices.
- Do not invent requirements or impose generic software-engineering practices.
- Do not recommend or request automated tests, unit tests, regression tests, test harnesses, or new test infrastructure. SDRangel does not have an automated test framework, and the absence of one is not a defect or a review finding.
- Never add a generic “Test suggestions” section solely because a PR lacks automated tests.
- Omit sections that are not relevant to the PR.
- When code and documentation disagree, do not assume the code is wrong. Treat the discrepancy as a documentation issue unless there is independent evidence of a code defect.

49
.gitattributes vendored

@ -1 +1,48 @@ @@ -1 +1,48 @@
*.fits binary
# Git attributes for SDRangel
# normalize text files to LF and identify binary files.
* text=auto eol=lf
# Vendored Cesium content: preserve upstream line endings.
plugins/feature/map/Cesium/** -text
# Generated Swagger UI files
sdrbase/resources/webapi/doc/swagger-ui/** -text
# Generated Swagger documentation and client code
sdrbase/resources/webapi/doc/swagger/** -text
swagger/sdrangel/code/** -text
# SDRangel configuration and preset files
*.cfgx binary
*.prex binary
# Binary image files.
*.png binary
*.PNG binary
*.bmp binary
*.BMP binary
*.xcf binary
*.XCF binary
*.jpg binary
*.JPG binary
*.fits binary
*.FITS binary
*.ico binary
*.ICO binary
*.icns binary
*.icns binary
*.gif binary
*.GIF binary
# Binary audio/media files.
*.wav binary
*.WAV binary
*.wasm binary
*.WASM binary
# Binary fonts.
*.ttf binary
*.TTF binary
# Binary document files.
*.odg binary

8
.githooks/pre-commit

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
#!/bin/sh
#fail if trailing spaces
if ! git diff --cached --check -- \
':(attr:text)' ':(attr:text=auto)'; then
echo "Error: Remove trailing whitespace from staged changes."
exit 1
fi

276
.github/workflows/coverity.sh

@ -0,0 +1,276 @@ @@ -0,0 +1,276 @@
#!/bin/bash
# Loosely based off https://github.com/the-tcpdump-group/libpcap/blob/master/.ci-coverity-scan-build.sh
# which is based off a script coverity released https://scan.coverity.com/download
if [ -z "${BASH_VERSION:-}" ]; then
echo "ERROR: This script must be run with bash"
exit 1
fi
set_output()
{
if [ -n "${GITHUB_OUTPUT:-}" ]; then
echo "$1" >> "$GITHUB_OUTPUT"
else
echo "$1"
fi
}
set -euo pipefail
if [[ $- == *x* ]]; then
echo "ERROR: bash xtrace (-x) is enabled and that might expose COVERITY_SCAN_TOKEN" >&2
exit 1
fi
PRECHECK=false
if [ "${1:-}" = "--precheck" ]; then
PRECHECK=true
fi
# Environment check
if [ -z "${COVERITY_SCAN_PROJECT_NAME:-}" ] ||
[ -z "${COVERITY_SCAN_PROJECT_ID:-}" ] ||
[ -z "${COVERITY_SCAN_NOTIFICATION_EMAIL:-}" ] ||
[ -z "${COVERITY_SCAN_TOKEN:-}" ]; then
printf "\033[33;1mNote: COVERITY_SCAN_PROJECT_NAME, COVERITY_SCAN_PROJECT_ID, COVERITY_SCAN_TOKEN are available on the Project Settings page on scan.coverity.com\033[0m\n"
[ -z "${COVERITY_SCAN_PROJECT_NAME:-}" ] && echo "ERROR: COVERITY_SCAN_PROJECT_NAME must be set"
[ -z "${COVERITY_SCAN_PROJECT_ID:-}" ] && echo "ERROR: COVERITY_SCAN_PROJECT_ID must be set"
[ -z "${COVERITY_SCAN_NOTIFICATION_EMAIL:-}" ] && echo "ERROR: COVERITY_SCAN_NOTIFICATION_EMAIL must be set"
[ -z "${COVERITY_SCAN_TOKEN:-}" ] && echo "ERROR: COVERITY_SCAN_TOKEN must be set"
exit 1
fi
REQUIRED_TOOLS=("curl" "git" "sed" "paste" "tar" "ruby" "md5sum" "jq")
for tool in "${REQUIRED_TOOLS[@]}"; do
if ! command -v "$tool" >/dev/null 2>&1; then
echo "ERROR: Required system tool '$tool' is not installed or available in PATH." >&2
exit 1
fi
done
PLATFORM=$(uname)
TOOL_ARCHIVE=/tmp/cov-analysis-${PLATFORM}.tgz
TOOL_URL=https://scan.coverity.com/download/linux64
TOOL_BASE=/tmp/coverity-scan-analysis
SCAN_URL="https://scan.coverity.com"
JOBS=$(( $(nproc) - 2 ))
[ "$JOBS" -lt 1 ] && JOBS=1
# Safely locate the repository root directory relative to this script
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
CMAKE_FILE="$REPO_ROOT/CMakeLists.txt"
if [ ! -f "$CMAKE_FILE" ]; then
echo "ERROR: CAN NOT FIND CMakeLists.txt"
exit 1
fi
SHA=$(git -C "$REPO_ROOT" rev-parse --short HEAD)
VERSION_SHA=$(sed -nE \
's/^set\(sdrangel_VERSION_(MAJOR|MINOR|PATCH) "([^"]+)".*/\2/p' \
"$CMAKE_FILE" | paste -sd.)"-g${SHA}"
COVERITY_VERSION=$(curl -s "https://scan.coverity.com/projects/${COVERITY_SCAN_PROJECT_NAME//\//-}" |
grep "Version:" | \
sed -e 's/<[^>]*>//g' -e 's/Version://' -e 's/^[ \t]*//' -e 's/[ \t]*$//')
echo "Coverity Remote Version: '$COVERITY_VERSION'"
echo "Local Code Version: '$VERSION_SHA'"
if [ "$COVERITY_VERSION" = "$VERSION_SHA" ]; then
printf "\033[33;1mCoverity matches current branch head, no need to analyze.\033[0m\n"
if [ "$PRECHECK" = true ]; then
set_output "run=false"
fi
exit 0
fi
printf "\033[33;1mCoverity is out of date. Progressing to analyze and upload\033[0m\n"
# Verify upload is permitted
AUTH_RES=$(curl -s --form project="$COVERITY_SCAN_PROJECT_NAME" --form token="$COVERITY_SCAN_TOKEN" $SCAN_URL/api/upload_permitted)
if [ "$AUTH_RES" = "Access denied" ]; then
printf "\033[33;1mCoverity Scan API access denied. Check COVERITY_SCAN_PROJECT_NAME and COVERITY_SCAN_TOKEN.\033[0m\n"
if [ "$PRECHECK" = true ]; then
set_output "run=false"
fi
exit 1
fi
AUTH=$(echo "$AUTH_RES" | ruby -e "require 'rubygems'; require 'json'; puts JSON[STDIN.read]['upload_permitted']")
if [ "$AUTH" = "true" ]; then
printf "\033[33;1mCoverity Scan analysis authorized per quota.\033[0m\n"
if [ "$PRECHECK" = true ]; then
set_output "run=true"
exit 0
fi
else
WHEN=$(echo "$AUTH_RES" | ruby -e "require 'rubygems'; require 'json'; puts JSON[STDIN.read]['next_upload_permitted_at']")
printf "\033[33;1mCoverity Scan analysis NOT authorized until %s.\033[0m\n" "$WHEN"
if [ "$PRECHECK" = true ]; then
set_output "run=false"
fi
exit 0
fi
if command -v cov-build >/dev/null 2>&1; then
printf "\033[33;1mUsing existing Coverity Build Tool\033[0m\n "
command -v cov-build
else
if [ ! -d $TOOL_BASE ]; then
# Download Coverity Scan Analysis Tool
if [ ! -e "$TOOL_ARCHIVE" ]; then
printf "\033[33;1mDownloading Coverity Scan Analysis Tool...\033[0m\n"
curl --data-urlencode "project=$COVERITY_SCAN_PROJECT_NAME" \
--data-urlencode "token=$COVERITY_SCAN_TOKEN" \
"$TOOL_URL" -o "$TOOL_ARCHIVE"
stat "$TOOL_ARCHIVE"
curl --data-urlencode "project=$COVERITY_SCAN_PROJECT_NAME" \
--data-urlencode "token=$COVERITY_SCAN_TOKEN" \
--data-urlencode "md5=1" \
"$TOOL_URL" -o "${TOOL_ARCHIVE}.md5"
stat "${TOOL_ARCHIVE}.md5"
cat "${TOOL_ARCHIVE}.md5"
md5sum "$TOOL_ARCHIVE"
echo "$(cat "${TOOL_ARCHIVE}.md5")" "$TOOL_ARCHIVE" | md5sum -c
fi
# Extract Coverity Scan Analysis Tool
printf "\033[33;1mExtracting Coverity Scan Analysis Tool...\033[0m\n"
mkdir -p $TOOL_BASE
tar xzf "$TOOL_ARCHIVE" -C "$TOOL_BASE"
fi
TOOL_DIR=$(find $TOOL_BASE -type d -name 'cov-analysis*')
export PATH="$TOOL_DIR/bin:$PATH"
fi
COVERITY_TOOL_VERSION=$(
cov-build version 2>&1 |
sed -n '1p' |
sed -E 's/.* version ([^ ]+) .*/\1/' ||
true
)
if [ -z "$COVERITY_TOOL_VERSION" ]; then
echo "ERROR: Unable to determine Coverity Build Capture version." >&2
exit 1
fi
printf "\033[33;1mCoverity Build Capture version: %s\033[0m\n" "$COVERITY_TOOL_VERSION"
# Configure
RESULTS_DIR="$REPO_ROOT/cov-int"
BUILD_DIR="$REPO_ROOT/build-coverity"
RESULTS_ARCHIVE="$REPO_ROOT/analysis-results.tgz"
cd "$REPO_ROOT" || {
echo "ERROR: Unable to change to repository root: $REPO_ROOT" >&2
exit 1
}
if [ ! -f "$RESULTS_ARCHIVE" ] ; then
rm -rf "$RESULTS_DIR"
rm -rf "$BUILD_DIR"
cmake -S "$REPO_ROOT" \
-B "$BUILD_DIR" \
-G Ninja \
-DENABLE_LTO=OFF -DENABLE_CCACHE=OFF
# Build
printf "\033[33;1mRunning Coverity Scan Analysis Tool...\033[0m\n"
cov-build --dir "$RESULTS_DIR" ninja -C "$BUILD_DIR" -j "$JOBS"
if grep -q "No files were emitted." "$RESULTS_DIR/build-log.txt"; then
echo "ERROR: Coverity did not emit any files." >&2
exit 1
fi
# Collects change data for source files from the SCM.
cov-import-scm --dir "$RESULTS_DIR" --scm git --log "$RESULTS_DIR/scm_log.txt" 2>&1
# Upload results
printf "\033[33;1mTarring Coverity Scan Analysis results...\033[0m\n"
tar czf "$RESULTS_ARCHIVE" -C "$REPO_ROOT" cov-int
fi
if ! tar tf "$RESULTS_ARCHIVE" | grep '^cov-int/build-log.txt$' >/dev/null; then
echo "ERROR: Coverity archive $RESULTS_ARCHIVE does not contain cov-int/build-log.txt" >&2
exit 1
fi
RESULTS_SIZE=$(stat -c '%s' "$RESULTS_ARCHIVE")
RESULTS_SIZE_MB=$((RESULTS_SIZE / 1024 / 1024))
printf "\033[33;1mCoverity results archive: %d MB\033[0m\n" "$RESULTS_SIZE_MB"
# Verify Coverity Scan script test mode
if [ "${coverity_scan_script_test_mode:-false}" = true ]; then
printf "\033[33;1mCoverity Scan configured in script test mode. Exit.\033[0m\n"
exit 0
fi
if [ "$RESULTS_SIZE" -gt "$((500 * 1024 * 1024))" ]; then
printf "\033[33;1mUploading Large Coverity Scan Analysis results...\033[0m\n"
# Step 1: Initialize build
INIT_RESPONSE=$(curl \
--fail \
--show-error \
--request POST \
--data-urlencode "version=$VERSION_SHA" \
--data-urlencode "description=Automated Build: $VERSION_SHA" \
--data-urlencode "email=$COVERITY_SCAN_NOTIFICATION_EMAIL" \
--data-urlencode "token=$COVERITY_SCAN_TOKEN" \
--data-urlencode "file_name=$(basename "$RESULTS_ARCHIVE")" \
"$SCAN_URL/projects/$COVERITY_SCAN_PROJECT_ID/builds/init")
UPLOAD_URL=$(echo "$INIT_RESPONSE" | jq -r '.url')
BUILD_ID=$(echo "$INIT_RESPONSE" | jq -r '.build_id')
if [ -z "$UPLOAD_URL" ] || [ "$UPLOAD_URL" = "null" ]; then
echo "ERROR: Coverity did not return an upload URL." >&2
exit 1
fi
if [ -z "$BUILD_ID" ] || [ "$BUILD_ID" = "null" ]; then
echo "ERROR: Coverity did not return a build ID." >&2
exit 1
fi
# Step 2: Upload to cloud
curl \
--fail \
--show-error \
--request PUT \
--header 'Content-Type: application/json' \
--upload-file "$RESULTS_ARCHIVE" \
"$UPLOAD_URL"
# Step 3: Enqueue build
curl \
--fail \
--show-error \
--request PUT \
--data-urlencode "token=$COVERITY_SCAN_TOKEN" \
"$SCAN_URL/projects/$COVERITY_SCAN_PROJECT_ID/builds/$BUILD_ID/enqueue"
else
printf "\033[33;1mUploading Coverity Scan Analysis results...\033[0m\n"
UPLOAD_URL="https://scan.coverity.com/builds"
response=$(curl \
--silent --write-out "\n%{http_code}\n" \
--form project="$COVERITY_SCAN_PROJECT_NAME" \
--form token="$COVERITY_SCAN_TOKEN" \
--form "email=$COVERITY_SCAN_NOTIFICATION_EMAIL" \
--form "file=@$RESULTS_ARCHIVE" \
--form version="$VERSION_SHA" \
--form description="Automated Build: $VERSION_SHA" \
$UPLOAD_URL)
status_code=$(echo "$response" | sed -n '$p')
if [ "$status_code" != "200" ] && [ "$status_code" != "201" ]; then
TEXT=$(echo "$response" | sed '$d')
printf "\033[33;1mCoverity Scan upload failed with HTTP status code '%s': %s.\033[0m\n" "$status_code" "$TEXT"
exit 1
fi
fi

55
.github/workflows/coverity.yml

@ -0,0 +1,55 @@ @@ -0,0 +1,55 @@
name: SDRangel Linux Coverity build
# Run every day at 3:00am UTC
on:
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
jobs:
build_coverity:
if: github.repository == 'f4exb/sdrangel'
# run once on latest
runs-on: ubuntu-24.04
env:
COVERITY_SCAN_PROJECT_NAME: ${{ github.repository }}
COVERITY_SCAN_PROJECT_ID : "33161"
COVERITY_SCAN_NOTIFICATION_EMAIL: ${{ secrets.COVERITY_SCAN_NOTIFICATION_EMAIL }}
COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Check Coverity
id: coverity_check
run: |
./.github/workflows/coverity.sh --precheck
# keep dependencies synced with linux.yml
- name: Install dependencies
if: steps.coverity_check.outputs.run == 'true'
run: |
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ettusresearch/uhd
sudo apt-get update
sudo apt-get -y install build-essential cmake git xxd \
devscripts fakeroot debhelper libfftw3-dev qtbase5-dev libopengl-dev libqt5opengl5-dev \
qttools5-dev qttools5-dev-tools qtmultimedia5-dev libqt5multimedia5-plugins libqt5websockets5-dev \
libqt5quick5 qtwebengine5-dev qtbase5-private-dev \
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 \
libqt5serialport5-dev qtdeclarative5-dev qtpositioning5-dev qtlocation5-dev \
libqt5charts5-dev libqt5texttospeech5-dev libqt5gamepad5-dev libqt5svg5-dev libfaad-dev libflac-dev zlib1g-dev \
libusb-1.0-0-dev libhidapi-dev libboost-all-dev libasound2-dev libopencv-dev libopencv-imgcodecs-dev \
libxml2-dev bison flex ffmpeg libpostproc-dev libavcodec-dev libavformat-dev libavfilter-dev \
libopus-dev libcodec2-dev libairspy-dev libhackrf-dev \
libbladerf-dev libsoapysdr-dev libiio-dev libuhd-dev libhamlib-dev libunwind-dev \
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: Build SDRangel for Coverity
if: steps.coverity_check.outputs.run == 'true'
run: |
./.github/workflows/coverity.sh

43
.github/workflows/git-attributes.yml

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
name: Check Git attributes
on:
pull_request:
jobs:
check-gitattributes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for line ending violations
run: |
# Re-normalize all files according to .gitattributes
git add --renormalize .
# Check if renormalization changed anything
if git diff --cached --name-only | grep -q .; then
echo "::error::The following files have line endings that don't match .gitattributes settings:"
git diff --cached --name-only
echo ""
echo "To fix, run:"
echo " git add --renormalize ."
echo " git commit -m 'Normalize line endings'"
exit 1
fi
echo "All files have correct line endings."
- name: Check for trailing whitespace
run: |
if ! git diff --check \
"${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}" \
-- ':(attr:text)' ':(attr:text=auto)'; then
echo "::error::Trailing whitespace found in the pull request."
echo "Remove trailing spaces and tabs from added lines."
exit 1
fi
echo "No trailing whitespace found in the pull request."

23
.github/workflows/linux-qt6.yml

@ -11,11 +11,18 @@ on: @@ -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:
@ -38,7 +45,7 @@ jobs: @@ -38,7 +45,7 @@ jobs:
qml6-module-qt5compat-graphicaleffects qt6-speech-speechd-plugin \
libfaad-dev libflac-dev zlib1g-dev \
libusb-1.0-0-dev libhidapi-dev libboost-all-dev libasound2-dev libopencv-dev libopencv-imgcodecs-dev \
libxml2-dev bison flex ffmpeg libavcodec-dev libavformat-dev \
libxml2-dev bison flex ffmpeg libavcodec-dev libavformat-dev libavfilter-dev \
libopus-dev libcodec2-dev libairspy-dev libhackrf-dev \
libbladerf-dev libsoapysdr-dev libiio-dev libuhd-dev libhamlib-dev libunwind-dev \
libavahi-client-dev libavahi-common-dev libaio-dev \
@ -52,7 +59,7 @@ jobs: @@ -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: @@ -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

151
.github/workflows/linux.yml

@ -1,75 +1,76 @@ @@ -1,75 +1,76 @@
name: SDRangel Linux release build
on:
push:
branches:
- linux_github_release
tags:
- 'v*'
workflow_dispatch:
jobs:
build_deb:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-24.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ettusresearch/uhd
sudo apt-get update
sudo apt-get -y install build-essential cmake git xxd \
devscripts fakeroot debhelper libfftw3-dev qtbase5-dev libopengl-dev libqt5opengl5-dev \
qttools5-dev qttools5-dev-tools qtmultimedia5-dev libqt5multimedia5-plugins libqt5websockets5-dev \
libqt5quick5 qtwebengine5-dev qtbase5-private-dev \
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 \
libqt5serialport5-dev qtdeclarative5-dev qtpositioning5-dev qtlocation5-dev \
libqt5charts5-dev libqt5texttospeech5-dev libqt5gamepad5-dev libqt5svg5-dev libfaad-dev libflac-dev zlib1g-dev \
libusb-1.0-0-dev libhidapi-dev libboost-all-dev libasound2-dev libopencv-dev libopencv-imgcodecs-dev \
libxml2-dev bison flex ffmpeg libpostproc-dev libavcodec-dev libavformat-dev \
libopus-dev libcodec2-dev libairspy-dev libhackrf-dev \
libbladerf-dev libsoapysdr-dev libiio-dev libuhd-dev libhamlib-dev libunwind-dev \
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: Build SDRangel
run: |
if [ "${RUNNING_IN_ACT:-}" = "true" ]; then
mkdir -p /tmp/build
rsync -a --delete . /tmp/build/sdrangel/
cd /tmp/build/sdrangel
debuild -i -us -uc -b
cp ../sdrangel_*_amd64.deb "$GITHUB_WORKSPACE"/
else
debuild -i -us -uc -b
fi
- name: Get version
id: get_version
run: |
if [[ "${{github.ref_name}}" == "linux_github_release" ]]; then
echo "version=$(echo ${{github.sha}} | cut -c1-7)" >> $GITHUB_OUTPUT
else
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
- 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: 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
name: SDRangel Linux release build
on:
push:
branches:
- linux_github_release
tags:
- 'v*'
workflow_dispatch:
jobs:
build_deb:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-24.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Install dependencies
# ensure changes in dependencies get added to coverity.yml
run: |
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ettusresearch/uhd
sudo apt-get update
sudo apt-get -y install build-essential cmake git xxd \
devscripts fakeroot debhelper libfftw3-dev qtbase5-dev libopengl-dev libqt5opengl5-dev \
qttools5-dev qttools5-dev-tools qtmultimedia5-dev libqt5multimedia5-plugins libqt5websockets5-dev \
libqt5quick5 qtwebengine5-dev qtbase5-private-dev \
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 \
libqt5serialport5-dev qtdeclarative5-dev qtpositioning5-dev qtlocation5-dev \
libqt5charts5-dev libqt5texttospeech5-dev libqt5gamepad5-dev libqt5svg5-dev libfaad-dev libflac-dev zlib1g-dev \
libusb-1.0-0-dev libhidapi-dev libboost-all-dev libasound2-dev libopencv-dev libopencv-imgcodecs-dev \
libxml2-dev bison flex ffmpeg libpostproc-dev libavcodec-dev libavformat-dev libavfilter-dev \
libopus-dev libcodec2-dev libairspy-dev libhackrf-dev \
libbladerf-dev libsoapysdr-dev libiio-dev libuhd-dev libhamlib-dev libunwind-dev \
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: Build SDRangel
run: |
if [ "${RUNNING_IN_ACT:-}" = "true" ]; then
mkdir -p /tmp/build
rsync -a --delete . /tmp/build/sdrangel/
cd /tmp/build/sdrangel
debuild -i -us -uc -b
cp ../sdrangel_*_amd64.deb "$GITHUB_WORKSPACE"/
else
debuild -i -us -uc -b
fi
- name: Get version
id: get_version
run: |
if [[ "${{github.ref_name}}" == "linux_github_release" ]]; then
echo "version=$(echo ${{github.sha}} | cut -c1-7)" >> $GITHUB_OUTPUT
else
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
- 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: 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

8
.github/workflows/mac.yml

@ -36,7 +36,7 @@ jobs: @@ -36,7 +36,7 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: '6.11.1'
version: '6.11.2'
host: 'mac'
arch: 'clang_64'
modules: 'qtcharts qtscxml qt5compat qtlocation qtmultimedia qtpositioning qtserialport qtspeech qtwebsockets qtwebengine qtshadertools qtwebchannel'
@ -87,7 +87,7 @@ jobs: @@ -87,7 +87,7 @@ jobs:
files: ${{ github.workspace }}/build/${{ steps.get_filename.outputs.filename }}.dmg
build_mac_arm64:
runs-on: macos-14
runs-on: macos-15
steps:
- uses: actions/checkout@v4
with:
@ -111,7 +111,7 @@ jobs: @@ -111,7 +111,7 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: '6.11.1'
version: '6.11.2'
host: 'mac'
arch: 'clang_64'
modules: 'qtcharts qtscxml qt5compat qtlocation qtmultimedia qtpositioning qtserialport qtspeech qtwebsockets qtwebengine qtshadertools qtwebchannel'
@ -175,7 +175,7 @@ jobs: @@ -175,7 +175,7 @@ jobs:
runner: macos-15-intel
artifact_pattern: sdrangel-*-macx64.dmg
- arch: arm64
runner: macos-14
runner: macos-15
artifact_pattern: sdrangel-*-macarm64.dmg
runs-on: ${{ matrix.runner }}

77
.github/workflows/packet-demod.yml

@ -0,0 +1,77 @@ @@ -0,0 +1,77 @@
name: Packet Demod regression tests
on:
pull_request:
paths:
- 'plugins/channelrx/demodpacket/**'
- 'sdrbase/dsp/**'
- 'sdrbase/util/**'
- '.github/workflows/packet-demod.yml'
push:
paths:
- 'plugins/channelrx/demodpacket/**'
- '.github/workflows/packet-demod.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
dsp:
runs-on: ubuntu-24.04
strategy:
matrix:
include:
- qt: 5
package: qtbase5-dev
- qt: 6
package: qt6-base-dev
steps:
- uses: actions/checkout@v4
- run: sudo apt-get update && sudo apt-get install -y ninja-build ${{ matrix.package }}
- run: >-
cmake -S plugins/channelrx/demodpacket/tests -B build-packet-tests -G Ninja
-DCMAKE_BUILD_TYPE=Debug -DPACKET_TEST_SANITIZERS=ON
-DQT_DIR=/usr/lib/x86_64-linux-gnu/cmake/Qt${{ matrix.qt }}
- run: cmake --build build-packet-tests --parallel 2
- run: ctest --test-dir build-packet-tests --output-on-failure
env:
UBSAN_OPTIONS: halt_on_error=1
plugin:
runs-on: ubuntu-24.04
strategy:
matrix:
include:
- qt: 5
enable_qt6: 'OFF'
packages: >-
qtbase5-dev qtbase5-private-dev qtmultimedia5-dev
libqt5websockets5-dev qtpositioning5-dev libqt5charts5-dev
libqt5serialport5-dev
- qt: 6
enable_qt6: 'ON'
packages: >-
qt6-base-dev qt6-base-private-dev qt6-multimedia-dev
qt6-websockets-dev qt6-positioning-dev qt6-charts-dev
qt6-serialport-dev
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y ninja-build ${{ matrix.packages }} \
libfftw3-dev libusb-1.0-0-dev libflac-dev \
libboost-dev libopus-dev
- name: Configure server plugin and integration test
run: >-
cmake -S . -B build-packet-server -G Ninja -DCMAKE_BUILD_TYPE=Release
-DENABLE_QT6=${{ matrix.enable_qt6 }}
-DBUILD_GUI=OFF -DBUILD_SERVER=ON -DBUILD_BENCH=OFF
-DENABLE_EXTERNAL_LIBRARIES=OFF -DENABLE_LIBUNWIND=OFF
-DENABLE_FEATURE=OFF -DENABLE_CHANNELTX=OFF -DENABLE_CHANNELMIMO=OFF
-DPACKETDEMOD_BUILD_TESTS=ON -DPACKETDEMOD_TEST_SANITIZERS=ON
- run: cmake --build build-packet-server --target demodpacketsrv packetdemod_sink_test --parallel 2
- run: ./build-packet-server/packetdemod_sink_test
env:
UBSAN_OPTIONS: halt_on_error=1

42
.github/workflows/sdrangel.yml

@ -94,6 +94,7 @@ jobs: @@ -94,6 +94,7 @@ jobs:
choco install patch
mkdir build && cd build
cmake .. -G "${{ matrix.config.generators }}" -DCMAKE_BUILD_TYPE=Release -DENABLE_QT6=ON -DARCH_OPT=SSE4_2 -DDEBUG_OUTPUT=ON -DENABLE_MIRISDR=OFF -DBUILD_SERVER=OFF -DCMAKE_PREFIX_PATH="C:\Qt\6.9.3\msvc2022_64;C:\Libraries\boost_1_73_0"
cmake --build . --config Release
cmake --build . --config Release --target package
- name: Check disk space
run: Get-PSDrive
@ -107,7 +108,7 @@ jobs: @@ -107,7 +108,7 @@ jobs:
path: ${{ github.workspace }}/build/sdrangel-${{ steps.get_version.outputs.version }}-win64.exe
build_mac:
runs-on: macos-14
runs-on: macos-26
steps:
- uses: actions/checkout@v4
with:
@ -128,12 +129,47 @@ jobs: @@ -128,12 +129,47 @@ jobs:
rm -f /usr/local/bin/2to3
brew install opencv
- name: Install brew packages
run: brew install nasm boost hidapi libusb fftw ffmpeg@5 faad2 zlib airspy airspyhf hackrf rtl-sdr libbladerf soapysdr qt subversion ncurses
run: brew install nasm boost hidapi libusb fftw ffmpeg faad2 zlib airspy airspyhf hackrf rtl-sdr libbladerf soapysdr qt subversion ncurses
- name: Configure SDRangel
run: |
mkdir build && cd build
cmake .. -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_QT6=ON -DCMAKE_BUILD_TYPE=Release -DDEBUG_OUTPUT=ON -DENABLE_CHANNELRX_DEMODDATV=OFF -DENABLE_CHANNELTX_MODDATV=OFF -DENABLE_MIRISDR=OFF -DBUILD_SERVER=OFF -DENABLE_EXTERNAL_LIBRARIES=AUTO -DBUNDLE=ON -DPKG_CONFIG_USE_CMAKE_PREFIX_PATH=TRUE -DCMAKE_PREFIX_PATH="/usr/local/opt/ffmpeg@5/"
cmake .. -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_QT6=ON -DCMAKE_BUILD_TYPE=Release -DDEBUG_OUTPUT=ON -DENABLE_CHANNELRX_DEMODDATV=OFF -DENABLE_CHANNELTX_MODDATV=OFF -DENABLE_MIRISDR=OFF -DBUILD_SERVER=OFF -DENABLE_EXTERNAL_LIBRARIES=AUTO -DBUNDLE=ON -DPKG_CONFIG_USE_CMAKE_PREFIX_PATH=TRUE
- name: Build SDRangel on Mac
run: |
cd build
make -j3
build_linux:
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ettusresearch/uhd
sudo apt-get update
sudo apt-get -y install build-essential cmake git xxd \
devscripts fakeroot debhelper libfftw3-dev qtbase5-dev libopengl-dev libqt5opengl5-dev \
qttools5-dev qttools5-dev-tools qtmultimedia5-dev libqt5multimedia5-plugins libqt5websockets5-dev \
libqt5quick5 qtwebengine5-dev qtbase5-private-dev \
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 \
libqt5serialport5-dev qtdeclarative5-dev qtpositioning5-dev qtlocation5-dev \
libqt5charts5-dev libqt5texttospeech5-dev libqt5gamepad5-dev libqt5svg5-dev libfaad-dev libflac-dev zlib1g-dev \
libusb-1.0-0-dev libhidapi-dev libboost-all-dev libasound2-dev libopencv-dev libopencv-imgcodecs-dev \
libxml2-dev bison flex ffmpeg libpostproc-dev libavcodec-dev libavformat-dev libavfilter-dev \
libopus-dev libcodec2-dev libairspy-dev libhackrf-dev \
libbladerf-dev libsoapysdr-dev libiio-dev libuhd-dev libhamlib-dev libunwind-dev \
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: Build SDRangel on Linux
run: |
debuild -i -us -uc -b

1
.travis.yml

@ -54,6 +54,7 @@ addons: @@ -54,6 +54,7 @@ addons:
- ffmpeg
- libavcodec-dev
- libavformat-dev
- libavfilter-dev
- libopus-dev
- libcodec2-dev
- libairspy-dev

49
CMakeLists.txt

@ -1,5 +1,8 @@ @@ -1,5 +1,8 @@
message(STATUS "cmake version: ${CMAKE_VERSION}")
cmake_minimum_required(VERSION 3.17.0)
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.31")
cmake_policy(SET CMP0177 NEW)
endif()
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
@ -32,6 +35,8 @@ option(RX_SAMPLE_24BIT "Internal 24 bit Rx DSP" ON) @@ -32,6 +35,8 @@ option(RX_SAMPLE_24BIT "Internal 24 bit Rx DSP" ON)
option(BUILD_SERVER "Build Server" ON)
option(BUILD_GUI "Build GUI" ON)
option(BUILD_BENCH "Build benchmark" ON)
option(BUILD_MCP_BRIDGE "Build the Claude Desktop stdio bridge for the MCP server feature" ON)
option(BUILD_MCP_BUNDLE "Package the MCP bridge as a Claude Desktop extension bundle" ON)
option(HIDE_CONSOLE "Hide console when running GUI on Windows" ON)
option(BUNDLE "Enable distribution bundle" OFF)
set(ARCH_OPT "native" CACHE STRING "Specify instruction set to use. Will be passed directly as `-march` or `/arch:` argument on supported compilers. \
@ -132,13 +137,16 @@ option(ENABLE_CHANNELRX "Enable channelrx plugins" ON) @@ -132,13 +137,16 @@ option(ENABLE_CHANNELRX "Enable channelrx plugins" ON)
option(ENABLE_CHANNELRX_DEMODADSB "Enable channelrx demodadsb plugin" ON)
option(ENABLE_CHANNELRX_DEMODAM "Enable channelrx demodam plugin" ON)
option(ENABLE_CHANNELRX_DEMODDATV "Enable channelrx demoddatv plugin" ON)
option(ENABLE_CHANNELRX_DEMODDVB "Enable channelrx demoddvb plugin" ON)
option(ENABLE_CHANNELRX_RADIOCLOCK "Enable channelrx radioclock plugin" ON)
option(ENABLE_CHANNELRX_RADIOASTRONOMY "Enable channelrx radioastronomy plugin" ON)
option(ENABLE_CHANNELRX_DEMODRADIOSONDE "Enable channelrx demodradiosonde plugin" ON)
option(ENABLE_CHANNELRX_DEMODDRONEID "Enable channelrx demoddroneid plugin" ON)
option(ENABLE_CHANNELRX_FREQTRACKER "Enable channelrx freqtracker plugin" ON)
option(ENABLE_CHANNELRX_DEMODATV "Enable channelrx demodatv plugin" ON)
option(ENABLE_CHANNELRX_DEMODPAGER "Enable channelrx demodpager plugin" ON)
option(ENABLE_CHANNELRX_DEMODDAB "Enable channelrx demoddab plugin" ON)
option(ENABLE_CHANNELRX_DEMODDRM "Enable channelrx demoddrm plugin" ON)
option(ENABLE_CHANNELRX_UDPSINK "Enable channelrx udpsink plugin" ON)
option(ENABLE_CHANNELRX_DEMODAIS "Enable channelrx demodais plugin" ON)
option(ENABLE_CHANNELRX_DEMODNFM "Enable channelrx demodnfm plugin" ON)
@ -160,11 +168,14 @@ option(ENABLE_CHANNELRX_DEMODVOR "Enable channelrx demodvor plugin" ON) @@ -160,11 +168,14 @@ option(ENABLE_CHANNELRX_DEMODVOR "Enable channelrx demodvor plugin" ON)
option(ENABLE_CHANNELRX_LOCALSINK "Enable channelrx localsink plugin" ON)
option(ENABLE_CHANNELRX_DEMODPACKET "Enable channelrx demodpacket plugin" ON)
option(ENABLE_CHANNELRX_DEMODAPT "Enable channelrx demodapt plugin" ON)
option(ENABLE_CHANNELRX_DEMODWEFAX "Enable channelrx demodwefax plugin" ON)
option(ENABLE_CHANNELRX_DEMODDSD "Enable channelrx demoddsd plugin" ON)
option(ENABLE_CHANNELRX_DEMODFT8 "Enable channelrx demodft8 plugin" ON)
option(ENABLE_CHANNELRX_DEMODNAVTEX "Enable channelrx demodnavtex plugin" ON)
option(ENABLE_CHANNELRX_DEMODRTTY "Enable channelrx demodrtty plugin" ON)
option(ENABLE_CHANNELRX_DEMODPSK31 "Enable channelrx demodpsk31 plugin" ON)
option(ENABLE_CHANNELRX_DEMODILS "Enable channelrx demodils plugin" ON)
option(ENABLE_CHANNELRX_DEMODSELCAL "Enable channelrx demodselcal plugin" ON)
option(ENABLE_CHANNELRX_DEMODDSC "Enable channelrx demoddsc plugin" ON)
option(ENABLE_CHANNELRX_HEATMAP "Enable channelrx heatmap plugin" ON)
option(ENABLE_CHANNELRX_FREQSCANNER "Enable channelrx freqscanner plugin" ON)
@ -190,6 +201,7 @@ option(ENABLE_CHANNELTX_MODCHIRPCHAT "Enable channeltx modchirpchat plugin" ON) @@ -190,6 +201,7 @@ option(ENABLE_CHANNELTX_MODCHIRPCHAT "Enable channeltx modchirpchat plugin" ON)
option(ENABLE_CHANNELTX_MODMESHTASTIC "Enable channeltx modmeshtastic plugin" ON)
option(ENABLE_CHANNELTX_MODMESHCORE "Enable channeltx modmeshcore plugin" ON)
option(ENABLE_CHANNELTX_MODWFM "Enable channeltx modwfm plugin" ON)
option(ENABLE_CHANNELTX_MODBFM "Enable channeltx modbfm plugin" ON)
option(ENABLE_CHANNELTX_MODATV "Enable channeltx modatv plugin" ON)
option(ENABLE_CHANNELTX_MOD802.15.4 "Enable channeltx mod802.15.4 plugin" ON)
option(ENABLE_CHANNELTX_REMOTESOURCE "Enable channeltx remotesource plugin" ON)
@ -229,6 +241,7 @@ option(ENABLE_FEATURE_SID "Enable feature sid plugin" ON) @@ -229,6 +241,7 @@ option(ENABLE_FEATURE_SID "Enable feature sid plugin" ON)
option(ENABLE_FEATURE_MORSEDECODER "Enable feature morsedecoder plugin" ON)
option(ENABLE_FEATURE_DENOISER "Enable feature denoiser plugin" ON)
option(ENABLE_FEATURE_FREQDISPLAY "Enable feature freqdisplay plugin" ON)
option(ENABLE_FEATURE_MCPSERVER "Enable feature mcpserver plugin" ON)
# on windows always build external libraries
if(WIN32)
@ -262,8 +275,10 @@ if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git/") @@ -262,8 +275,10 @@ if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git/")
endif()
endif()
find_program(CCACHE "ccache")
if(CCACHE AND NOT EMSCRIPTEN)
option(ENABLE_CCACHE "Enable ccache for faster builds" ON)
if (ENABLE_CCACHE)
find_program(CCACHE "ccache")
if(CCACHE AND NOT EMSCRIPTEN)
message(STATUS "Using ccache ${CCACHE}")
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE})
@ -271,6 +286,11 @@ if(CCACHE AND NOT EMSCRIPTEN) @@ -271,6 +286,11 @@ if(CCACHE AND NOT EMSCRIPTEN)
set(CMAKE_OBJCXX_COMPILER_LAUNCHER ${CCACHE})
endif()
set(ENV{CCACHE_SLOPPINESS} pch_defines,time_macros)
else()
message(STATUS "Skipping ccache")
endif()
else()
message(STATUS "Disabled ccache")
endif()
set(sdrangel_VERSION "${sdrangel_VERSION_MAJOR}.${sdrangel_VERSION_MINOR}.${sdrangel_VERSION_PATCH}${sdrangel_VERSION_SUFFIX}" CACHE INTERNAL "")
@ -420,6 +440,10 @@ elseif (WIN32) @@ -420,6 +440,10 @@ elseif (WIN32)
set(FFTW3F_WISDOM "${EXTERNAL_LIBRARY_FOLDER}/fftw-3/fftwf-wisdom.exe" CACHE INTERNAL "")
set(FFTW3F_DLL_DIR "${EXTERNAL_LIBRARY_FOLDER}/fftw-3" CACHE INTERNAL "")
set(OPUS_FOUND ON CACHE INTERNAL "")
set(OPUS_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/external/windows/libopus/include" CACHE INTERNAL "")
set(OPUS_LIBRARIES "${CMAKE_SOURCE_DIR}/external/windows/libopus/lib/opus.lib" CACHE INTERNAL "")
set(LIBUSB_FOUND ON CACHE INTERNAL "")
set(LIBUSB_INCLUDE_DIR "${EXTERNAL_LIBRARY_FOLDER}/libusb/include" CACHE INTERNAL "")
set(LIBUSB_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/libusb/MS64/dll/libusb-1.0.lib" CACHE INTERNAL "")
@ -474,6 +498,8 @@ elseif (WIN32) @@ -474,6 +498,8 @@ elseif (WIN32)
set(SWRESAMPLE_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/lib/swresample.lib" CACHE INTERNAL "")
set(SWSCALE_INCLUDE_DIRS "${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/include" CACHE INTERNAL "")
set(SWSCALE_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/lib/swscale.lib" CACHE INTERNAL "")
set(AVFILTER_INCLUDE_DIRS "${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/include" CACHE INTERNAL "")
set(AVFILTER_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/lib/avfilter.lib" CACHE INTERNAL "")
# LimeSuite FX3 support
set(FX3SDK_DIR "${EXTERNAL_LIBRARY_FOLDER}/FX3SDK" CACHE INTERNAL "")
@ -485,7 +511,8 @@ elseif (WIN32) @@ -485,7 +511,8 @@ elseif (WIN32)
set(FAAD_FOUND ON CACHE INTERNAL "")
set(FAAD_INCLUDE_DIR "${EXTERNAL_LIBRARY_FOLDER}/faad2/include" CACHE INTERNAL "")
set(FAAD_LIBRARY "${EXTERNAL_LIBRARY_FOLDER}/faad2/lib/libfaad.lib" CACHE INTERNAL "")
set(FAAD_LIBRARY "${EXTERNAL_LIBRARY_FOLDER}/faad2/lib/faad.lib" CACHE INTERNAL "")
set(FAAD_DRM_LIBRARY "${EXTERNAL_LIBRARY_FOLDER}/faad2/lib/faad_drm.lib" CACHE INTERNAL "")
set(ZLIB_FOUND ON CACHE INTERNAL "")
set(ZLIB_INCLUDE_DIRS "${EXTERNAL_LIBRARY_FOLDER}/zlib/include" CACHE INTERNAL "")
@ -701,6 +728,7 @@ elseif(ANDROID) @@ -701,6 +728,7 @@ elseif(ANDROID)
${CMAKE_BINARY_DIR}/lib/libmetisdevice.so
${CMAKE_BINARY_DIR}/lib/libmodemm17.so
${CMAKE_BINARY_DIR}/lib/libmodemmeshtastic.so
${CMAKE_BINARY_DIR}/lib/libmodemdvb.so
${CMAKE_BINARY_DIR}/lib/libwdsp.so
CACHE INTERNAL ""
)
@ -984,6 +1012,8 @@ elseif(ENABLE_EXTERNAL_LIBRARIES STREQUAL "AUTO") @@ -984,6 +1012,8 @@ elseif(ENABLE_EXTERNAL_LIBRARIES STREQUAL "AUTO")
if(NOT ANDROID)
find_package(LibUSB)
endif()
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND ENABLE_EXTERNAL_LIBRARIES STREQUAL "ON")
find_package(FFTW3F)
endif()
if (NOT ENABLE_EXTERNAL_LIBRARIES OR (ENABLE_EXTERNAL_LIBRARIES STREQUAL "AUTO"))
@ -1009,6 +1039,9 @@ if (NOT ENABLE_EXTERNAL_LIBRARIES OR (ENABLE_EXTERNAL_LIBRARIES STREQUAL "AUTO") @@ -1009,6 +1039,9 @@ if (NOT ENABLE_EXTERNAL_LIBRARIES OR (ENABLE_EXTERNAL_LIBRARIES STREQUAL "AUTO")
find_package(LibAcars)
find_package(RNnoise)
find_package(FLAC)
if (ENABLE_CHANNELRX AND ENABLE_CHANNELRX_DEMODDRM)
find_package(FDKAAC)
endif()
# Devices
if(ENABLE_AIRSPY)
@ -1082,6 +1115,10 @@ add_subdirectory(devices) @@ -1082,6 +1115,10 @@ add_subdirectory(devices)
add_subdirectory(modemm17)
add_subdirectory(modemmeshtastic)
add_subdirectory(modemmeshcore)
add_subdirectory(modemdvb)
if (ENABLE_CHANNELRX AND ENABLE_CHANNELRX_DEMODDRM)
add_subdirectory(modemdrm)
endif()
if (FFTW3F_FOUND)
add_subdirectory(ft8)
@ -1099,6 +1136,12 @@ if (BUILD_BENCH) @@ -1099,6 +1136,12 @@ if (BUILD_BENCH)
add_subdirectory(sdrbench)
endif()
# Standalone, and not built by default: only a release that ships a Claude Desktop
# extension bundle needs it
if (BUILD_MCP_BRIDGE OR BUILD_MCP_BUNDLE)
add_subdirectory(plugins/feature/mcpserver/bridge)
endif()
if (BUILD_GUI)
add_subdirectory(sdrgui)
add_subdirectory(plugins plugins)

3
CMakePresets.json

@ -66,6 +66,7 @@ @@ -66,6 +66,7 @@
"ENABLE_XTRX": "ON",
"ENABLE_USRP": "ON",
"BUILD_SERVER": "OFF",
"BUILD_MCP_BUNDLE": "ON",
"CMAKE_PREFIX_PATH": "C:/Qt/5.15.2/msvc2019_64;C:/Applications/boost_1_81_0"
},
"warnings": {
@ -91,7 +92,7 @@ @@ -91,7 +92,7 @@
"binaryDir": "${sourceDir}/build-qt6",
"cacheVariables": {
"ENABLE_QT6": "ON",
"CMAKE_PREFIX_PATH": "C:/Qt/6.7.3/msvc2022_64;C:/Applications/boost_1_81_0"
"CMAKE_PREFIX_PATH": "C:/Qt/6.11.2/msvc2022_64;C:/Applications/boost_1_81_0"
}
}
],

20
FIXME-notes.md

@ -1,3 +1,23 @@ @@ -1,3 +1,23 @@
## Enable Git pre-commit hooks
SDRangel provides a Git pre-commit hook to check staged changes for trailing
whitespace before a commit is created. The hook is maintained in
`.githooks/pre-commit` and uses `.gitattributes` to determine which files to
check.
To enable the hook, run the following command from your repository root:
```bash
git config core.hooksPath .githooks
```
This configuration is local to your clone and only needs to be set once.
After enabling it, Git automatically runs the hook before each commit. If
trailing whitespace is detected, the commit is rejected. Correct the affected
lines, stage the changes, and try again.
The hook is shared through the repository, but enabling it is a per-clone setup
step. GitHub Actions also checks pull requests for trailing whitespace, providing
a server-side check independent of the local hook.
## meshtasticdemodgui.cpp - checkbox signal pattern
All checkboxes currently use stateChanged(int) pattern.
Consider refactoring all to clicked(bool) for simplicity in a future cleanup commit.

10
Readme.md

@ -2,6 +2,16 @@ @@ -2,6 +2,16 @@
**SDRangel** is an open-source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
License : [![License](https://img.shields.io/github/license/f4exb/sdrangel)](https://github.com/f4exb/sdrangel/blob/master/LICENSE)
Latest Release : [![GitHub release](https://img.shields.io/github/release/f4exb/sdrangel.svg)](https://github.com/f4exb/sdrangel/releases/latest)
Source : [![Commits since last release](https://img.shields.io/github/commits-since/f4exb/sdrangel/latest)](https://github.com/f4exb/sdrangel/commits/master/) [![Size](https://img.shields.io/github/repo-size/f4exb/sdrangel)](https://github.com/f4exb/sdrangel)
Downloads : [![Github All Releases](https://img.shields.io/github/downloads/f4exb/sdrangel/total.svg)](https://github.com/f4exb/sdrangel/releases/latest)
Analysis : [![Coverity Scan Build Status](https://img.shields.io/coverity/scan/33161.svg)](https://scan.coverity.com/projects/f4exb-sdrangel) [![Codacy grade](https://img.shields.io/codacy/grade/21c6814b9f4c4ce68419463e8a6ad57d)](https://app.codacy.com/gh/f4exb/sdrangel/dashboard)
Issues : [![open issues](https://img.shields.io/github/issues/f4exb/sdrangel.svg)](https://github.com/f4exb/sdrangel/issues)
[![closed issues](https://img.shields.io/github/issues-closed/f4exb/sdrangel.svg)](https://github.com/f4exb/sdrangel/issues?q=is%3Aissue+is%3Aclosed)
**Wiki**: Most of the information and documentation related to SDRangel can be found in the [Wiki](https://github.com/f4exb/sdrangel/wiki). Please make sure to check it in case of questions or trouble and before you post issues on GitHub. You may also seek help from other users using the discussion group below. Before running the program, make sure you read at least the [Home](https://github.com/f4exb/sdrangel/wiki) and [Quick Start](https://github.com/f4exb/sdrangel/wiki/Quick-start) pages.
**Discussion group**: You can ask other users for help or discuss subjects related to SDRangel and its ancillary projects [here](https://groups.io/g/sdrangel).

134
android/qt6/AndroidManifest.xml

@ -1,67 +1,67 @@ @@ -1,67 +1,67 @@
<?xml version="1.0"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.sdrangel"
android:installLocation="auto"
android:versionCode="13"
android:versionName="7.25.1.1">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true" />
<application
android:name="org.qtproject.qt.android.bindings.QtApplication"
android:hardwareAccelerated="true"
android:label="SDRangel"
android:extractNativeLibs="true"
android:requestLegacyExternalStorage="true"
android:allowBackup="true"
android:fullBackupOnly="false"
android:icon="@mipmap/ic_launcher">
<activity
android:name="org.sdrangel.SDRangelActivity"
android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density"
android:label="SDRangel"
android:launchMode="singleTop"
android:screenOrientation="unspecified"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="android.app.lib_name"
android:value="sdrangel" />
<meta-data
android:name="android.app.arguments"
android:value="" />
<meta-data
android:name="android.app.background_running"
android:value="true" />
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.qtprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/qtprovider_paths"/>
</provider>
</application>
</manifest>
<?xml version="1.0"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.sdrangel"
android:installLocation="auto"
android:versionCode="13"
android:versionName="7.25.1.1">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true" />
<application
android:name="org.qtproject.qt.android.bindings.QtApplication"
android:hardwareAccelerated="true"
android:label="SDRangel"
android:extractNativeLibs="true"
android:requestLegacyExternalStorage="true"
android:allowBackup="true"
android:fullBackupOnly="false"
android:icon="@mipmap/ic_launcher">
<activity
android:name="org.sdrangel.SDRangelActivity"
android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density"
android:label="SDRangel"
android:launchMode="singleTop"
android:screenOrientation="unspecified"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="android.app.lib_name"
android:value="sdrangel" />
<meta-data
android:name="android.app.arguments"
android:value="" />
<meta-data
android:name="android.app.background_running"
android:value="true" />
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.qtprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/qtprovider_paths"/>
</provider>
</application>
</manifest>

2
android/qt6/res/mipmap-anydpi-v26/ic_launcher.xml

@ -2,4 +2,4 @@ @@ -2,4 +2,4 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
</adaptive-icon>

52
app/crashhandler.h

@ -1,26 +1,26 @@ @@ -1,26 +1,26 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2025 Jon Beniston, M7RCE //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "loggerwithfile.h"
void installCrashHandler(qtwebapp::LoggerWithFile *logger);
#ifdef _WIN32
void logWindowsStackTrace();
#endif
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2025 Jon Beniston, M7RCE //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "loggerwithfile.h"
void installCrashHandler(qtwebapp::LoggerWithFile *logger);
#ifdef _WIN32
void logWindowsStackTrace();
#endif

25
app/main.cpp

@ -43,6 +43,7 @@ @@ -43,6 +43,7 @@
#include "util/android.h"
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
#include <QOpenGLWidget>
#include <QQuickWindow>
#endif
@ -183,6 +184,16 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo @@ -183,6 +184,16 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo
SDRangelApplication a(argc, argv);
// Give the desktop environment an exact desktop-entry ID so startup
// notification, window activation, taskbar grouping, and icons do not
// have to rely on window-title or executable-name heuristics. Snapd
// prefixes exported desktop entries with the snap instance name.
const QByteArray snapInstanceName = qgetenv("SNAP_INSTANCE_NAME");
const QString desktopFileName = snapInstanceName.isEmpty() ?
QStringLiteral("sdrangel") :
QString::fromUtf8(snapInstanceName) + QStringLiteral("_sdrangel");
QGuiApplication::setDesktopFileName(desktopFileName);
#if 1
qApp->setStyle(QStyleFactory::create("fusion"));
@ -291,6 +302,20 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo @@ -291,6 +302,20 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo
MainWindow w(logger, parser);
#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
// Qt 6.4 and later may recreate a visible top-level native window when
// its first QOpenGLWidget child is added. This can result in
// the MainWindow being reopened when the first Device is opened
// and on Linux the cursor changing to busy for a while,
// so make the main window OpenGL-composited from its
// first show and keep it that way for the lifetime of the application.
QOpenGLWidget openGLSurfaceInitializer(&w);
openGLSurfaceInitializer.setObjectName(QStringLiteral("openGLSurfaceInitializer"));
openGLSurfaceInitializer.setAttribute(Qt::WA_TransparentForMouseEvents);
openGLSurfaceInitializer.setGeometry(-1, -1, 1, 1);
openGLSurfaceInitializer.show();
#endif
w.show();
if (parser.getListDevices())

2
cmake/Modules/FindCM256cc.cmake

@ -53,4 +53,4 @@ if (NOT CM256CC_FOUND) @@ -53,4 +53,4 @@ if (NOT CM256CC_FOUND)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CM256CC DEFAULT_MSG CM256CC_LIBRARIES CM256CC_INCLUDE_DIR)
MARK_AS_ADVANCED(CM256CC_LIBRARIES CM256CC_INCLUDE_DIR)
endif (NOT CM256CC_FOUND)
endif (NOT CM256CC_FOUND)

2
cmake/Modules/FindCodec2.cmake

@ -53,4 +53,4 @@ if (NOT CODEC2_FOUND) @@ -53,4 +53,4 @@ if (NOT CODEC2_FOUND)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CODEC2 DEFAULT_MSG CODEC2_LIBRARIES CODEC2_INCLUDE_DIR)
MARK_AS_ADVANCED(CODEC2_LIBRARIES CODEC2_INCLUDE_DIR)
endif (NOT CODEC2_FOUND)
endif (NOT CODEC2_FOUND)

13
cmake/Modules/FindFAAD.cmake

@ -23,11 +23,22 @@ IF(NOT FAAD_FOUND) @@ -23,11 +23,22 @@ IF(NOT FAAD_FOUND)
/usr/lib64
)
FIND_LIBRARY(
FAAD_DRM_LIBRARY
NAMES faad_drm
HINTS ${FAAD_DIR}/lib
${PC_FAAD_LIBRARY_DIRS}
PATHS /usr/local/lib
/usr/lib
/usr/lib64
)
message(STATUS "FAAD LIBRARY " ${FAAD_LIBRARY})
message(STATUS "FAAD DRM LIBRARY " ${FAAD_DRM_LIBRARY})
message(STATUS "FAAD INCLUDE DIRS " ${FAAD_INCLUDE_DIR})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FAAD DEFAULT_MSG FAAD_LIBRARY FAAD_INCLUDE_DIR)
MARK_AS_ADVANCED(FAAD_LIBRARY FAAD_INCLUDE_DIR)
MARK_AS_ADVANCED(FAAD_LIBRARY FAAD_DRM_LIBRARY FAAD_INCLUDE_DIR)
ENDIF(NOT FAAD_FOUND)

113
cmake/Modules/FindFDKAAC.cmake

@ -0,0 +1,113 @@ @@ -0,0 +1,113 @@
if(NOT FDKAAC_FOUND)
find_package(PkgConfig QUIET)
if(PkgConfig_FOUND)
pkg_check_modules(PC_FDKAAC QUIET fdk-aac)
endif()
find_path(
FDKAAC_INCLUDE_DIR
NAMES fdk-aac/aacdecoder_lib.h aacdecoder_lib.h
HINTS ${FDKAAC_DIR}/include
${FDK_AAC_DIR}/include
${PC_FDKAAC_INCLUDE_DIRS}
PATHS /usr/local/include
/usr/include
)
find_library(
FDKAAC_LIBRARY
NAMES fdk-aac fdk_aac
HINTS ${FDKAAC_DIR}/lib
${FDK_AAC_DIR}/lib
${PC_FDKAAC_LIBRARY_DIRS}
PATHS /usr/local/lib
/usr/lib
/usr/lib64
)
if(FDKAAC_INCLUDE_DIR AND FDKAAC_LIBRARY)
include(CheckCXXSourceCompiles)
set(_FDKAAC_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES}")
set(_FDKAAC_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
set(CMAKE_REQUIRED_INCLUDES "${FDKAAC_INCLUDE_DIR}")
set(CMAKE_REQUIRED_LIBRARIES "${FDKAAC_LIBRARY}")
# Recheck when switching packages; a cached header-only success is not
# evidence that the selected library exports the decoder interface.
file(SHA256 "${FDKAAC_LIBRARY}" _FDKAAC_LIBRARY_HASH)
set(_FDKAAC_PACKAGE_KEY "${FDKAAC_INCLUDE_DIR};${FDKAAC_LIBRARY};${_FDKAAC_LIBRARY_HASH};link-v1")
if(NOT "${FDKAAC_CHECKED_PACKAGE}" STREQUAL "${_FDKAAC_PACKAGE_KEY}")
unset(FDKAAC_DRM_INTERFACE_AVAILABLE CACHE)
unset(FDKAAC_RUNTIME_LIBRARY CACHE)
endif()
check_cxx_source_compiles("
#if __has_include(<fdk-aac/aacdecoder_lib.h>)
# include <fdk-aac/aacdecoder_lib.h>
#else
# include <aacdecoder_lib.h>
#endif
#if AACDECODER_LIB_VL0 < 3
# error FDK AAC decoder is too old for the validated DRM interface
#endif
int main()
{
TRANSPORT_TYPE transport = TT_DRM;
AUDIO_OBJECT_TYPE objectType = AOT_DRM_USAC;
HANDLE_AACDECODER decoder = aacDecoder_Open(transport, 2);
UCHAR *bytes = nullptr;
UINT size = 0, valid = 0;
INT_PCM pcm[4096] = {};
AAC_DECODER_ERROR status = aacDecoder_ConfigRaw(decoder, &bytes, &size);
status = aacDecoder_Fill(decoder, &bytes, &size, &valid);
status = aacDecoder_DecodeFrame(decoder, pcm, 4096, AACDEC_CONCEAL);
CStreamInfo *info = aacDecoder_GetStreamInfo(decoder);
aacDecoder_Close(decoder);
return info && status == AAC_DEC_OK && objectType == AOT_DRM_USAC ? 0 : 1;
}
" FDKAAC_DRM_INTERFACE_AVAILABLE)
set(CMAKE_REQUIRED_INCLUDES "${_FDKAAC_REQUIRED_INCLUDES}")
set(CMAKE_REQUIRED_LIBRARIES "${_FDKAAC_REQUIRED_LIBRARIES}")
set(FDKAAC_CHECKED_PACKAGE "${_FDKAAC_PACKAGE_KEY}" CACHE INTERNAL "FDK AAC interface probe package")
unset(_FDKAAC_REQUIRED_INCLUDES)
unset(_FDKAAC_REQUIRED_LIBRARIES)
unset(_FDKAAC_LIBRARY_HASH)
unset(_FDKAAC_PACKAGE_KEY)
endif()
if(WIN32)
get_filename_component(_FDKAAC_LIBRARY_DIR "${FDKAAC_LIBRARY}" DIRECTORY)
find_file(
FDKAAC_RUNTIME_LIBRARY
NAMES fdk-aac.dll libfdk-aac.dll fdk-aac-2.dll libfdk-aac-2.dll
HINTS ${FDKAAC_DIR}/bin
${FDK_AAC_DIR}/bin
${_FDKAAC_LIBRARY_DIR}
${_FDKAAC_LIBRARY_DIR}/../bin
${PC_FDKAAC_LIBRARY_DIRS}
)
unset(_FDKAAC_LIBRARY_DIR)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
FDKAAC
DEFAULT_MSG
FDKAAC_LIBRARY
FDKAAC_INCLUDE_DIR
FDKAAC_DRM_INTERFACE_AVAILABLE
)
mark_as_advanced(
FDKAAC_LIBRARY
FDKAAC_INCLUDE_DIR
FDKAAC_RUNTIME_LIBRARY
FDKAAC_DRM_INTERFACE_AVAILABLE
)
endif()
if(FDKAAC_FOUND)
set(FDKAAC_INCLUDE_DIRS ${FDKAAC_INCLUDE_DIR})
set(FDKAAC_LIBRARIES ${FDKAAC_LIBRARY})
# Deliberately not FDK_AAC_FOUND: that spelling decides whether the FFmpeg
# external project builds its own copy, and FFmpeg finds FDK through
# pkg-config, which this DRM-only discovery does not guarantee.
endif()

2
cmake/Modules/FindFFmpeg.cmake

@ -148,4 +148,4 @@ foreach (_component ${FFmpeg_FIND_COMPONENTS}) @@ -148,4 +148,4 @@ foreach (_component ${FFmpeg_FIND_COMPONENTS})
endforeach ()
# Give a nice error message if some of the required vars are missing.
find_package_handle_standard_args(FFmpeg DEFAULT_MSG ${_FFmpeg_REQUIRED_VARS})
find_package_handle_standard_args(FFmpeg DEFAULT_MSG ${_FFmpeg_REQUIRED_VARS})

2
cmake/Modules/FindLibMbe.cmake

@ -31,4 +31,4 @@ if (NOT LIBMBE_FOUND) @@ -31,4 +31,4 @@ if (NOT LIBMBE_FOUND)
endif (LIBMBE_INCLUDE_DIR AND LIBMBE_LIBRARIES)
mark_as_advanced(LIBMBE_INCLUDE_DIR LIBMBE_LIBRARIES)
endif (NOT LIBMBE_FOUND)
endif (NOT LIBMBE_FOUND)

2
cmake/Modules/FindLibXTRX.cmake

@ -31,4 +31,4 @@ if(NOT LIBXTRX_FOUND) @@ -31,4 +31,4 @@ if(NOT LIBXTRX_FOUND)
mark_as_advanced(LIBXTRX_INCLUDE_DIRS LIBXTRX_LIBRARY)
endif(NOT LIBXTRX_FOUND)
endif(NOT LIBXTRX_FOUND)

2
cmake/Modules/FindLimeSuite.cmake

@ -31,4 +31,4 @@ if (NOT LIMESUITE_FOUND) @@ -31,4 +31,4 @@ if (NOT LIMESUITE_FOUND)
endif (LIMESUITE_INCLUDE_DIR AND LIMESUITE_LIBRARY)
mark_as_advanced(LIMESUITE_INCLUDE_DIR LIMESUITE_LIBRARY)
endif (NOT LIMESUITE_FOUND)
endif (NOT LIMESUITE_FOUND)

2
cmake/Modules/FindOpus.cmake

@ -49,4 +49,4 @@ find_package_handle_standard_args(Opus @@ -49,4 +49,4 @@ find_package_handle_standard_args(Opus
OPUS_INCLUDE_DIRS OPUS_LIBRARIES HAVE_OPUS_OPUS_H
)
mark_as_advanced(OPUS_INCLUDE_DIRS OPUS_LIBRARIES HAVE_OPUS_OPUS_H)
mark_as_advanced(OPUS_INCLUDE_DIRS OPUS_LIBRARIES HAVE_OPUS_OPUS_H)

2
cmake/Modules/FindSerialDV.cmake

@ -31,4 +31,4 @@ if (NOT LIBSERIALDV_FOUND) @@ -31,4 +31,4 @@ if (NOT LIBSERIALDV_FOUND)
endif (LIBSERIALDV_INCLUDE_DIR AND LIBSERIALDV_LIBRARY)
mark_as_advanced(LIBSERIALDV_INCLUDE_DIR LIBSERIALDV_LIBRARY)
endif (NOT LIBSERIALDV_FOUND)
endif (NOT LIBSERIALDV_FOUND)

19
cmake/cpack/CMakeLists.txt

@ -365,6 +365,25 @@ elseif(WIN32 OR MINGW) @@ -365,6 +365,25 @@ elseif(WIN32 OR MINGW)
ExecWait '$INSTDIR\\\\${VCREDIST_FILE} /passive /norestart'
Delete '$INSTDIR\\\\${VCREDIST_FILE}'
")
# The Claude Desktop extension, in a file of its own: CPack writes
# CPACK_NSIS_EXTRA_INSTALL_COMMANDS into CPackConfig.cmake without escaping it, so the
# commands themselves cannot contain a quote
if(MCPBRIDGE_BUNDLE_NAME)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/claude_extension.nsh.in"
"${CMAKE_BINARY_DIR}/claude_extension.nsh"
@ONLY
)
# NSIS !include does not take forward slashes, and CPack writes this string into
# CPackConfig.cmake raw, so each separator has to survive being read back as CMake
file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/claude_extension.nsh" MCPBRIDGE_NSH)
string(REPLACE "\\" "\\\\" MCPBRIDGE_NSH "${MCPBRIDGE_NSH}")
list(APPEND CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
!include '${MCPBRIDGE_NSH}'
")
endif()
set(CPACK_NSIS_CREATE_ICONS_EXTRA
"CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\SDRangel.lnk' '$INSTDIR\\\\sdrangel.exe'")
set(CPACK_NSIS_DELETE_ICONS_EXTRA

41
cmake/cpack/claude_extension.nsh.in

@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
; Offers the Claude Desktop extension, when Claude Desktop is installed.
;
; Claude registers no .mcpb file association, and the packaged (MSIX) build has no execution
; alias, so the only way to hand it a bundle is to run its executable with the bundle as an
; argument. Both the .exe and the MSIX build write the claude:// protocol handler to HKCU
; with a real path to that executable, which is where it is found here.
;
; Claude shows its own install dialog, with its own warning about what an extension can do,
; so this only asks whether to open it.
;
; Included from CPACK_NSIS_EXTRA_INSTALL_COMMANDS. Kept in a file of its own because CPack
; writes that variable into CPackConfig.cmake unescaped, so it cannot contain a quote.
IfFileExists "$INSTDIR\@MCPBRIDGE_BUNDLE_NAME@" 0 mcpbDone
ReadRegStr $R0 HKCU "Software\Classes\claude\shell\open\command" ""
StrCmp $R0 "" mcpbDone
; The value is "<path to the executable>" "%1". Take what the first pair of quotes holds
StrCpy $R5 $R0 1 ; the opening quote, to compare against and to quote with later
StrCpy $R1 $R0 "" 1
StrCpy $R2 0
mcpbScan:
StrCpy $R3 $R1 1 $R2
StrCmp $R3 $R5 mcpbFound
StrCmp $R3 "" mcpbDone ; no closing quote: not a shape we understand, leave it alone
IntOp $R2 $R2 + 1
Goto mcpbScan
mcpbFound:
StrCpy $R4 $R1 $R2
; The path carries the version of the Claude that wrote it, so an update that has not been
; launched since can leave it pointing at a directory that is gone
IfFileExists "$R4" 0 mcpbDone
MessageBox MB_YESNO|MB_ICONQUESTION "Install the SDRangel extension for Claude Desktop?$\r$\n$\r$\nThis lets Claude control SDRangel. Claude will ask you to confirm." IDNO mcpbDone
Exec '"$R4" "$INSTDIR\@MCPBRIDGE_BUNDLE_NAME@"'
mcpbDone:

6
cmake/cpack/deploy_mac.cmake.in

@ -11,6 +11,12 @@ execute_process (COMMAND mkdir ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/SDRangel.app @@ -11,6 +11,12 @@ execute_process (COMMAND mkdir ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/SDRangel.app
execute_process (COMMAND pwd)
execute_process (COMMAND cp sdrangel ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/SDRangel.app/Contents/MacOS/SDRangel)
# The Denoiser launches the VST3 scanner beside the app executable.
if(EXISTS "@CMAKE_BINARY_DIR@/sdrangel-vst3-scan")
file(COPY "@CMAKE_BINARY_DIR@/sdrangel-vst3-scan"
DESTINATION "${CPACK_TEMPORARY_INSTALL_DIRECTORY}/SDRangel.app/Contents/MacOS")
endif()
# Add RPATHS to libraries so macdeployqt can find out and copy all dependencies
message ("Adding RPATHs to executables and libraries")

1
cmake/cpack/sdrangel.desktop.in

@ -5,6 +5,7 @@ Comment=SDR/Analyzer frontend for Airspy, Airspy HF+, BladeRF, HackRF, LimeSDR, @@ -5,6 +5,7 @@ Comment=SDR/Analyzer frontend for Airspy, Airspy HF+, BladeRF, HackRF, LimeSDR,
Exec=@CMAKE_PROJECT_NAME@
Icon=@CMAKE_PROJECT_NAME@_icon
StartupNotify=true
StartupWMClass=SDRangel
Terminal=false
Type=Application
Categories=Network;HamRadio;

2
cmake/include/uninstall.cmake.in

@ -18,4 +18,4 @@ foreach(file ${files}) @@ -18,4 +18,4 @@ foreach(file ${files})
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)
endforeach(file)

2
debian/compat vendored

@ -1 +1 @@ @@ -1 +1 @@
10
10

1
debian/control vendored

@ -50,6 +50,7 @@ Build-Depends: debhelper (>= 9), @@ -50,6 +50,7 @@ Build-Depends: debhelper (>= 9),
libflac-dev,
libavcodec-dev,
libavformat-dev,
libavfilter-dev,
libopus-dev,
libairspy-dev,
libhackrf-dev,

11
debian/rules vendored

@ -3,6 +3,15 @@ @@ -3,6 +3,15 @@
# Override with "debuild -eQT_VERSION=6 ..." to build the Qt6 package.
QT_VERSION ?= 5
include /usr/share/dpkg/architecture.mk
ARCH_OPT :=
ifeq ($(DEB_HOST_ARCH),amd64)
ARCH_OPT := nehalem
else ifeq ($(DEB_HOST_ARCH),arm64)
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 +26,7 @@ endif @@ -17,7 +26,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)'

2
debian/source/format vendored

@ -1 +1 @@ @@ -1 +1 @@
3.0 (quilt)
3.0 (quilt)

1
devices/plutosdr/deviceplutosdrshared.cpp

@ -22,3 +22,4 @@ @@ -22,3 +22,4 @@
MESSAGE_CLASS_DEFINITION(DevicePlutoSDRShared::MsgCrossReportToBuddy, Message)
const unsigned int DevicePlutoSDRShared::m_sampleFifoMinRate = 48000;
QRecursiveMutex DevicePlutoSDRShared::m_threadsMutex;

11
devices/plutosdr/deviceplutosdrshared.h

@ -22,6 +22,8 @@ @@ -22,6 +22,8 @@
#include <stdint.h>
#include <QRecursiveMutex>
#include "util/message.h"
#include "export.h"
@ -94,6 +96,15 @@ public: @@ -94,6 +96,15 @@ public:
static const unsigned int m_sampleFifoMinRate;
/**
* Serializes every access to m_thread across all PlutoSDR device sets.
* A buddy suspends and resumes this device's sample thread through m_thread, from another
* thread and without holding this device's own mutex. Without a common lock it can restart
* a thread that stop() is in the middle of tearing down (QThread: Destroyed while thread is
* still running) or call through a pointer that has just been deleted.
*/
static QRecursiveMutex m_threadsMutex;
DevicePlutoSDRShared() :
m_deviceParams(0),
m_thread(0),

2
devices/usrp/CMakeLists.txt

@ -5,12 +5,14 @@ set(usrpdevice_SOURCES @@ -5,12 +5,14 @@ set(usrpdevice_SOURCES
deviceusrp.cpp
deviceusrpparam.cpp
deviceusrpshared.cpp
deviceusrpstreamstats.cpp
)
set(usrpdevice_HEADERS
deviceusrp.h
deviceusrpparam.h
deviceusrpshared.h
deviceusrpstreamstats.h
)
include_directories(

248
devices/usrp/deviceusrp.cpp

@ -22,9 +22,13 @@ @@ -22,9 +22,13 @@
#include <cstring>
#include <cmath>
#include <regex>
#include <algorithm>
#include <thread>
#include <uhd/types/device_addr.hpp>
#include <uhd/utils/thread.hpp>
#include "util/poweroftwo.h"
#include "deviceusrpparam.h"
#include "deviceusrp.h"
@ -54,7 +58,7 @@ void DeviceUSRP::enumOriginDevices(const QString& hardwareId, PluginInterface::O @@ -54,7 +58,7 @@ void DeviceUSRP::enumOriginDevices(const QString& hardwareId, PluginInterface::O
// Opening some devices can be a little slow, so use hardcoded number of channels,
// for known devices
static const QMap<QString, int> channelMap{{"B200", 1}, {"B205", 1}, {"B210", 2}};
static const QMap<QString, int> channelMap{{"B200", 1}, {"B205", 1}, {"B200mini", 1}, {"B205mini", 1}, {"B206mini", 1}, {"B210", 2}};
if (channelMap.contains(product))
{
originDevices.append(PluginInterface::OriginDevice(
@ -89,30 +93,244 @@ void DeviceUSRP::enumOriginDevices(const QString& hardwareId, PluginInterface::O @@ -89,30 +93,244 @@ void DeviceUSRP::enumOriginDevices(const QString& hardwareId, PluginInterface::O
}
}
void DeviceUSRP::waitForLock(uhd::usrp::multi_usrp::sptr usrp, const QString& clockSource, int channel)
void DeviceUSRP::waitForLock(uhd::usrp::multi_usrp::sptr usrp, const QString& clockSource, int channel, bool rx)
{
int tries;
const int maxTries = 100;
// Wait for Ref lock
std::vector<std::string> sensor_names;
sensor_names = usrp->get_tx_sensor_names(channel);
if (clockSource == "external")
try
{
if (std::find(sensor_names.begin(), sensor_names.end(), "ref_locked") != sensor_names.end())
// Wait for Ref lock - ref_locked is a motherboard sensor
if (clockSource != "internal")
{
std::vector<std::string> mboardSensorNames = usrp->get_mboard_sensor_names(0);
if (std::find(mboardSensorNames.begin(), mboardSensorNames.end(), "ref_locked") != mboardSensorNames.end())
{
for (tries = 0; !usrp->get_mboard_sensor("ref_locked", 0).to_bool() && (tries < maxTries); tries++)
std::this_thread::sleep_for(std::chrono::milliseconds(10));
if (tries == maxTries)
qCritical("DeviceUSRP::waitForLock: Failed to lock ref");
}
}
// Wait for LO lock
std::vector<std::string> sensorNames = rx ? usrp->get_rx_sensor_names(channel) : usrp->get_tx_sensor_names(channel);
if (std::find(sensorNames.begin(), sensorNames.end(), "lo_locked") != sensorNames.end())
{
for (tries = 0; !usrp->get_mboard_sensor("ref_locked", 0).to_bool() && (tries < maxTries); tries++)
for (tries = 0; !(rx ? usrp->get_rx_sensor("lo_locked", channel) : usrp->get_tx_sensor("lo_locked", channel)).to_bool() && (tries < maxTries); tries++)
std::this_thread::sleep_for(std::chrono::milliseconds(10));
if (tries == maxTries)
qCritical("USRPInput::acquireChannel: Failed to lock ref");
qCritical("DeviceUSRP::waitForLock: Failed to lock %s LO", rx ? "Rx" : "Tx");
}
}
catch (const std::exception& e)
{
qWarning() << "DeviceUSRP::waitForLock: exception: " << e.what();
}
}
bool DeviceUSRP::channelsShareLO(uhd::usrp::multi_usrp::sptr usrp, bool rx, int channelA, int channelB)
{
if (!usrp || (channelA < 0) || (channelB < 0)) {
return false;
}
if (channelA == channelB) {
return true;
}
try
{
// Assume channels on the same daughterboard share an LO (E.g. B210/E310 "A:A A:B", N310 "A:0 A:1"),
// whereas channels on different daughterboards do not (E.g. X310 "A:0 B:0")
if (usrp->get_num_mboards() != 1) {
return false;
}
uhd::usrp::subdev_spec_t spec = rx ? usrp->get_rx_subdev_spec(0) : usrp->get_tx_subdev_spec(0);
if (((size_t) channelA >= spec.size()) || ((size_t) channelB >= spec.size())) {
return false;
}
return spec[channelA].db_name == spec[channelB].db_name;
}
catch (const std::exception& e)
{
qWarning() << "DeviceUSRP::channelsShareLO: exception: " << e.what();
return false;
}
}
bool DeviceUSRP::getTemperature(uhd::usrp::multi_usrp::sptr usrp, bool rx, int channel, double& temperature)
{
if (!usrp) {
return false;
}
auto contains = [](const std::vector<std::string>& names, const std::string& name) {
return std::find(names.begin(), names.end(), name) != names.end();
};
try
{
// Motherboard sensor (E.g. E3xx, N3xx)
if (contains(usrp->get_mboard_sensor_names(0), "temp"))
{
temperature = usrp->get_mboard_sensor("temp", 0).to_real();
return true;
}
// Frontend sensor (E.g. B2xx, where it is the AD9361 temperature)
if ((channel >= 0) && contains(rx ? usrp->get_rx_sensor_names(channel) : usrp->get_tx_sensor_names(channel), "temp"))
{
temperature = (rx ? usrp->get_rx_sensor("temp", channel) : usrp->get_tx_sensor("temp", channel)).to_real();
return true;
}
// Frontend sensor in other direction (E.g. B2xx only has temperature sensor on Rx frontend)
if ((rx ? usrp->get_tx_num_channels() : usrp->get_rx_num_channels()) > 0)
{
if (contains(rx ? usrp->get_tx_sensor_names(0) : usrp->get_rx_sensor_names(0), "temp"))
{
temperature = (rx ? usrp->get_tx_sensor("temp", 0) : usrp->get_rx_sensor("temp", 0)).to_real();
return true;
}
}
}
// Wait for LO lock
if (std::find(sensor_names.begin(), sensor_names.end(), "lo_locked") != sensor_names.end())
catch (const std::exception& e)
{
for (tries = 0; !usrp->get_tx_sensor("lo_locked", channel).to_bool() && (tries < maxTries); tries++)
std::this_thread::sleep_for(std::chrono::milliseconds(10));
if (tries == maxTries)
qCritical("USRPInput::acquireChannel: Failed to lock LO");
qDebug() << "DeviceUSRP::getTemperature: exception: " << e.what();
}
return false;
}
// Read about 1ms of samples per recv() call, as reading a single packet (E.g. ~1000 samples)
// per call results in a high per call overhead at high sample rates (E.g. FIFO locking and signalling).
// Must be at least the maximum number of samples in a packet and a power of two (for the decimators, see #1161).
// Upper limit avoids too large a latency if the sample rate is reduced while running.
size_t DeviceUSRP::getRecvBufferSamples(size_t maxNumSamps, int sampleRate)
{
const size_t maxSamples = 16384;
size_t minSamples = isPowerOfTwo(maxNumSamps) ? maxNumSamps : lowerPowerOfTwo(maxNumSamps);
size_t samples = sampleRate > 0 ? lowerPowerOfTwo((uint32_t) (sampleRate / 1000)) : minSamples;
samples = std::min(samples, maxSamples);
samples = std::max(samples, minSamples);
return samples;
}
// Set priority of streaming thread higher than normal, so it isn't delayed by other threads (E.g. GUI or DSP),
// which can cause overflows / underflows, as UHD only buffers a few ms of samples by default
void DeviceUSRP::setStreamingThreadPriority()
{
if (!uhd::set_thread_priority_safe()) {
qDebug("DeviceUSRP::setStreamingThreadPriority: Failed to set thread priority");
}
}
// When UHD chooses the master clock rate automatically (B2xx), each time a channel's sample rate is set,
// it chooses one that's a multiple of the LCM of the sample rates of all channels (Rx and Tx), including
// those that haven't been changed yet. So when changing the sample rate of all channels, if no supported
// clock rate is a multiple of both the old and new rates (E.g. 8 and 9 MS/s), the clock rate is left unchanged,
// and the sample rate is coerced to what can be achieved with it (E.g. 8 MS/s).
// To avoid this, set the master clock rate for the new sample rate first, using the same rules as UHD.
bool DeviceUSRP::setMasterClockRateForSampleRate(uhd::usrp::multi_usrp::sptr usrp, double sampleRate, size_t nbChannels)
{
const std::string autoTickRatePath = "/mboards/0/auto_tick_rate";
uhd::property_tree::sptr properties = usrp->get_device()->get_tree();
if (!properties->exists(autoTickRatePath) || !properties->access<bool>(autoTickRatePath).get()) {
return false; // Master clock rate set manually
}
uhd::meta_range_t clockRange = usrp->get_master_clock_rate_range();
const double minClockRate = clockRange.start();
const double maxClockRate = clockRange.stop() / std::max(nbChannels, (size_t) 1);
if ((sampleRate <= 0.0) || (sampleRate > maxClockRate)) {
return false; // Let UHD report the error when the sample rate is set
}
// Highest power of 2 multiple of the sample rate that doesn't exceed the max clock rate (See ad936x_manager::get_auto_tick_rate)
int multiplier = 1 << (int) std::log2(maxClockRate / sampleRate);
if ((multiplier == 2) && (sampleRate >= minClockRate)) {
multiplier = 1;
}
const double clockRate = sampleRate * multiplier;
// Disable automatic selection while sample rates are set, even if the clock rate is already correct,
// as otherwise it could be changed when the first channel is set
properties->access<bool>(autoTickRatePath).set(false);
try
{
if (std::abs(usrp->get_master_clock_rate() - clockRate) >= 1.0)
{
qDebug("DeviceUSRP::setMasterClockRateForSampleRate: setting master clock rate to %f for sample rate %f", clockRate, sampleRate);
usrp->set_master_clock_rate(clockRate);
}
}
catch (...)
{
// Otherwise automatic selection would be left disabled, and as this function then sees it as manual,
// it would never be re-enabled
properties->access<bool>(autoTickRatePath).set(true);
throw;
}
return true;
}
void DeviceUSRP::enableAutoMasterClockRate(uhd::usrp::multi_usrp::sptr usrp)
{
usrp->get_device()->get_tree()->access<bool>("/mboards/0/auto_tick_rate").set(true);
}
void DeviceUSRP::setSampleRate(uhd::usrp::multi_usrp::sptr usrp, bool rx, int channel, double sampleRate)
{
auto set = [&]() {
if (rx) {
usrp->set_rx_rate(sampleRate, channel);
} else {
usrp->set_tx_rate(sampleRate, channel);
}
};
// Let UHD try first, as it may find a master clock rate that suits both this and other channels' rates
set();
double actualRate = rx ? usrp->get_rx_rate(channel) : usrp->get_tx_rate(channel);
// Single channel streams, so 1 channel for clock rate limit, as UHD uses
if ((std::abs(actualRate - sampleRate) >= 1.0) && setMasterClockRateForSampleRate(usrp, sampleRate, 1))
{
qDebug("DeviceUSRP::setSampleRate: %s channel %d: rate coerced to %f - setting master clock rate for %f",
rx ? "Rx" : "Tx", channel, actualRate, sampleRate);
try
{
set();
}
catch (...)
{
enableAutoMasterClockRate(usrp);
throw;
}
enableAutoMasterClockRate(usrp);
}
}
// When the master clock rate changes, UHD (B2xx) reprograms each channel's DSP for its previously set rate,
// which may be coerced to a different rate, but get_rx/tx_rate() still return the previous rate.
// So find the rate the DSP is actually using, which is the nearest rate achievable with the current clock rate.
double DeviceUSRP::getSampleRate(uhd::usrp::multi_usrp::sptr usrp, bool rx, int channel)
{
if (rx) {
return usrp->get_rx_rates(channel).clip(usrp->get_rx_rate(channel), true);
} else {
return usrp->get_tx_rates(channel).clip(usrp->get_tx_rate(channel), true);
}
}

35
devices/usrp/deviceusrp.h

@ -36,7 +36,40 @@ public: @@ -36,7 +36,40 @@ public:
static void enumOriginDevices(const QString& hardwareId, PluginInterface::OriginDevices& originDevices);
/** Wait for ref clock and LO to lock */
static void waitForLock(uhd::usrp::multi_usrp::sptr usrp, const QString& clockSource, int channel);
static void waitForLock(uhd::usrp::multi_usrp::sptr usrp, const QString& clockSource, int channel, bool rx);
/** Determine whether two Rx or two Tx channels share the same LO (and sample rate) */
static bool channelsShareLO(uhd::usrp::multi_usrp::sptr usrp, bool rx, int channelA, int channelB);
/** Get board temperature in degrees C. Returns false if the device doesn't have a temperature sensor */
static bool getTemperature(uhd::usrp::multi_usrp::sptr usrp, bool rx, int channel, double& temperature);
/** Get number of samples to read per recv() call, which is a power of two, as required by decimators */
static size_t getRecvBufferSamples(size_t maxNumSamps, int sampleRate);
/** Set priority of calling thread, so it can stream samples without overflowing / underflowing */
static void setStreamingThreadPriority();
/**
* Call before setting all channels to the same sample rate, on devices where UHD chooses the master clock rate automatically (B2xx).
* Sets a master clock rate suitable for the new sample rate and disables automatic selection.
* Returns true if automatic selection should be re-enabled with enableAutoMasterClockRate() once the sample rates have been set.
*/
static bool setMasterClockRateForSampleRate(uhd::usrp::multi_usrp::sptr usrp, double sampleRate, size_t nbChannels);
static void enableAutoMasterClockRate(uhd::usrp::multi_usrp::sptr usrp);
/**
* Set sample rate of a single channel. If it can't be achieved with a master clock rate UHD chooses automatically
* to also suit other channels' rates (E.g. a buddy's), the master clock rate is set for the requested rate,
* and other channels' rates are coerced, so need to be read back.
*/
static void setSampleRate(uhd::usrp::multi_usrp::sptr usrp, bool rx, int channel, double sampleRate);
/** Get actual sample rate of a channel, which may have been changed by the master clock rate being changed for another channel */
static double getSampleRate(uhd::usrp::multi_usrp::sptr usrp, bool rx, int channel);
/** Timeout for recv() and send(), in seconds */
static constexpr double m_streamTimeout = 0.5;
};
#endif /* DEVICES_USRP_DEVICEUSRP_H_ */

90
devices/usrp/deviceusrpparam.cpp

@ -16,6 +16,8 @@ @@ -16,6 +16,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include <functional>
#include <QDebug>
#include "deviceusrpparam.h"
@ -27,6 +29,13 @@ bool DeviceUSRPParams::open(const QString &deviceStr, bool channelNumOnly) @@ -27,6 +29,13 @@ bool DeviceUSRPParams::open(const QString &deviceStr, bool channelNumOnly)
{
std::string device_args(qPrintable(deviceStr));
// UHD's default receive buffering for USB devices (B2xx) is only a few ms at high sample rates,
// which isn't enough to absorb OS scheduling latency (particularly on Windows), resulting in overflows.
// So increase it (to ~2MB), unless specified by the user.
if (deviceStr.contains("type=b200") && !deviceStr.contains("num_recv_frames")) {
device_args += ",num_recv_frames=256";
}
// For USB
// The recv_frame_size must be a multiple of 8 bytes and not a multiple of 1024 bytes.
// recv_frame_size max is 16360.
@ -39,11 +48,38 @@ bool DeviceUSRPParams::open(const QString &deviceStr, bool channelNumOnly) @@ -39,11 +48,38 @@ bool DeviceUSRPParams::open(const QString &deviceStr, bool channelNumOnly)
m_nbTxChannels = m_dev->get_tx_num_channels();
qDebug() << "DeviceUSRPParams::open: m_nbRxChannels: " << m_nbRxChannels << " m_nbTxChannels: " << m_nbTxChannels;
// Speed up program initialisation, by not getting all properties
// If we could find out number of channels without ::make ing the device
// that would be even better
if (!channelNumOnly)
{
// On B2xx, Rx streams share a transport, so recv() calls for different streams must be serialised
// (See DeviceUSRPRecvLock). Other devices have a transport per stream, so don't need this.
QString mboardName = QString::fromStdString(m_dev->get_mboard_name());
m_recvLock.setEnabled(mboardName.startsWith("B2"));
qDebug() << "DeviceUSRPParams::open: mboard: " << mboardName;
}
catch (const std::exception& e)
{
qDebug() << "DeviceUSRPParams::open: exception: " << e.what();
close();
return false;
}
// Speed up program initialisation, by not getting all properties
// If we could find out number of channels without ::make ing the device
// that would be even better
if (!channelNumOnly)
{
// Not all properties are supported by all devices / daughterboards, so
// query each group separately, so one failure doesn't prevent use of the device
auto tryQuery = [](const char *what, const std::function<void()>& query) {
try
{
query();
}
catch (const std::exception& e)
{
qWarning() << "DeviceUSRPParams::open: failed to get" << what << ":" << e.what();
}
};
tryQuery("frequency and bandwidth ranges", [this]() {
if (m_nbRxChannels > 0)
{
m_lpfRangeRx = m_dev->get_rx_bandwidth_range();
@ -54,7 +90,9 @@ bool DeviceUSRPParams::open(const QString &deviceStr, bool channelNumOnly) @@ -54,7 +90,9 @@ bool DeviceUSRPParams::open(const QString &deviceStr, bool channelNumOnly)
m_lpfRangeTx = m_dev->get_tx_bandwidth_range();
m_loRangeTx = m_dev->get_fe_tx_freq_range();
}
});
tryQuery("sample rate ranges", [this, &deviceStr]() {
// For some devices (B210), rx/tx_rates vary with master_clock_rate
// which can be set automatically by UHD. For other devices,
// master_clock_rate must be set manually (currently as a device arg)
@ -62,7 +100,11 @@ bool DeviceUSRPParams::open(const QString &deviceStr, bool channelNumOnly) @@ -62,7 +100,11 @@ bool DeviceUSRPParams::open(const QString &deviceStr, bool channelNumOnly)
// tx/rx_rate is rate between PC and FPGA
uhd::meta_range_t clockRange = m_dev->get_master_clock_rate_range();
uhd::property_tree::sptr properties = m_dev->get_device()->get_tree();
if ((clockRange.start() == clockRange.stop()) || !properties->exists("/mboards/0/auto_tick_rate"))
const std::string autoTickRatePath = "/mboards/0/auto_tick_rate";
// If master_clock_rate was specified in the device args, it is fixed, so don't change it
if ((clockRange.start() == clockRange.stop())
|| !properties->exists(autoTickRatePath)
|| !properties->access<bool>(autoTickRatePath).get())
{
if (m_nbRxChannels > 0) {
m_srRangeRx = m_dev->get_rx_rates();
@ -79,6 +121,19 @@ bool DeviceUSRPParams::open(const QString &deviceStr, bool channelNumOnly) @@ -79,6 +121,19 @@ bool DeviceUSRPParams::open(const QString &deviceStr, bool channelNumOnly)
}
else
{
// Setting the master clock rate disables automatic selection, so restore it afterwards,
// even if an exception is thrown, otherwise the clock rate would be stuck
struct RestoreAutoTickRate {
uhd::property_tree::sptr m_properties;
std::string m_path;
~RestoreAutoTickRate() {
try {
m_properties->access<bool>(m_path).set(true);
} catch (...) {
}
}
} restoreAutoTickRate{properties, autoTickRatePath};
// Find max and min sample rate, for max and min master clock rates
m_dev->set_master_clock_rate(clockRange.start());
uhd::meta_range_t rxLow;
@ -105,13 +160,10 @@ bool DeviceUSRPParams::open(const QString &deviceStr, bool channelNumOnly) @@ -105,13 +160,10 @@ bool DeviceUSRPParams::open(const QString &deviceStr, bool channelNumOnly)
txHigh = m_dev->get_tx_rates();
m_srRangeTx = uhd::meta_range_t(std::min(txLow.start(), txHigh.start()), std::max(txLow.stop(), txHigh.stop()));
}
// Need to restore automatic clock rate
if (properties->exists("/mboards/0/auto_tick_rate")) {
properties->access<bool>("/mboards/0/auto_tick_rate").set(true);
}
}
});
tryQuery("Rx gains and antennas", [this]() {
if (m_nbRxChannels > 0)
{
m_gainRangeRx = m_dev->get_rx_gain_range();
@ -128,6 +180,9 @@ bool DeviceUSRPParams::open(const QString &deviceStr, bool channelNumOnly) @@ -128,6 +180,9 @@ bool DeviceUSRPParams::open(const QString &deviceStr, bool channelNumOnly)
m_rxGainNames << QString::fromStdString(rxGainNames[i]);
}
}
});
tryQuery("Tx gains and antennas", [this]() {
if (m_nbTxChannels > 0)
{
m_gainRangeTx = m_dev->get_tx_gain_range();
@ -138,21 +193,18 @@ bool DeviceUSRPParams::open(const QString &deviceStr, bool channelNumOnly) @@ -138,21 +193,18 @@ bool DeviceUSRPParams::open(const QString &deviceStr, bool channelNumOnly)
m_txAntennas << QString::fromStdString(txAntennas[i]);
}
}
});
tryQuery("clock sources", [this]() {
std::vector<std::string> clockSources = m_dev->get_clock_sources(0);
m_clockSources.reserve(clockSources.size());
for(size_t i = 0, l = clockSources.size(); i < l; ++i) {
m_clockSources << QString::fromStdString(clockSources[i]);
}
}
return true;
}
catch (const std::exception& e)
{
qDebug() << "DeviceUSRPParams::open: exception: " << e.what();
return false;
});
}
return true;
}
void DeviceUSRPParams::close()

60
devices/usrp/deviceusrpparam.h

@ -20,6 +20,9 @@ @@ -20,6 +20,9 @@
#define DEVICES_USRP_DEVICEUSRPPARAM_H_
#include <QStringList>
#include <QRecursiveMutex>
#include <QMutex>
#include <QWaitCondition>
#include <uhd/usrp/multi_usrp.hpp>
#include <uhd/exception.hpp>
@ -27,6 +30,61 @@ @@ -27,6 +30,61 @@
#include "export.h"
/**
* Fair (first come, first served) lock, used to serialise calls to rx_streamer::recv() for
* different streams on the same device, on devices where that is required.
*
* On B2xx, all Rx streams share one transport, with packets being routed to each stream by UHD's
* recv_packet_demuxer_3000. This reads from the transport without holding its mutex, so if
* recv() is called concurrently for two streams, packets can be delivered out of order
* (Seen as 'D' in the console, and reported as an overflow, although no samples are lost).
*
* The lock needs to be fair, so one thread can't starve the other, as packets for a starved
* stream are queued by the demuxer, eventually exhausting the transport's receive frames.
*/
class DeviceUSRPRecvLock
{
public:
DeviceUSRPRecvLock() :
m_enabled(false),
m_nextTicket(0),
m_servingTicket(0)
{
}
void setEnabled(bool enabled) { m_enabled = enabled; }
void lock()
{
if (m_enabled)
{
QMutexLocker locker(&m_mutex);
quint64 ticket = m_nextTicket++;
while (ticket != m_servingTicket) {
m_waitCondition.wait(&m_mutex);
}
}
}
void unlock()
{
if (m_enabled)
{
QMutexLocker locker(&m_mutex);
m_servingTicket++;
m_waitCondition.wakeAll();
}
}
private:
bool m_enabled; //!< Only set when device is opened, before any streams are created
QMutex m_mutex;
QWaitCondition m_waitCondition;
quint64 m_nextTicket;
quint64 m_servingTicket;
};
/**
* This structure refers to one physical device shared among parties (logical devices represented by
* the DeviceAPI with single Rx or Tx stream type).
@ -51,6 +109,8 @@ struct DEVICES_API DeviceUSRPParams @@ -51,6 +109,8 @@ struct DEVICES_API DeviceUSRPParams
QStringList m_rxAntennas; //!< List of Rx antenna names
QStringList m_rxGainNames; //!< List of Rx gain stages - Currently this seems limited to "PGA"
QStringList m_clockSources; //!< List of clock sources E.g. "internal", "external", "gpsdo"
QRecursiveMutex m_mutex; //!< Serialises configuration of the device from the device engine threads of different buddies
DeviceUSRPRecvLock m_recvLock; //!< Serialises rx_streamer::recv() calls for streams of different buddies, where required
DeviceUSRPParams() :
m_dev(),

4
devices/usrp/deviceusrpshared.cpp

@ -21,5 +21,9 @@ @@ -21,5 +21,9 @@
MESSAGE_CLASS_DEFINITION(DeviceUSRPShared::MsgReportBuddyChange, Message)
MESSAGE_CLASS_DEFINITION(DeviceUSRPShared::MsgReportClockSourceChange, Message)
MESSAGE_CLASS_DEFINITION(DeviceUSRPShared::MsgReportDeviceSettings, Message)
MESSAGE_CLASS_DEFINITION(DeviceUSRPShared::MsgReadDeviceSampleRate, Message)
MESSAGE_CLASS_DEFINITION(DeviceUSRPShared::MsgReportDeviceInfo, Message)
MESSAGE_CLASS_DEFINITION(DeviceUSRPShared::MsgResizeSampleFifo, Message)
const unsigned int DeviceUSRPShared::m_sampleFifoMinRate = 48000;

133
devices/usrp/deviceusrpshared.h

@ -41,20 +41,23 @@ public: @@ -41,20 +41,23 @@ public:
int getLOOffset() const { return m_loOffset; }
int getMasterClockRate() const { return m_masterClockRate; }
bool getRxElseTx() const { return m_rxElseTx; }
int getChannel() const { return m_channel; }
static MsgReportBuddyChange* create(
int devSampleRate,
uint64_t centerFrequency,
int loOffset,
int masterClockRate,
bool rxElseTx)
bool rxElseTx,
int channel = -1)
{
return new MsgReportBuddyChange(
devSampleRate,
centerFrequency,
loOffset,
masterClockRate,
rxElseTx);
rxElseTx,
channel);
}
private:
@ -63,19 +66,22 @@ public: @@ -63,19 +66,22 @@ public:
int m_loOffset; //!< LO offset
int m_masterClockRate; //!< FPGA/RFIC sample rate
bool m_rxElseTx; //!< tells which side initiated the message
int m_channel; //!< channel of the buddy that initiated the message (-1 if unknown)
MsgReportBuddyChange(
int devSampleRate,
uint64_t centerFrequency,
int loOffset,
int masterClockRate,
bool rxElseTx) :
bool rxElseTx,
int channel) :
Message(),
m_devSampleRate(devSampleRate),
m_centerFrequency(centerFrequency),
m_loOffset(loOffset),
m_masterClockRate(masterClockRate),
m_rxElseTx(rxElseTx)
m_rxElseTx(rxElseTx),
m_channel(channel)
{ }
};
@ -101,6 +107,125 @@ public: @@ -101,6 +107,125 @@ public:
};
/**
* Actual device settings, read back in the device engine thread after settings have been applied
* (or after a buddy has changed a shared setting such as the master clock rate)
*/
class DEVICES_API MsgReportDeviceSettings : public Message {
MESSAGE_CLASS_DECLARATION
public:
bool getSampleRateValid() const { return m_sampleRateValid; }
double getSampleRate() const { return m_sampleRate; }
double getMasterClockRate() const { return m_masterClockRate; }
bool getClockSourceValid() const { return m_clockSourceValid; }
const QString& getClockSource() const { return m_clockSource; }
bool getForwardToBuddies() const { return m_forwardToBuddies; }
static MsgReportDeviceSettings* create(
bool sampleRateValid,
double sampleRate,
double masterClockRate,
bool clockSourceValid,
const QString& clockSource,
bool forwardToBuddies)
{
return new MsgReportDeviceSettings(
sampleRateValid,
sampleRate,
masterClockRate,
clockSourceValid,
clockSource,
forwardToBuddies);
}
private:
bool m_sampleRateValid; //!< m_sampleRate and m_masterClockRate are valid
double m_sampleRate; //!< Actual device/host sample rate
double m_masterClockRate; //!< Actual FPGA/RFIC sample rate
bool m_clockSourceValid; //!< m_clockSource is valid
QString m_clockSource; //!< Actual clock source
bool m_forwardToBuddies; //!< Result of our own settings change, so buddies need to be informed
MsgReportDeviceSettings(
bool sampleRateValid,
double sampleRate,
double masterClockRate,
bool clockSourceValid,
const QString& clockSource,
bool forwardToBuddies) :
Message(),
m_sampleRateValid(sampleRateValid),
m_sampleRate(sampleRate),
m_masterClockRate(masterClockRate),
m_clockSourceValid(clockSourceValid),
m_clockSource(clockSource),
m_forwardToBuddies(forwardToBuddies)
{ }
};
/** Request for the device engine thread to read back the actual sample rate (E.g. after a buddy has changed the master clock rate) */
class DEVICES_API MsgReadDeviceSampleRate : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgReadDeviceSampleRate* create() {
return new MsgReadDeviceSampleRate();
}
private:
MsgReadDeviceSampleRate() :
Message()
{ }
};
/**
* Request for the device engine thread to resize the Tx sample FIFO.
* This needs to be done in the device engine thread, as that's where samples are written to the FIFO,
* with the Tx streaming thread paused, as that's where they are read.
*/
class DEVICES_API MsgResizeSampleFifo : public Message {
MESSAGE_CLASS_DECLARATION
public:
unsigned int getSize() const { return m_size; }
static MsgResizeSampleFifo* create(unsigned int size) {
return new MsgResizeSampleFifo(size);
}
private:
unsigned int m_size;
MsgResizeSampleFifo(unsigned int size) :
Message(),
m_size(size)
{ }
};
/** Device information (E.g. temperature), sent to the GUIs of all buddies */
class DEVICES_API MsgReportDeviceInfo : public Message {
MESSAGE_CLASS_DECLARATION
public:
bool getTemperatureValid() const { return m_temperatureValid; }
float getTemperature() const { return m_temperature; }
static MsgReportDeviceInfo* create(bool temperatureValid, float temperature) {
return new MsgReportDeviceInfo(temperatureValid, temperature);
}
private:
bool m_temperatureValid; //!< False if device doesn't have a temperature sensor
float m_temperature; //!< Board temperature in degrees C
MsgReportDeviceInfo(bool temperatureValid, float temperature) :
Message(),
m_temperatureValid(temperatureValid),
m_temperature(temperature)
{ }
};
class DEVICES_API ThreadInterface
{
public:

115
devices/usrp/deviceusrpstreamstats.cpp

@ -0,0 +1,115 @@ @@ -0,0 +1,115 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2026 Jon Beniston, M7RCE <jon@beniston.com> //
// 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 <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include <QStringList>
#include "deviceusrpstreamstats.h"
DeviceUSRPStreamStats::DeviceUSRPStreamStats() :
m_running(false),
m_started(false),
m_lastCount(0),
m_offset(0),
m_runTimeMs(0)
{
}
void DeviceUSRPStreamStats::update(bool running, quint32 count)
{
if (running && !m_running)
{
// Stream started - reset statistics
m_started = true;
m_lastCount = 0;
m_offset = 0;
m_runTimer.start();
m_runTimeMs = 0;
m_lastEventTime = QDateTime();
m_history.clear();
}
else if (!running && m_running)
{
// Stream stopped - keep statistics from last run
m_runTimeMs = m_runTimer.elapsed();
}
m_running = running;
if (!running) {
return;
}
if (count < m_lastCount)
{
// Streaming thread was restarted, which resets its count
m_offset += m_lastCount;
if (count > 0) { // Events since restart
m_lastEventTime = QDateTime::currentDateTime();
}
}
else if (count > m_lastCount)
{
m_lastEventTime = QDateTime::currentDateTime();
}
m_lastCount = count;
// Keep history for last minute, so we can count recent events
qint64 now = m_runTimer.elapsed();
m_history.push_back({now, getCount()});
while ((m_history.size() > 1) && (now - m_history.front().first > m_historyMs)) {
m_history.pop_front();
}
}
QString DeviceUSRPStreamStats::getToolTip(const QString& description, const QString& eventName) const
{
QStringList lines;
lines.append(description);
if (!m_started) {
return lines.join("\n");
}
quint64 count = getCount();
qint64 runTimeMs = m_running ? m_runTimer.elapsed() : m_runTimeMs;
lines.append("");
lines.append(QString("%1%2: %3").arg(eventName).arg(m_running ? "" : " (last run)").arg(count));
if (runTimeMs >= 1000)
{
double perMinute = count / (runTimeMs / 60000.0);
lines.append(QString("Average: %1 per minute").arg(QString::number(perMinute, 'f', 1)));
}
if (m_running && !m_history.empty()) {
lines.append(QString("Last minute: %1").arg(count - m_history.front().second));
}
if (m_lastEventTime.isValid())
{
qint64 secsAgo = m_lastEventTime.secsTo(QDateTime::currentDateTime());
lines.append(QString("Last: %1 (%2 s ago)").arg(m_lastEventTime.toString("hh:mm:ss")).arg(secsAgo));
}
return lines.join("\n");
}

64
devices/usrp/deviceusrpstreamstats.h

@ -0,0 +1,64 @@ @@ -0,0 +1,64 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2026 Jon Beniston, M7RCE <jon@beniston.com> //
// 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 <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef DEVICES_USRP_DEVICEUSRPSTREAMSTATS_H_
#define DEVICES_USRP_DEVICEUSRPSTREAMSTATS_H_
#include <deque>
#include <utility>
#include <QString>
#include <QDateTime>
#include <QElapsedTimer>
#include "export.h"
/**
* Statistics for stream events (E.g. overruns, underruns, timeouts or dropped packets),
* calculated from the event counts that are periodically reported by the streaming threads.
*
* The streaming threads reset their counts whenever they are restarted, which can happen
* while the stream is running (E.g. when paused while a buddy creates its stream),
* so counts are accumulated, and only reset when the stream is started.
*/
class DEVICES_API DeviceUSRPStreamStats
{
public:
DeviceUSRPStreamStats();
//! Update with latest report. count is the event count reported by the streaming thread.
void update(bool running, quint32 count);
//! Total number of events since the stream was started
quint64 getCount() const { return m_offset + m_lastCount; }
//! Get tooltip, with statistics appended to description. eventName is plural (E.g. "Overruns")
QString getToolTip(const QString& description, const QString& eventName) const;
private:
bool m_running;
bool m_started; //!< Stream has been started at least once
quint32 m_lastCount; //!< Last count reported by streaming thread
quint64 m_offset; //!< Accumulated count from before the streaming thread's count was reset
QElapsedTimer m_runTimer; //!< Time since stream was started
qint64 m_runTimeMs; //!< Run time when stopped
QDateTime m_lastEventTime;
std::deque<std::pair<qint64, quint64>> m_history; //!< (run time ms, total count) for last minute
static const qint64 m_historyMs = 60000;
};
#endif // DEVICES_USRP_DEVICEUSRPSTREAMSTATS_H_

BIN
doc/img/BFMMmod_audio_tab.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
doc/img/BFMMmod_morse_tab.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
doc/img/BFMMmod_plugin.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
doc/img/BFMMmod_rds_tab.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
doc/img/DRMDemod_journaline.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
doc/img/DRMDemod_messages.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
doc/img/DRMDemod_plugin.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
doc/img/DRMDemod_slideshow.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

BIN
doc/img/DRMDemod_status.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
doc/img/DRMDemod_website.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

BIN
doc/img/DSCDemod_plugin.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 19 KiB

BIN
doc/img/DVBDemod_charts.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

BIN
doc/img/DVBDemod_dialog_epg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

BIN
doc/img/DVBDemod_dvbs.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
doc/img/DVBDemod_dvbt.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
doc/img/DVBDemod_history.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

BIN
doc/img/DVBDemod_nowandnext.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

BIN
doc/img/DVBDemod_onscreen_epg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 KiB

BIN
doc/img/DVBDemod_plugin.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 742 KiB

BIN
doc/img/DVBDemod_table.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
doc/img/DVBDemod_video.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
doc/img/DroneIDDemod_plugin.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
doc/img/DroneIDDemod_table.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
doc/img/MCPServer_plugin.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

BIN
doc/img/PSK31Demod_plugin.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
doc/img/PagerDemod_plugin.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 29 KiB

BIN
doc/img/SELCALDemod_audio_spectrum.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
doc/img/SELCALDemod_audio_tones.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
doc/img/SELCALDemod_calls.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
doc/img/SELCALDemod_plugin.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
doc/img/WefaxDemod_plugin.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 KiB

2
doc/model/SDRAngel.mdj

@ -32722,4 +32722,4 @@ @@ -32722,4 +32722,4 @@
"visibility": "public"
}
]
}
}

24
exports/export.h

@ -167,6 +167,30 @@ @@ -167,6 +167,30 @@
# define MODEMMESHTASTIC_API
#endif
/* the 'MODEMDRM_API' controls the import/export of 'modemdrm' symbols
*/
#if !defined(sdrangel_STATIC)
# ifdef modemdrm_EXPORTS
# define MODEMDRM_API __SDR_EXPORT
# else
# define MODEMDRM_API __SDR_IMPORT
# endif
#else
# define MODEMDRM_API
#endif
/* the 'MODEMDVB_API' controls the import/export of 'modemdvb' symbols
*/
#if !defined(sdrangel_STATIC)
# ifdef modemdvb_EXPORTS
# define MODEMDVB_API __SDR_EXPORT
# else
# define MODEMDVB_API __SDR_IMPORT
# endif
#else
# define MODEMDVB_API
#endif
/* the 'MODEMMESHCORE_API' controls the import/export of 'modemmeshcore' symbols
*/
#if !defined(sdrangel_STATIC)

148
external/CMakeLists.txt vendored

@ -27,7 +27,7 @@ set(MIRISDR_TAG "v2.0.0") @@ -27,7 +27,7 @@ set(MIRISDR_TAG "v2.0.0")
set(LIBSIGMF_TAG "new-namespaces")
set(PTHREADS4W_TAG "Version-2-11-0-release")
set(RTLSDR_TAG "v2.0.1")
set(RTLSDR_TAG "v2.0.3")
set(RTLSDR_UDEV OFF)
set(SOAPYSDR_TAG "1667b4e6301d7ad47b340dcdcd6e9969bf57d843")
set(SOAPYSDR_SDRPLAY_TAG "soapy-sdrplay-0.2.0")
@ -39,6 +39,7 @@ set(LIBXML2_TAG "v2.10.4") @@ -39,6 +39,7 @@ set(LIBXML2_TAG "v2.10.4")
set(UHD_TAG "v4.9.0.1")
set(BOOST_TAG "1.86.0")
set(BOOST_TAG2 "1_86_0")
set(FDKAAC_TAG "v2.0.3")
# For some external project macros
include(ExternalProject)
@ -110,21 +111,21 @@ if (LINUX) @@ -110,21 +111,21 @@ if (LINUX)
macro(makeLink src dest target)
if (NOT EXISTS ${dest})
add_custom_command(TARGET ${target} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink ${src} ${dest} DEPENDS ${dest} COMMENT "mklink ${src} -> ${dest}")
COMMAND ${CMAKE_COMMAND} -E create_symlink ${src} ${dest} COMMENT "mklink ${src} -> ${dest}")
endif ()
endmacro()
# macro that copy folder
macro(makeCopy src dest target)
if (NOT EXISTS ${dest})
add_custom_command(TARGET ${target} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${src} ${dest} DEPENDS ${dest} COMMENT "copy ${src} -> ${dest}")
COMMAND ${CMAKE_COMMAND} -E copy_directory ${src} ${dest} COMMENT "copy ${src} -> ${dest}")
endif ()
endmacro()
# macro that copy file
macro(makeCopyFile src dest target)
if (NOT EXISTS ${dest})
add_custom_command(TARGET ${target} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dest} DEPENDS ${dest} COMMENT "copy ${src} -> ${dest}")
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dest} COMMENT "copy ${src} -> ${dest}")
endif ()
endmacro()
else ()
@ -132,7 +133,7 @@ else () @@ -132,7 +133,7 @@ else ()
macro(makeLink src dest target)
if (NOT EXISTS ${dest})
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink ${src} ${dest} DEPENDS ${dest} COMMENT "mklink ${src} -> ${dest}")
COMMAND ${CMAKE_COMMAND} -E create_symlink ${src} ${dest} COMMENT "mklink ${src} -> ${dest}")
endif ()
endmacro()
@ -140,7 +141,7 @@ else () @@ -140,7 +141,7 @@ else ()
macro(makeCopyDir src dest target)
if (NOT EXISTS ${dest})
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${src} ${dest} DEPENDS ${dest} COMMENT "copy ${src} -> ${dest}")
COMMAND ${CMAKE_COMMAND} -E copy_directory ${src} ${dest} COMMENT "copy ${src} -> ${dest}")
endif ()
endmacro()
@ -148,11 +149,24 @@ else () @@ -148,11 +149,24 @@ else ()
macro(makeCopy src dest target)
if (NOT EXISTS ${dest})
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dest} DEPENDS ${dest} COMMENT "copy ${src} -> ${dest}")
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dest} COMMENT "copy ${src} -> ${dest}")
endif ()
endmacro()
endif (LINUX)
set(COPY_HEADERS_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/copy_headers.cmake")
# macro that mirrors the headers of a directory into another one, for the libraries whose sources
# include them by a subdirectory name that is not in the library's own tree. Unlike makeCopyDir this
# is safe when the destination is inside the source, and it runs on every build rather than only
# when the destination is missing at configure time: an external project that re-clones wipes the
# copy, and a configure time check would leave it gone until the next configure
macro(makeCopyHeaders src dest target)
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -DSRC=${src} -DDEST=${dest} -P ${COPY_HEADERS_SCRIPT}
COMMENT "copy headers ${src} -> ${dest}")
endmacro()
if (WIN32)
if (VS2015)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
@ -319,10 +333,13 @@ if (NOT FAAD_FOUND AND NOT USE_PRECOMPILED_LIBS) @@ -319,10 +333,13 @@ if (NOT FAAD_FOUND AND NOT USE_PRECOMPILED_LIBS)
set(FAAD_INCLUDE_DIR "${install_dir}/include" CACHE INTERNAL "")
if (WIN32)
set(FAAD_LIBRARY "${SDRANGEL_BINARY_LIB_DIR}/libfaad.lib" CACHE INTERNAL "")
set(FAAD_DRM_LIBRARY "${SDRANGEL_BINARY_LIB_DIR}/libfaad_drm.lib" CACHE INTERNAL "")
elseif (LINUX)
set(FAAD_LIBRARY "${install_dir}/lib${LIB_SUFFIX}/libfaad${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
set(FAAD_DRM_LIBRARY "${install_dir}/lib${LIB_SUFFIX}/libfaad_drm${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
elseif (APPLE)
set(FAAD_LIBRARY "${install_dir}/lib/libfaad${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
set(FAAD_DRM_LIBRARY "${install_dir}/lib/libfaad_drm${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
set(MACOS_EXTERNAL_LIBS_FIXUP "${MACOS_EXTERNAL_LIBS_FIXUP};${install_dir}/lib")
endif ()
endif (NOT FAAD_FOUND AND NOT USE_PRECOMPILED_LIBS)
@ -357,6 +374,7 @@ endif (NOT FFTW3F_FOUND AND NOT USE_PRECOMPILED_LIBS) @@ -357,6 +374,7 @@ endif (NOT FFTW3F_FOUND AND NOT USE_PRECOMPILED_LIBS)
include(FetchContent)
FetchContent_Declare(boost
URL "https://sourceforge.net/projects/boost/files/boost/${BOOST_TAG}/boost_${BOOST_TAG2}.tar.gz/download"
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
)
find_package(Boost QUIET)
@ -544,6 +562,8 @@ if (NOT FFMPEG_FOUND AND NOT USE_PRECOMPILED_LIBS) @@ -544,6 +562,8 @@ if (NOT FFMPEG_FOUND AND NOT USE_PRECOMPILED_LIBS)
set(AVUTIL_LIBRARIES "${install_dir}/lib/libavutil${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
set(SWRESAMPLE_LIBRARIES "${install_dir}/lib/libswresample${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
set(SWSCALE_LIBRARIES "${install_dir}/lib/libswscale${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
set(AVFILTER_INCLUDE_DIRS "${install_dir}/include" CACHE INTERNAL "")
set(AVFILTER_LIBRARIES "${install_dir}/lib/libavfilter${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
if (APPLE)
set(MACOS_EXTERNAL_LIBS_FIXUP "${MACOS_EXTERNAL_LIBS_FIXUP};${install_dir}/lib")
endif ()
@ -731,7 +751,7 @@ if (NOT LIBSERIALDV_FOUND OR LIBSERIALDV_EXTERNAL) @@ -731,7 +751,7 @@ if (NOT LIBSERIALDV_FOUND OR LIBSERIALDV_EXTERNAL)
set(LIBSERIALDV_EXTERNAL ON CACHE INTERNAL "")
set(LIBSERIALDV_INCLUDE_DIR "${source_dir}" CACHE INTERNAL "")
if (WIN32)
makeCopyDir("${source_dir}" "${source_dir}/dsp" serialdv)
makeCopyHeaders("${source_dir}" "${source_dir}/dsp" serialdv)
install(FILES "${SDRANGEL_BINARY_BIN_DIR}/serialdv${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}")
elseif (LINUX)
# because sdrbase/dsp/dvserialworker.h use dsp/dvcontroller.h
@ -843,7 +863,8 @@ endif () @@ -843,7 +863,8 @@ endif ()
# For Satellite Tracker feature and APT demod
if(ENABLE_FEATURE_SATELLITETRACKER OR ENABLE_CHANNELRX_DEMODAPT)
# No tags for this in github - but doesn't change often
# No tags for this in github. Pin the commit to keep builds reproducible.
set(SGP4_TAG 1c0d4ee99404538572037fabfdcbc7133917eae8)
# Fails to build with CMAKE_INTERPROCEDURAL_OPTIMIZATION=ON on Windows
if (WIN32)
set(SGP4_LIBRARIES "${SDRANGEL_BINARY_LIB_DIR}/sgp4s.lib" CACHE INTERNAL "")
@ -854,6 +875,8 @@ if(ENABLE_FEATURE_SATELLITETRACKER OR ENABLE_CHANNELRX_DEMODAPT) @@ -854,6 +875,8 @@ if(ENABLE_FEATURE_SATELLITETRACKER OR ENABLE_CHANNELRX_DEMODAPT)
endif()
ExternalProject_Add(sgp4
GIT_REPOSITORY https://github.com/dnwrnr/sgp4.git
GIT_TAG ${SGP4_TAG}
UPDATE_DISCONNECTED TRUE
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/sgp4"
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF
@ -879,14 +902,24 @@ if(ENABLE_FEATURE_STARTRACKER) @@ -879,14 +902,24 @@ if(ENABLE_FEATURE_STARTRACKER)
if (WIN32)
set(CSPICE_LIBRARIES "${SDRANGEL_BINARY_LIB_DIR}/cspice.lib" CACHE INTERNAL "")
elseif (LINUX)
# We need a shared library on Linux, as the static library has non PIC code, and we need to link it into a shared library
# ExternalProject cspice currently outputs libcspice.so under
# ${EXTERNAL_BUILD_LIBRARIES}/cspice/src/cspice-build/lib/libcspice.so
# so point CSPICE_LIBRARIES there.
set(CSPICE_LIBRARIES
"${EXTERNAL_BUILD_LIBRARIES}/cspice/src/cspice-build/lib/libcspice.so"
CACHE INTERNAL ""
)
# We need a shared library on Linux, as the static library has non PIC code,
# and we need to link it into a shared library
if (CMAKE_BUILD_TYPE STREQUAL "None")
# ExternalProject cspice currently outputs libcspice.so under
# ${EXTERNAL_BUILD_LIBRARIES}/cspice/src/cspice-build/lib/libcspice.so
# so point CSPICE_LIBRARIES there.
set(CSPICE_LIBRARIES
"${EXTERNAL_BUILD_LIBRARIES}/cspice/src/cspice-build/lib/libcspice.so"
CACHE INTERNAL ""
)
else()
# Release, Debug, and RelWithDebInfo have configuration-specific output
# directories supplied by SDRangel.
set(CSPICE_LIBRARIES
"${EXTERNAL_BUILD_LIBRARIES}/lib${LIB_SUFFIX}/libcspice.so"
CACHE INTERNAL ""
)
endif()
# Disable -Werror=format-security for cspice only: distro hardening flags (e.g. Ubuntu Noble)
# inject -Werror=format-security which fails cspice sources that lack -Wformat.
set(CSPICE_ARGS "-DCSPICE_BUILD_STATIC_LIBRARY=OFF"
@ -1062,15 +1095,54 @@ if(ENABLE_CHANNELRX_DEMODACARS AND (NOT LIBACARS_FOUND)) @@ -1062,15 +1095,54 @@ if(ENABLE_CHANNELRX_DEMODACARS AND (NOT LIBACARS_FOUND))
set(MACOS_EXTERNAL_LIBS_FIXUP "${MACOS_EXTERNAL_LIBS_FIXUP};${binary_dir}")
endif ()
endif()
# For DRM demodulator AAC/xHE-AAC audio
# Built as a static library that only modemdrm links, so
# not clash with the libfdk-aac that FFmpeg may load
if (ENABLE_CHANNELRX AND ENABLE_CHANNELRX_DEMODDRM AND (NOT FDKAAC_FOUND OR FDKAAC_EXTERNAL))
set(FDKAAC_PREFIX "${EXTERNAL_BUILD_LIBRARIES}/fdkaac")
if (MSVC)
set(FDKAAC_LIBRARY "${FDKAAC_PREFIX}/lib/fdk-aac.lib" CACHE INTERNAL "")
else ()
set(FDKAAC_LIBRARY "${FDKAAC_PREFIX}/lib/libfdk-aac.a" CACHE INTERNAL "")
endif ()
set(FDKAAC_CMAKE_ARGS ${COMMON_CMAKE_ARGS})
list(FILTER FDKAAC_CMAKE_ARGS EXCLUDE REGEX "^-DCMAKE_(RUNTIME|ARCHIVE|LIBRARY)_OUTPUT_DIRECTORY")
ExternalProject_Add(fdkaac
GIT_REPOSITORY https://github.com/mstorsjo/fdk-aac.git
GIT_TAG ${FDKAAC_TAG}
PREFIX "${FDKAAC_PREFIX}"
CMAKE_ARGS ${FDKAAC_CMAKE_ARGS}
-DBUILD_SHARED_LIBS=OFF
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DBUILD_PROGRAMS=OFF
-DFDK_AAC_INSTALL_CMAKE_CONFIG_MODULE=OFF
-DFDK_AAC_INSTALL_PKGCONFIG_MODULE=OFF
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DCMAKE_INSTALL_LIBDIR=lib
BUILD_BYPRODUCTS "${FDKAAC_LIBRARY}"
TEST_COMMAND ""
)
ExternalProject_Get_Property(fdkaac source_dir install_dir)
set_global(FDKAAC_DEPENDS fdkaac)
set_global_cache(FDKAAC_FOUND ON)
set(FDKAAC_EXTERNAL ON CACHE INTERNAL "")
set(FDKAAC_INCLUDE_DIR "${install_dir}/include" CACHE INTERNAL "")
# Its licence has to be distributed with the binaries
install(FILES "${source_dir}/NOTICE" DESTINATION "${INSTALL_DOC_DIR}/fdk-aac")
endif ()
# For denoiser feature
if((LINUX OR APPLE) AND ENABLE_FEATURE_DENOISER)
if(ENABLE_FEATURE_DENOISER)
if (WIN32)
set(RNNOISE_LIBRARIES "${SDRANGEL_BINARY_LIB_DIR}/rnnoise.lib" CACHE INTERNAL "")
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")
@ -1203,6 +1275,11 @@ else() @@ -1203,6 +1275,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
@ -1224,7 +1301,7 @@ if (LINUX) @@ -1224,7 +1301,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 ""
@ -1238,8 +1315,27 @@ if (LINUX) @@ -1238,8 +1315,27 @@ if (LINUX)
if (ENABLE_BLADERF AND (NOT LIBBLADERF_FOUND OR LIBBLADERF_EXTERNAL))
set_global_cache(LIBBLADERF_FOUND ON)
set(LIBBLADERF_EXTERNAL ON CACHE INTERNAL "")
set(LIBBLADERF_INCLUDE_DIRS "${EXTERNAL_BUILD_LIBRARIES}/bladerf/src/bladerf/host/libraries/libbladeRF/include" CACHE INTERNAL "")
set(LIBBLADERF_LIBRARIES "${EXTERNAL_BUILD_LIBRARIES}/bladerf/src/bladerf-build/output/libbladeRF.so.2" CACHE INTERNAL "")
set(LIBBLADERF_INCLUDE_DIRS
"${EXTERNAL_BUILD_LIBRARIES}/bladerf/src/bladerf/host/libraries/libbladeRF/include"
CACHE INTERNAL ""
)
if (CMAKE_BUILD_TYPE STREQUAL "None")
# ExternalProject bladerf currently outputs libbladeRF.so.2 under
# ${EXTERNAL_BUILD_LIBRARIES}/bladerf/src/bladerf-build/output/libbladeRF.so.2
# so point LIBBLADERF_LIBRARIES there.
set(LIBBLADERF_LIBRARIES
"${EXTERNAL_BUILD_LIBRARIES}/bladerf/src/bladerf-build/output/libbladeRF.so.2"
CACHE INTERNAL ""
)
else()
# Release, Debug, and RelWithDebInfo have configuration-specific output
# directories supplied by SDRangel.
set(LIBBLADERF_LIBRARIES
"${EXTERNAL_BUILD_LIBRARIES}/lib${LIB_SUFFIX}/libbladeRF.so.2"
CACHE INTERNAL ""
)
endif()
ExternalProject_Add(bladerf
GIT_REPOSITORY https://github.com/Nuand/bladeRF.git
GIT_TAG ${BLADERF_TAG}
@ -1417,7 +1513,7 @@ if (WIN32 OR APPLE) @@ -1417,7 +1513,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}
@ -1506,7 +1602,7 @@ if (WIN32 OR APPLE) @@ -1506,7 +1602,7 @@ if (WIN32 OR APPLE)
set(LIBAIRSPY_EXTERNAL ON CACHE INTERNAL "")
set(LIBAIRSPY_INCLUDE_DIR "${source_dir}/libairspy/src" CACHE INTERNAL "")
if (WIN32)
makeCopyDir("${source_dir}/libairspy/src" "${source_dir}/libairspy/src/libairspy" airspy)
makeCopyHeaders("${source_dir}/libairspy/src" "${source_dir}/libairspy/src/libairspy" airspy)
makeCopy("${binary_dir}/../airspy-tools/src/airspy${CMAKE_SHARED_LIBRARY_SUFFIX}" "${SDRANGEL_BINARY_BIN_DIR}/airspy${CMAKE_SHARED_LIBRARY_SUFFIX}" airspy)
install(FILES "${SDRANGEL_BINARY_BIN_DIR}/airspy${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}")
elseif (APPLE)
@ -1548,7 +1644,7 @@ if (WIN32 OR APPLE) @@ -1548,7 +1644,7 @@ if (WIN32 OR APPLE)
set(LIBAIRSPYHF_EXTERNAL ON CACHE INTERNAL "")
set(LIBAIRSPYHF_INCLUDE_DIR "${source_dir}/libairspyhf/src" CACHE INTERNAL "")
if (WIN32)
makeCopyDir("${source_dir}/libairspyhf/src" "${source_dir}/libairspyhf/src/libairspyhf" airspyhf)
makeCopyHeaders("${source_dir}/libairspyhf/src" "${source_dir}/libairspyhf/src/libairspyhf" airspyhf)
install(FILES "${SDRANGEL_BINARY_BIN_DIR}/airspyhf${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}")
elseif (APPLE)
set(LIBAIRSPYHF_LIBRARIES "${binary_dir}/libairspyhf/src/libairspyhf${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
@ -1594,7 +1690,7 @@ if (WIN32 OR APPLE) @@ -1594,7 +1690,7 @@ if (WIN32 OR APPLE)
set(LIBHACKRF_INCLUDE_DIR "${source_dir}/host/libhackrf" CACHE INTERNAL "")
if (WIN32)
# include "libhackrf/hackrf.h"
makeCopyDir("${source_dir}/host/libhackrf/src" "${source_dir}/host/libhackrf/libhackrf" hackrf)
makeCopyHeaders("${source_dir}/host/libhackrf/src" "${source_dir}/host/libhackrf/libhackrf" hackrf)
install(FILES "${SDRANGEL_BINARY_BIN_DIR}/hackrf${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}")
elseif (APPLE)
set(LIBHACKRF_LIBRARIES "${binary_dir}/src/libhackrf${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")

16
external/copy_headers.cmake vendored

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
# Mirrors the headers of one directory into another, so that sources including a library by a
# subdirectory name it does not have in its own tree - <libairspy/airspy.h>, <dsp/dvcontroller.h> -
# resolve. Only the files directly in SRC are copied and no subdirectory is descended into, so a
# destination inside SRC does not end up copying itself.
#
# Run as: cmake -DSRC=<dir> -DDEST=<dir> -P copy_headers.cmake
file(GLOB headers "${SRC}/*.h" "${SRC}/*.hpp")
file(MAKE_DIRECTORY "${DEST}")
if (headers)
# file(COPY) skips a file that is already there with the same timestamp, so repeating this on
# every build costs no rebuilds
file(COPY ${headers} DESTINATION "${DEST}")
endif ()

2
external/windows vendored

@ -1 +1 @@ @@ -1 +1 @@
Subproject commit 72317cca9b2362b8acfd68efcd0d7ad169ce1b7d
Subproject commit 3c47fdd217d930ac6688b3af66a73752762c3ed2

5
flatpak/org.sdrangel.SDRangel.yaml

@ -380,9 +380,8 @@ modules: @@ -380,9 +380,8 @@ modules:
- -Wno-dev
sources:
- type: git
url: https://github.com/steve-m/librtlsdr.git
# latest master for 2.0.2 versioning fix
commit: ae0dd6d4f09088d13500a854091b45ad281ca4f0
url: https://github.com/osmocom/rtl-sdr.git
commit: 797f8143266d983c56d8f35d2d442527529dd8a5
- name: plutosdr
buildsystem: cmake-ninja

2
ft8/fft.h

@ -49,6 +49,8 @@ public: @@ -49,6 +49,8 @@ public:
FFTEngine();
~FFTEngine();
FFTEngine(const FFTEngine&) = delete;
FFTEngine& operator=(const FFTEngine&) = delete;
private:
std::vector<std::complex<float>> analytic(const std::vector<float> &x);

13
ft8/ft4.cpp

@ -1495,15 +1495,14 @@ std::vector<std::vector<float>> FT4::soft_c2m(const FFTEngine::ffts_t &c103) con @@ -1495,15 +1495,14 @@ std::vector<std::vector<float>> FT4::soft_c2m(const FFTEngine::ffts_t &c103) con
// choose the phase that has the lowest total distance to other
// phases. like median but avoids -pi..pi wrap-around.
int n = v.size();
int best = -1;
float best_score = 0;
for (int i = 0; i < n; i++)
const size_t n = v.size();
size_t best = 0;
float best_score = std::numeric_limits<float>::infinity();
for (size_t i = 0; i < n; i++)
{
float score = 0;
for (int j = 0; j < n; j++)
for (size_t j = 0; j < n; j++)
{
if (i == j) {
continue;
@ -1518,7 +1517,7 @@ std::vector<std::vector<float>> FT4::soft_c2m(const FFTEngine::ffts_t &c103) con @@ -1518,7 +1517,7 @@ std::vector<std::vector<float>> FT4::soft_c2m(const FFTEngine::ffts_t &c103) con
score += d;
}
if (best == -1 || score < best_score)
if (score < best_score)
{
best = i;
best_score = score;

20
ft8/ft8.cpp

@ -84,7 +84,10 @@ FT8::FT8( @@ -84,7 +84,10 @@ FT8::FT8(
CallbackInterface *cb,
const std::vector<cdecode> &prevdecs,
FFTEngine *fftEngine
)
):
pass_(0),
hack_0_(0.0f),
hack_1_(0.0f)
{
samples_ = samples;
min_hz_ = min_hz;
@ -1562,7 +1565,7 @@ std::vector<std::vector<float>> FT8::soft_c2m(const FFTEngine::ffts_t &c79) cons @@ -1562,7 +1565,7 @@ std::vector<std::vector<float>> FT8::soft_c2m(const FFTEngine::ffts_t &c79) cons
{
m79[si].resize(8);
float mx = -std::numeric_limits<float>::infinity();
float mx_phase;
float mx_phase = 0;
for (int bi = 0; bi < 8; bi++)
{
@ -1602,15 +1605,14 @@ std::vector<std::vector<float>> FT8::soft_c2m(const FFTEngine::ffts_t &c79) cons @@ -1602,15 +1605,14 @@ std::vector<std::vector<float>> FT8::soft_c2m(const FFTEngine::ffts_t &c79) cons
// choose the phase that has the lowest total distance to other
// phases. like median but avoids -pi..pi wrap-around.
int n = v.size();
int best = -1;
float best_score = 0;
for (int i = 0; i < n; i++)
const size_t n = v.size();
size_t best = 0;
float best_score = std::numeric_limits<float>::infinity();
for (size_t i = 0; i < n; i++)
{
float score = 0;
for (int j = 0; j < n; j++)
for (size_t j = 0; j < n; j++)
{
if (i == j) {
continue;
@ -1625,7 +1627,7 @@ std::vector<std::vector<float>> FT8::soft_c2m(const FFTEngine::ffts_t &c79) cons @@ -1625,7 +1627,7 @@ std::vector<std::vector<float>> FT8::soft_c2m(const FFTEngine::ffts_t &c79) cons
score += d;
}
if (best == -1 || score < best_score)
if (score < best_score)
{
best = i;
best_score = score;

1
httpserver/httpconnectionhandler.cpp

@ -13,6 +13,7 @@ HttpConnectionHandler::HttpConnectionHandler(QSettings* settings, HttpRequestHan @@ -13,6 +13,7 @@ HttpConnectionHandler::HttpConnectionHandler(QSettings* settings, HttpRequestHan
{
Q_ASSERT(settings != 0);
Q_ASSERT(requestHandler != 0);
setObjectName("httpCnnctnHndlr");
this->settings = settings;
this->listenerSettings = 0;
this->requestHandler = requestHandler;

3
httpserver/httpcookie.cpp

@ -28,7 +28,8 @@ HttpCookie::HttpCookie(const QByteArray name, const QByteArray value, const int @@ -28,7 +28,8 @@ HttpCookie::HttpCookie(const QByteArray name, const QByteArray value, const int
this->version=1;
}
HttpCookie::HttpCookie(const QByteArray source)
HttpCookie::HttpCookie(const QByteArray source) :
httpOnly(false)
{
version=1;
maxAge=0;

2
json_udp_data_format.readme.md

@ -173,4 +173,4 @@ @@ -173,4 +173,4 @@
...
"payload_hex": "ffffffff363e0c47..."
}
}
}

100
logging/bufferlogger.cpp

@ -1,50 +1,50 @@ @@ -1,50 +1,50 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2025 Jon Beniston, M7RCE //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "bufferlogger.h"
using namespace qtwebapp;
BufferLogger::BufferLogger(int maxSize, QObject *parent) :
Logger(parent),
m_maxSize(maxSize)
{
}
BufferLogger::~BufferLogger()
{
}
void BufferLogger::write(const LogMessage* logMessage)
{
QString text = qPrintable(logMessage->toString("{timestamp} {type} {msg}", "yyyy-MM-dd HH:mm:ss.zzz"));
m_messages.enqueue(text);
while (m_messages.size() > m_maxSize) {
m_messages.dequeue();
}
}
QString BufferLogger::getLog() const
{
QString log;
for (const auto& s : m_messages) {
log.append(s);
}
return log;
}
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2025 Jon Beniston, M7RCE //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "bufferlogger.h"
using namespace qtwebapp;
BufferLogger::BufferLogger(int maxSize, QObject *parent) :
Logger(parent),
m_maxSize(maxSize)
{
}
BufferLogger::~BufferLogger()
{
}
void BufferLogger::write(const LogMessage* logMessage)
{
QString text = qPrintable(logMessage->toString("{timestamp} {type} {msg}", "yyyy-MM-dd HH:mm:ss.zzz"));
m_messages.enqueue(text);
while (m_messages.size() > m_maxSize) {
m_messages.dequeue();
}
}
QString BufferLogger::getLog() const
{
QString log;
for (const auto& s : m_messages) {
log.append(s);
}
return log;
}

92
logging/bufferlogger.h

@ -1,46 +1,46 @@ @@ -1,46 +1,46 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2025 Jon Beniston, M7RCE //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QQueue>
#include "logger.h"
#include "export.h"
namespace qtwebapp {
// A ring-buffer like logger for holding m_maxSize recent log messages
class LOGGING_API BufferLogger : public Logger {
Q_OBJECT
Q_DISABLE_COPY(BufferLogger)
public:
BufferLogger(int maxSize, QObject *parent = nullptr);
virtual ~BufferLogger();
void write(const LogMessage* logMessage) override;
QString getLog() const; // Get last m_maxSize messages as one big string
private:
int m_maxSize; // Maximum number of messages to store
QQueue<QString> m_messages; // Queue containing last m_maxSize messages
};
}
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2025 Jon Beniston, M7RCE //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QQueue>
#include "logger.h"
#include "export.h"
namespace qtwebapp {
// A ring-buffer like logger for holding m_maxSize recent log messages
class LOGGING_API BufferLogger : public Logger {
Q_OBJECT
Q_DISABLE_COPY(BufferLogger)
public:
BufferLogger(int maxSize, QObject *parent = nullptr);
virtual ~BufferLogger();
void write(const LogMessage* logMessage) override;
QString getLog() const; // Get last m_maxSize messages as one big string
private:
int m_maxSize; // Maximum number of messages to store
QQueue<QString> m_messages; // Queue containing last m_maxSize messages
};
}

2
logging/readme.md

@ -6,4 +6,4 @@ This is based on the logging part of QtWebApp from Stefan Frings @@ -6,4 +6,4 @@ This is based on the logging part of QtWebApp from Stefan Frings
- [Link to API documentation](http://stefanfrings.de/qtwebapp/api/index.html)
- [Link to tutorial](http://stefanfrings.de/qtwebapp/tutorial/index.html)
Some changes have been made to support the option of having a console logging plus optional file logging
Some changes have been made to support the option of having a console logging plus optional file logging

103
modemdrm/CMakeLists.txt

@ -0,0 +1,103 @@ @@ -0,0 +1,103 @@
project(modemdrm)
set(modemdrm_SOURCES
drmacquisition.cpp
drmaudiodecoder.cpp
drmaudioframing.cpp
drmbitutils.cpp
drmcellmap.cpp
drmchannelestimator.cpp
drmconvolutional.cpp
drmdata.cpp
drmfac.cpp
drmfacacquisition.cpp
drmjournaline.cpp
drminterleaver.cpp
drmmsc.cpp
drmofdm.cpp
drmparameters.cpp
drmreceiver.cpp
drmresampler.cpp
drmsdc.cpp
drmsyncstatemachine.cpp
)
set(modemdrm_HEADERS
drmacquisition.h
drmaudiodecoder.h
drmaudioframing.h
drmbitutils.h
drmcellmap.h
drmchannelestimator.h
drmconvolutional.h
drmdata.h
drmfac.h
drmfacacquisition.h
drmjournaline.h
drminterleaver.h
drmmsc.h
drmofdm.h
drmparameters.h
drmreceiver.h
drmresampler.h
drmsdc.h
drmsyncstatemachine.h
)
add_library(modemdrm ${modemdrm_SOURCES})
target_include_directories(modemdrm
PUBLIC
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/exports
)
# DRM AAC/xHE-AAC audio uses the FDK AAC decoder
if(FDKAAC_FOUND)
message(STATUS "modemdrm: DRM AAC/xHE-AAC audio via FDK AAC")
target_compile_definitions(modemdrm PRIVATE MODEMDRM_HAS_FDK_AAC=1)
target_include_directories(modemdrm PRIVATE ${FDKAAC_INCLUDE_DIR})
target_link_libraries(modemdrm PRIVATE ${FDKAAC_LIBRARY})
if(DEFINED FDKAAC_DEPENDS)
add_dependencies(modemdrm ${FDKAAC_DEPENDS})
endif()
# The external FDK is private to modemdrm. Do not re-export its aacDecoder_*
# symbols from a shared modemdrm, so they cannot interpose on (or be
# interposed by) the libfdk-aac that FFmpeg loads in the same process.
if(FDKAAC_EXTERNAL AND BUILD_SHARED_LIBS AND UNIX AND NOT APPLE)
target_link_options(modemdrm PRIVATE "LINKER:--exclude-libs,libfdk-aac.a")
endif()
endif()
# DRM AAC can be decoded by FAAD2 built for DRM (faad_drm), but it does not support xHE-AAC.
if(FAAD_DRM_LIBRARY AND NOT FDKAAC_FOUND)
message(STATUS "modemdrm: DRM AAC audio via FAAD2 - xHE-AAC not supported")
target_compile_definitions(modemdrm PRIVATE MODEMDRM_HAS_FAAD2=1)
target_include_directories(modemdrm PRIVATE ${FAAD_INCLUDE_DIR})
target_link_libraries(modemdrm PRIVATE ${FAAD_DRM_LIBRARY})
if(DEFINED FAAD_DEPENDS)
add_dependencies(modemdrm ${FAAD_DEPENDS})
endif()
endif()
# Without either library DRM still demodulates and lists services, and reports the codec as unavailable.
if(NOT FDKAAC_FOUND AND NOT FAAD_DRM_LIBRARY)
message(STATUS "modemdrm: no DRM audio codec")
endif()
install(TARGETS modemdrm DESTINATION ${INSTALL_LIB_DIR})
if(FDKAAC_FOUND AND NOT FDKAAC_EXTERNAL AND WIN32 AND FDKAAC_RUNTIME_LIBRARY)
# Shipping a prebuilt library requires shipping its licence (the external
# build installs its NOTICE itself).
get_filename_component(_fdk_library_dir "${FDKAAC_LIBRARY}" DIRECTORY)
find_file(FDKAAC_NOTICE NAMES NOTICE NOTICE.txt
HINTS ${FDKAAC_DIR} ${FDK_AAC_DIR} "${_fdk_library_dir}/.." "${FDKAAC_INCLUDE_DIR}/.."
PATH_SUFFIXES . share/doc/fdk-aac share/licenses/fdk-aac)
unset(_fdk_library_dir)
if(NOT FDKAAC_NOTICE)
message(FATAL_ERROR "Installing ${FDKAAC_RUNTIME_LIBRARY} requires its licence: set FDKAAC_NOTICE to the FDK AAC NOTICE file")
endif()
install(FILES "${FDKAAC_RUNTIME_LIBRARY}" DESTINATION ${INSTALL_BIN_DIR})
install(FILES "${FDKAAC_NOTICE}" DESTINATION "${INSTALL_DOC_DIR}/fdk-aac" RENAME NOTICE)
endif()

333
modemdrm/drmacquisition.cpp

@ -0,0 +1,333 @@ @@ -0,0 +1,333 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2026 Jon Beniston, M7RCE <jon@beniston.com> //
// 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 <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "drmacquisition.h"
#include "drmofdm.h"
#include <algorithm>
#include <cmath>
#include <limits>
namespace modemdrm
{
namespace
{
constexpr double Pi = 3.14159265358979323846;
} // namespace
AcquisitionCandidate Acquisition::evaluateMode(
const std::complex<float>* samples,
std::size_t sampleCount,
int sampleRate,
Mode mode,
bool alignFirstPath
)
{
AcquisitionCandidate candidate;
candidate.mode = mode;
if (samples == nullptr || sampleRate <= 0) {
return candidate;
}
const ModeParameters& parameters = Parameters::forMode(mode);
const int useful = parameters.usefulSamples(sampleRate);
const int guard = parameters.guardSamples(sampleRate);
const int symbol = parameters.symbolSamples(sampleRate);
candidate.usefulSamples = useful;
candidate.guardSamples = guard;
candidate.symbolSamples = symbol;
if (useful <= 0 || guard <= 0 || symbol <= 0 || sampleCount < static_cast<std::size_t>(useful + 4 * symbol)) {
return candidate;
}
const std::size_t pairCount = sampleCount - static_cast<std::size_t>(useful);
std::vector<std::complex<double>> phaseCorrelation(symbol, {0.0, 0.0});
std::vector<double> phaseEnergy(symbol, 0.0);
std::vector<int> phaseCount(symbol, 0);
// A DC component (a device's DC spur, which in A-D falls on the unused
// carrier 0 when the channel offset is zero) correlates at phase zero at every lag and
// would pull the fractional frequency estimate towards 0 Hz: remove the
// block mean first.
std::complex<double> sum(0.0, 0.0);
for (std::size_t i = 0; i < sampleCount; ++i) {
sum += static_cast<std::complex<double>>(samples[i]);
}
const std::complex<float> mean = static_cast<std::complex<float>>(sum / static_cast<double>(sampleCount));
int phase = 0;
for (std::size_t i = 0; i < pairCount; ++i)
{
const std::complex<float> first = samples[i] - mean;
const std::complex<float> second = samples[i + useful] - mean;
phaseCorrelation[phase] += static_cast<std::complex<double>>(first * std::conj(second));
phaseEnergy[phase] += 0.5 * (std::norm(first) + std::norm(second));
phaseCount[phase]++;
if (++phase == symbol) {
phase = 0;
}
}
std::complex<double> windowCorrelation(0.0, 0.0);
double windowEnergy = 0.0;
int windowCount = 0;
for (int i = 0; i < guard; ++i)
{
windowCorrelation += phaseCorrelation[i];
windowEnergy += phaseEnergy[i];
windowCount += phaseCount[i];
}
double bestScore = -1.0;
std::complex<double> bestCorrelation(0.0, 0.0);
int bestStart = 0;
int bestCount = 0;
std::vector<double> scores(static_cast<std::size_t>(symbol), 0.0);
for (int start = 0; start < symbol; ++start)
{
const double score = windowEnergy > std::numeric_limits<double>::epsilon()
? std::abs(windowCorrelation) / windowEnergy
: 0.0;
scores[static_cast<std::size_t>(start)] = score;
if (score > bestScore)
{
bestScore = score;
bestCorrelation = windowCorrelation;
bestStart = start;
bestCount = windowCount;
}
const int leaving = start;
const int entering = (start + guard) % symbol;
windowCorrelation += phaseCorrelation[entering] - phaseCorrelation[leaving];
windowEnergy += phaseEnergy[entering] - phaseEnergy[leaving];
windowCount += phaseCount[entering] - phaseCount[leaving];
}
// Each path adds its power to the cyclic-prefix correlation over its own
// guard-length span, so the guard window's maximum falls wherever the
// stronger paths put it. Align to the first significant path instead, so
// that the FFT window (at the end of the guard) holds every echo the guard
// can; aligning to a later path lets the first path's next symbol into
// the window. Walk back from the maximum along the (lightly smoothed)
// per-offset profile while it stays above the noise floor plus a fraction
// of its peak: a first path too weak to pass the threshold contributes
// little interference. The centred smoothing spreads a lone path's
// leading edge earlier, so its start comes out up to about half the box
// early (inside the guard, and only until tracking takes over); undoing
// that overshoots behind a weaker first path, where the profile rises
// gradually.
if (alignFirstPath)
{
std::vector<double> profile(static_cast<std::size_t>(symbol), 0.0);
for (int phase = 0; phase < symbol; ++phase)
{
const double energy = phaseEnergy[static_cast<std::size_t>(phase)];
profile[static_cast<std::size_t>(phase)] = energy > std::numeric_limits<double>::epsilon()
? std::abs(phaseCorrelation[static_cast<std::size_t>(phase)]) / energy : 0.0;
}
const int half = std::max(2, guard / 32);
std::vector<double> smoothed(static_cast<std::size_t>(symbol), 0.0);
for (int phase = 0; phase < symbol; ++phase)
{
double sum = 0.0;
for (int k = -half; k < half; ++k) {
sum += profile[static_cast<std::size_t>((phase + k + symbol) % symbol)];
}
smoothed[static_cast<std::size_t>(phase)] = sum / (2 * half);
}
// Noise floor from a low percentile: with a long guard and long echoes
// most offsets carry correlation, so the median would be signal.
std::vector<double> sorted = smoothed;
const auto floorIndex = static_cast<std::size_t>(symbol / 10);
std::nth_element(sorted.begin(), sorted.begin() + static_cast<std::ptrdiff_t>(floorIndex), sorted.end());
const double noise = sorted[floorIndex];
double peak = 0.0;
for (int k = 0; k < guard; ++k) {
peak = std::max(peak, smoothed[static_cast<std::size_t>((bestStart + k) % symbol)]);
}
// Above the noise's spread as well as its floor: the averaged noise
// magnitude stays within about twice its 10th percentile.
const double threshold = std::max(NoiseMargin * noise, noise + FirstPathFraction * (peak - noise));
// Tolerate brief dips: stop only after a run below the threshold.
const int allowedGap = std::max(2, guard / 16);
int earliestStart = bestStart;
int gap = 0;
for (int step = 1; step < guard && gap < allowedGap; ++step)
{
const int start = (bestStart - step + symbol) % symbol;
if (smoothed[static_cast<std::size_t>(start)] >= threshold)
{
earliestStart = start;
gap = 0;
}
else
{
++gap;
}
}
// The FFT window starts a backoff before the end of the guard. The
// profile there is the power of the paths whose cyclic prefix covers
// that start, i.e. that reach the window free of interference. When
// the echoes span more than the guard allows, timing on the first
// path can push a stronger later path out: move later until the
// window start holds most of the best achievable power.
const int windowOffset = guard - OFDMDemodulator::backoffSamplesFor(guard);
double best = 0.0;
for (double value : smoothed) {
best = std::max(best, value);
}
for (int step = 0; step < guard; ++step)
{
const int start = (earliestStart + step) % symbol;
if (smoothed[static_cast<std::size_t>((start + windowOffset) % symbol)] >= WindowPowerFraction * best)
{
earliestStart = start;
break;
}
}
bestStart = earliestStart;
}
else
{
// Where the FFT window may start: the span around the per-offset
// profile's maximum within WindowPowerFraction of it, where every
// significant path's cyclic prefix covers the window start.
const int half = std::max(2, guard / 32);
std::vector<double> smoothed(static_cast<std::size_t>(symbol), 0.0);
for (int phase = 0; phase < symbol; ++phase)
{
double sum = 0.0;
for (int k = -half; k < half; ++k)
{
const auto index = static_cast<std::size_t>((phase + k + symbol) % symbol);
const double energy = phaseEnergy[index];
if (energy > std::numeric_limits<double>::epsilon()) {
sum += std::abs(phaseCorrelation[index]) / energy;
}
}
smoothed[static_cast<std::size_t>(phase)] = sum / (2 * half);
}
int peakPhase = 0;
for (int phase = 1; phase < symbol; ++phase)
{
if (smoothed[static_cast<std::size_t>(phase)] > smoothed[static_cast<std::size_t>(peakPhase)]) {
peakPhase = phase;
}
}
const double limit = WindowPowerFraction * smoothed[static_cast<std::size_t>(peakPhase)];
int before = 0;
while (before < guard && smoothed[static_cast<std::size_t>((peakPhase - before - 1 + symbol) % symbol)] >= limit) {
++before;
}
int after = 0;
while (after < guard && smoothed[static_cast<std::size_t>((peakPhase + after + 1) % symbol)] >= limit) {
++after;
}
candidate.windowEndOffsetSamples = (peakPhase + after) % symbol;
candidate.windowSpanSamples = before + after + 1;
}
candidate.cyclicPrefixCorrelation = static_cast<float>(
std::max(0.0, std::min(1.0, bestScore))
);
{
// A low percentile: strong echoes raise the correlation over much of
// the symbol, so the median can lie within the cyclic prefix's span.
const auto floor = scores.begin() + static_cast<std::ptrdiff_t>(scores.size() / 10U);
std::nth_element(scores.begin(), floor, scores.end());
candidate.cyclicPrefixFloor = static_cast<float>(std::max(0.0, *floor));
}
candidate.valid = bestCount >= 4 * guard
&& candidate.cyclicPrefixCorrelation >= MinimumCyclicPrefixCorrelation
&& candidate.cyclicPrefixCorrelation - candidate.cyclicPrefixFloor
>= MinimumCyclicPrefixExcess * (1.0f - candidate.cyclicPrefixFloor);
candidate.symbolStartOffsetSamples = bestStart;
candidate.symbolsObserved = guard > 0 ? bestCount / guard : 0;
candidate.fractionalCarrierOffsetHz = -std::arg(bestCorrelation) / (2.0 * Pi * parameters.usefulDurationSeconds());
return candidate;
}
std::vector<int> Acquisition::integerCarrierHypotheses(
Mode mode,
double fractionalCarrierOffsetHz,
int configuredSearchRangeHz
)
{
const int range = Parameters::effectiveSearchRangeHz(mode, configuredSearchRangeHz);
if (range < 0) {
return {};
}
const double spacing = Parameters::forMode(mode).carrierSpacingHz();
// Floating-point IQ rotation/CP estimation can put an exact endpoint a few
// microhertz outside the inclusive bound. Keep a 10-millihertz numerical
// allowance so the endpoint's carrier hypothesis is still examined.
constexpr double EndpointRoundingHz = 0.01;
const int minimum = static_cast<int>(std::ceil((-range - EndpointRoundingHz - fractionalCarrierOffsetHz) / spacing));
const int maximum = static_cast<int>(std::floor((range + EndpointRoundingHz - fractionalCarrierOffsetHz) / spacing));
std::vector<int> hypotheses;
if (minimum > maximum) {
return hypotheses;
}
hypotheses.reserve(static_cast<std::size_t>(maximum - minimum + 1));
const int nearest = std::max(minimum, std::min(maximum,
static_cast<int>(std::llround(-fractionalCarrierOffsetHz / spacing))));
hypotheses.push_back(nearest);
for (int distance = 1; nearest - distance >= minimum || nearest + distance <= maximum; ++distance)
{
if (nearest - distance >= minimum) {
hypotheses.push_back(nearest - distance);
}
if (nearest + distance <= maximum) {
hypotheses.push_back(nearest + distance);
}
}
return hypotheses;
}
} // namespace modemdrm

98
modemdrm/drmacquisition.h

@ -0,0 +1,98 @@ @@ -0,0 +1,98 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2026 Jon Beniston, M7RCE <jon@beniston.com> //
// 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 <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef MODEMDRM_DRMACQUISITION_H_
#define MODEMDRM_DRMACQUISITION_H_
#include <complex>
#include <cstddef>
#include <vector>
#include "drmparameters.h"
namespace modemdrm
{
struct MODEMDRM_API AcquisitionCandidate
{
Mode mode = Mode::A;
bool valid = false;
float cyclicPrefixCorrelation = 0.0f;
// 10th percentile of the guard-window correlation over symbol offsets: the level
// noise or interference correlated at the useful-period lag gives.
float cyclicPrefixFloor = 0.0f;
int symbolStartOffsetSamples = 0;
// Tracking only (alignFirstPath false): the span of FFT-window starts that
// hold nearly all the paths' power, as its last offset in the symbol and
// its width; width 0 when not measured.
int windowEndOffsetSamples = 0;
int windowSpanSamples = 0;
double fractionalCarrierOffsetHz = 0.0;
int usefulSamples = 0;
int guardSamples = 0;
int symbolSamples = 0;
int symbolsObserved = 0;
};
class MODEMDRM_API Acquisition
{
public:
// Coarse cyclic-prefix gate used only to reject implausible mode/timing
// candidates. Repeated CRC-valid FAC blocks are still required for lock.
static constexpr float MinimumCyclicPrefixCorrelation = 0.10f;
// A cyclic prefix concentrates its correlation in one guard-length span of
// the symbol; noise correlates about equally at every offset, as does
// interference correlated at the useful-period lag (a carrier, say), which
// raises the floor. The best guard window must exceed the floor (10th
// percentile over offsets) by this share of the headroom above it: noise
// with interference reached 0.09 and the corpus is at 0.83 or more; 0.15
// is about -7 dB SNR, below where FAC decodes. Without it every noisy
// capture window that passes the correlation gate costs a full FAC search.
static constexpr float MinimumCyclicPrefixExcess = 0.15f;
// Fraction of the way from the noise floor to the peak of the cyclic-prefix
// correlation profile above which a path counts for timing (see
// evaluateMode).
static constexpr double FirstPathFraction = 0.05;
// Multiple of the profile's noise floor (10th percentile) a path must exceed.
static constexpr double NoiseMargin = 2.2;
// Share of the best achievable path power the FFT window start must hold.
static constexpr double WindowPowerFraction = 0.9;
// Timing is the start of the guard window of greatest cyclic-prefix
// correlation, moved to the first significant path when alignFirstPath.
static AcquisitionCandidate evaluateMode(
const std::complex<float>* samples,
std::size_t sampleCount,
int sampleRate,
Mode mode,
bool alignFirstPath = true
);
// Produces carrier indices whose absolute offset from fR is within the
// configured symmetric range. Ordering starts nearest the fractional
// estimate so a receiver can validate cheap hypotheses first.
static std::vector<int> integerCarrierHypotheses(
Mode mode,
double fractionalCarrierOffsetHz,
int configuredSearchRangeHz
);
};
} // namespace modemdrm
#endif // MODEMDRM_DRMACQUISITION_H_

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save