Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0bb0b49c40 | ||
|
|
1c75fda622 | ||
|
|
23b0fb5a62
|
||
|
|
3518516e50 | ||
|
|
d9b0073144 | ||
|
|
6a24c517e7
|
||
|
|
7cf0ff2294 | ||
|
|
af4edca4a7 | ||
|
|
4ed8ca6e84 | ||
|
|
bf6f04c910 |
@@ -12,7 +12,7 @@ env:
|
|||||||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -453,103 +453,18 @@ jobs:
|
|||||||
path: flatpak-src/KST4Contest
|
path: flatpak-src/KST4Contest
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
- name: Import Flatpak signing key
|
- name: Build Flatpak bundle
|
||||||
run: |
|
|
||||||
echo "${{ secrets.FLATPAK_GPG_PRIVATE_KEY }}" | gpg --batch --import
|
|
||||||
FLATPAK_GPG_KEY_ID=$(gpg --list-secret-keys --with-colons | awk -F: '/^fpr/{print $10; exit}')
|
|
||||||
echo "FLATPAK_GPG_KEY_ID=$FLATPAK_GPG_KEY_ID" >> "$GITHUB_ENV"
|
|
||||||
|
|
||||||
- name: Build Flatpak repo (nightly)
|
|
||||||
run: |
|
run: |
|
||||||
flatpak-builder --force-clean target/flatpak-build target/de.x08.KST4Contest.yml
|
flatpak-builder --force-clean target/flatpak-build target/de.x08.KST4Contest.yml
|
||||||
flatpak build-export --gpg-sign="$FLATPAK_GPG_KEY_ID" target/flatpak-repo target/flatpak-build nightly
|
flatpak build-export target/flatpak-repo target/flatpak-build
|
||||||
flatpak build-update-repo --gpg-sign="$FLATPAK_GPG_KEY_ID" target/flatpak-repo
|
flatpak build-bundle target/flatpak-repo "dist/${ASSET_BASENAME}-linux-x86_64.flatpak" de.x08.KST4Contest
|
||||||
|
|
||||||
- name: Create flatpakref (nightly)
|
- name: Upload Flatpak artifact
|
||||||
run: |
|
|
||||||
REPO_NAME="${GITHUB_REPOSITORY#*/}"
|
|
||||||
PAGES_URL="https://${GITHUB_REPOSITORY_OWNER}.github.io/${REPO_NAME}/"
|
|
||||||
GPG_KEY_B64=$(gpg --export "$FLATPAK_GPG_KEY_ID" | base64 -w 0)
|
|
||||||
cat > "dist/de.x08.KST4Contest.nightly.flatpakref" << EOF
|
|
||||||
[Flatpak Ref]
|
|
||||||
Name=de.x08.KST4Contest
|
|
||||||
Branch=nightly
|
|
||||||
Title=KST4Contest (Nightly) – ON4KST Chat Client
|
|
||||||
Url=${PAGES_URL}
|
|
||||||
RuntimeRepo=https://flathub.org/repo/flathub.flatpakrepo
|
|
||||||
GPGKey=${GPG_KEY_B64}
|
|
||||||
IsRuntime=false
|
|
||||||
EOF
|
|
||||||
|
|
||||||
- name: Upload flatpakref
|
|
||||||
uses: actions/upload-artifact@v4.3.4
|
uses: actions/upload-artifact@v4.3.4
|
||||||
with:
|
with:
|
||||||
name: flatpakref
|
name: linux-flatpak
|
||||||
path: dist/de.x08.KST4Contest.nightly.flatpakref
|
path: dist/KST4Contest-*-linux-x86_64.flatpak
|
||||||
|
retention-days: 14
|
||||||
- name: Upload Flatpak OSTree repo
|
|
||||||
uses: actions/upload-artifact@v4.3.4
|
|
||||||
with:
|
|
||||||
name: flatpak-ostree-repo
|
|
||||||
path: target/flatpak-repo/
|
|
||||||
|
|
||||||
publish-flatpak-repo:
|
|
||||||
name: Publish Flatpak OSTree Repo (nightly)
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: build-flatpak
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Install Flatpak tooling
|
|
||||||
run: |
|
|
||||||
sudo apt-get update -qq
|
|
||||||
sudo apt-get install -y --no-install-recommends flatpak
|
|
||||||
|
|
||||||
- name: Import Flatpak signing key
|
|
||||||
run: |
|
|
||||||
echo "${{ secrets.FLATPAK_GPG_PRIVATE_KEY }}" | gpg --batch --import
|
|
||||||
echo "FLATPAK_GPG_KEY_ID=$(gpg --list-secret-keys --with-colons | awk -F: '/^fpr/{print $10; exit}')" >> "$GITHUB_ENV"
|
|
||||||
|
|
||||||
- name: Download OSTree repo artifact
|
|
||||||
uses: actions/download-artifact@v4.1.3
|
|
||||||
with:
|
|
||||||
name: flatpak-ostree-repo
|
|
||||||
path: flatpak-ostree-repo/
|
|
||||||
|
|
||||||
- name: Checkout existing flatpak-repo branch
|
|
||||||
uses: actions/checkout@v4.1.7
|
|
||||||
with:
|
|
||||||
ref: flatpak-repo
|
|
||||||
path: existing-flatpak-repo
|
|
||||||
|
|
||||||
- name: Merge nightly build into flatpak-repo
|
|
||||||
run: |
|
|
||||||
cd existing-flatpak-repo
|
|
||||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
||||||
git config user.name "github-actions[bot]"
|
|
||||||
# Copy the new OSTree build into the repo
|
|
||||||
rsync -a ../flatpak-ostree-repo/ ./
|
|
||||||
# Regenerate summary with all branches
|
|
||||||
flatpak build-update-repo --gpg-sign="$FLATPAK_GPG_KEY_ID" .
|
|
||||||
# Generate .flatpakrepo with embedded GPG key so users can do remote-add without errors
|
|
||||||
REPO_NAME="${GITHUB_REPOSITORY#*/}"
|
|
||||||
PAGES_URL="https://${GITHUB_REPOSITORY_OWNER}.github.io/${REPO_NAME}/"
|
|
||||||
GPG_KEY_B64=$(gpg --export "$FLATPAK_GPG_KEY_ID" | base64 -w 0)
|
|
||||||
cat > kst4contest.flatpakrepo << EOF
|
|
||||||
[Flatpak Repo]
|
|
||||||
Title=KST4Contest
|
|
||||||
Url=${PAGES_URL}
|
|
||||||
Homepage=https://github.com/${GITHUB_REPOSITORY}
|
|
||||||
Comment=KST4Contest – ON4KST Chat Client for VHF/UHF contests
|
|
||||||
GPGKey=${GPG_KEY_B64}
|
|
||||||
EOF
|
|
||||||
# Stage all changes (new/updated refs, summary, objects in OSTree)
|
|
||||||
git add -A
|
|
||||||
if git diff --cached --quiet; then
|
|
||||||
echo "No changes to commit"
|
|
||||||
else
|
|
||||||
git commit -m "Nightly flatpak: $(echo ${{ github.sha }} | cut -c1-7)"
|
|
||||||
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:flatpak-repo
|
|
||||||
fi
|
|
||||||
|
|
||||||
build-macos-dmg:
|
build-macos-dmg:
|
||||||
name: Build macOS DMG (${{ matrix.os }})
|
name: Build macOS DMG (${{ matrix.os }})
|
||||||
|
|||||||
@@ -408,18 +408,10 @@ jobs:
|
|||||||
FLATPAK_GPG_KEY_ID=$(gpg --list-secret-keys --with-colons | awk -F: '/^fpr/{print $10; exit}')
|
FLATPAK_GPG_KEY_ID=$(gpg --list-secret-keys --with-colons | awk -F: '/^fpr/{print $10; exit}')
|
||||||
echo "FLATPAK_GPG_KEY_ID=$FLATPAK_GPG_KEY_ID" >> "$GITHUB_ENV"
|
echo "FLATPAK_GPG_KEY_ID=$FLATPAK_GPG_KEY_ID" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: Determine OSTree branch
|
|
||||||
run: |
|
|
||||||
if [[ "${{ github.ref_name }}" == beta-* ]]; then
|
|
||||||
echo "OSTREE_BRANCH=beta" >> "$GITHUB_ENV"
|
|
||||||
else
|
|
||||||
echo "OSTREE_BRANCH=stable" >> "$GITHUB_ENV"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Build Flatpak repo
|
- name: Build Flatpak repo
|
||||||
run: |
|
run: |
|
||||||
flatpak-builder --force-clean target/flatpak-build target/de.x08.KST4Contest.yml
|
flatpak-builder --force-clean target/flatpak-build target/de.x08.KST4Contest.yml
|
||||||
flatpak build-export --gpg-sign="$FLATPAK_GPG_KEY_ID" target/flatpak-repo target/flatpak-build "$OSTREE_BRANCH"
|
flatpak build-export --gpg-sign="$FLATPAK_GPG_KEY_ID" target/flatpak-repo target/flatpak-build stable
|
||||||
flatpak build-update-repo --gpg-sign="$FLATPAK_GPG_KEY_ID" target/flatpak-repo
|
flatpak build-update-repo --gpg-sign="$FLATPAK_GPG_KEY_ID" target/flatpak-repo
|
||||||
|
|
||||||
- name: Create flatpakref
|
- name: Create flatpakref
|
||||||
@@ -427,11 +419,11 @@ jobs:
|
|||||||
REPO_NAME="${GITHUB_REPOSITORY#*/}"
|
REPO_NAME="${GITHUB_REPOSITORY#*/}"
|
||||||
PAGES_URL="https://${GITHUB_REPOSITORY_OWNER}.github.io/${REPO_NAME}/"
|
PAGES_URL="https://${GITHUB_REPOSITORY_OWNER}.github.io/${REPO_NAME}/"
|
||||||
GPG_KEY_B64=$(gpg --export "$FLATPAK_GPG_KEY_ID" | base64 -w 0)
|
GPG_KEY_B64=$(gpg --export "$FLATPAK_GPG_KEY_ID" | base64 -w 0)
|
||||||
cat > "dist/de.x08.KST4Contest.${OSTREE_BRANCH}.flatpakref" << EOF
|
cat > "dist/de.x08.KST4Contest.flatpakref" << EOF
|
||||||
[Flatpak Ref]
|
[Flatpak Ref]
|
||||||
Name=de.x08.KST4Contest
|
Name=de.x08.KST4Contest
|
||||||
Branch=${OSTREE_BRANCH}
|
Branch=stable
|
||||||
Title=KST4Contest (${{ startsWith(github.ref_name, 'beta-') && 'Beta' || 'Release' }}) – ON4KST Chat Client
|
Title=KST4Contest – ON4KST Chat Client
|
||||||
Url=${PAGES_URL}
|
Url=${PAGES_URL}
|
||||||
RuntimeRepo=https://flathub.org/repo/flathub.flatpakrepo
|
RuntimeRepo=https://flathub.org/repo/flathub.flatpakrepo
|
||||||
GPGKey=${GPG_KEY_B64}
|
GPGKey=${GPG_KEY_B64}
|
||||||
@@ -442,7 +434,7 @@ jobs:
|
|||||||
uses: actions/upload-artifact@v4.3.4
|
uses: actions/upload-artifact@v4.3.4
|
||||||
with:
|
with:
|
||||||
name: flatpakref
|
name: flatpakref
|
||||||
path: dist/de.x08.KST4Contest.*.flatpakref
|
path: dist/de.x08.KST4Contest.flatpakref
|
||||||
|
|
||||||
- name: Upload Flatpak OSTree repo
|
- name: Upload Flatpak OSTree repo
|
||||||
uses: actions/upload-artifact@v4.3.4
|
uses: actions/upload-artifact@v4.3.4
|
||||||
@@ -584,60 +576,32 @@ jobs:
|
|||||||
path: dist/KST4Contest-${{ github.ref_name }}-manual-*.pdf
|
path: dist/KST4Contest-${{ github.ref_name }}-manual-*.pdf
|
||||||
|
|
||||||
publish-flatpak-repo:
|
publish-flatpak-repo:
|
||||||
name: Publish Flatpak OSTree Repo (${{ github.ref_name }})
|
name: Publish Flatpak OSTree Repo to GitHub Pages
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build-flatpak
|
needs: build-flatpak
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install Flatpak tooling
|
|
||||||
run: |
|
|
||||||
sudo apt-get update -qq
|
|
||||||
sudo apt-get install -y --no-install-recommends flatpak
|
|
||||||
|
|
||||||
- name: Import Flatpak signing key
|
|
||||||
run: |
|
|
||||||
echo "${{ secrets.FLATPAK_GPG_PRIVATE_KEY }}" | gpg --batch --import
|
|
||||||
echo "FLATPAK_GPG_KEY_ID=$(gpg --list-secret-keys --with-colons | awk -F: '/^fpr/{print $10; exit}')" >> "$GITHUB_ENV"
|
|
||||||
|
|
||||||
- name: Download OSTree repo artifact
|
- name: Download OSTree repo artifact
|
||||||
uses: actions/download-artifact@v4.1.3
|
uses: actions/download-artifact@v4.1.3
|
||||||
with:
|
with:
|
||||||
name: flatpak-ostree-repo
|
name: flatpak-ostree-repo
|
||||||
path: flatpak-ostree-repo/
|
path: flatpak-ostree-repo/
|
||||||
|
|
||||||
- name: Checkout existing flatpak-repo branch
|
- name: Download flatpakref
|
||||||
uses: actions/checkout@v4.1.7
|
uses: actions/download-artifact@v4.1.3
|
||||||
with:
|
with:
|
||||||
ref: flatpak-repo
|
name: flatpakref
|
||||||
path: existing-flatpak-repo
|
path: flatpak-ostree-repo/
|
||||||
|
|
||||||
- name: Merge build into flatpak-repo
|
- name: Push to flatpak-repo branch
|
||||||
run: |
|
run: |
|
||||||
cd existing-flatpak-repo
|
cd flatpak-ostree-repo
|
||||||
|
git init
|
||||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
rsync -a ../flatpak-ostree-repo/ ./
|
|
||||||
# Regenerate summary with all branches (not just the one just built)
|
|
||||||
flatpak build-update-repo --gpg-sign="$FLATPAK_GPG_KEY_ID" .
|
|
||||||
# Generate .flatpakrepo with embedded GPG key so users can do remote-add without errors
|
|
||||||
REPO_NAME="${GITHUB_REPOSITORY#*/}"
|
|
||||||
PAGES_URL="https://${GITHUB_REPOSITORY_OWNER}.github.io/${REPO_NAME}/"
|
|
||||||
GPG_KEY_B64=$(gpg --export "$FLATPAK_GPG_KEY_ID" | base64 -w 0)
|
|
||||||
cat > kst4contest.flatpakrepo << EOF
|
|
||||||
[Flatpak Repo]
|
|
||||||
Title=KST4Contest
|
|
||||||
Url=${PAGES_URL}
|
|
||||||
Homepage=https://github.com/${GITHUB_REPOSITORY}
|
|
||||||
Comment=KST4Contest – ON4KST Chat Client for VHF/UHF contests
|
|
||||||
GPGKey=${GPG_KEY_B64}
|
|
||||||
EOF
|
|
||||||
git add -A
|
git add -A
|
||||||
if git diff --cached --quiet; then
|
git commit -m "Flatpak repo: ${{ github.ref_name }}"
|
||||||
echo "No changes to commit"
|
git push --force https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:flatpak-repo
|
||||||
else
|
|
||||||
git commit -m "Flatpak repo: ${{ github.ref_name }}"
|
|
||||||
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:flatpak-repo
|
|
||||||
fi
|
|
||||||
|
|
||||||
release-tag:
|
release-tag:
|
||||||
name: Publish Tagged Release
|
name: Publish Tagged Release
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
S53MM
|
||||||
|
PA9R
|
||||||
@@ -116,47 +116,12 @@ Die Datei `de.x08.KST4Contest.flatpakref` aus dem [aktuellen Release](https://gi
|
|||||||
flatpak install de.x08.KST4Contest.flatpakref
|
flatpak install de.x08.KST4Contest.flatpakref
|
||||||
```
|
```
|
||||||
|
|
||||||
Oder den Remote manuell hinzufügen (empfohlen für Nightly/Beta-Zugriff):
|
Oder den Remote manuell hinzufügen:
|
||||||
```bash
|
```bash
|
||||||
flatpak remote-add --if-not-exists kst4contest https://praktimarc.github.io/kst4contest/kst4contest.flatpakrepo
|
flatpak remote-add kst4contest https://praktimarc.github.io/kst4contest/
|
||||||
flatpak install kst4contest de.x08.KST4Contest
|
flatpak install kst4contest de.x08.KST4Contest
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Flatpak-Kanäle (nightly / beta / stable)
|
|
||||||
|
|
||||||
Das Flatpak-Repository enthält drei Kanäle, die alle im selben Remote liegen:
|
|
||||||
|
|
||||||
| Kanal | Inhalt | Wird gebaut bei |
|
|
||||||
|---|---|---|
|
|
||||||
| `stable` | Aktuelle stabile Version | Jedem normalen Release-Tag |
|
|
||||||
| `beta` | Vorab-Version | Tags mit `beta-` Präfix |
|
|
||||||
| `nightly` | Entwicklungsstand (main-Branch) | Täglich / jedem Push auf main |
|
|
||||||
|
|
||||||
Remote einmalig hinzufügen, dann den gewünschten Kanal installieren:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
flatpak remote-add --if-not-exists kst4contest https://praktimarc.github.io/kst4contest/kst4contest.flatpakrepo
|
|
||||||
|
|
||||||
# Stable (Standard)
|
|
||||||
flatpak install kst4contest de.x08.KST4Contest
|
|
||||||
|
|
||||||
# Beta
|
|
||||||
flatpak install kst4contest de.x08.KST4Contest//beta
|
|
||||||
|
|
||||||
# Nightly
|
|
||||||
flatpak install kst4contest de.x08.KST4Contest//nightly
|
|
||||||
```
|
|
||||||
|
|
||||||
> **Hinweis:** Flatpak erlaubt nur eine installierte Version pro App-ID gleichzeitig. Um den Kanal zu wechseln, zuerst die aktuelle Version deinstallieren:
|
|
||||||
> ```bash
|
|
||||||
> flatpak uninstall de.x08.KST4Contest
|
|
||||||
> flatpak install kst4contest de.x08.KST4Contest//nightly
|
|
||||||
> ```
|
|
||||||
|
|
||||||
Updates erfolgen wie gewohnt mit `flatpak update`.
|
|
||||||
|
|
||||||
Die `flatpakref`-Dateien für Beta und Stable liegen jeweils im entsprechenden [GitHub-Release](https://github.com/praktimarc/kst4contest/releases). Das Nightly-`flatpakref` (`de.x08.KST4Contest.nightly.flatpakref`) ist als Artifact im [GitHub Actions](https://github.com/praktimarc/kst4contest/actions)-Tab verfügbar (wird 14 Tage aufbewahrt) – der Remote-Weg oben ist für Nightly daher meist einfacher.
|
|
||||||
|
|
||||||
### macOS
|
### macOS
|
||||||
1. DMG-Datei für die eigene Architektur herunterladen (Apple Silicon oder Intel).
|
1. DMG-Datei für die eigene Architektur herunterladen (Apple Silicon oder Intel).
|
||||||
2. DMG-Datei öffnen.
|
2. DMG-Datei öffnen.
|
||||||
|
|||||||
@@ -116,47 +116,12 @@ Download `de.x08.KST4Contest.flatpakref` from the [latest release](https://githu
|
|||||||
flatpak install de.x08.KST4Contest.flatpakref
|
flatpak install de.x08.KST4Contest.flatpakref
|
||||||
```
|
```
|
||||||
|
|
||||||
Or add the remote manually (recommended for nightly/beta access):
|
Or add the remote manually:
|
||||||
```bash
|
```bash
|
||||||
flatpak remote-add --if-not-exists kst4contest https://praktimarc.github.io/kst4contest/kst4contest.flatpakrepo
|
flatpak remote-add kst4contest https://praktimarc.github.io/kst4contest/
|
||||||
flatpak install kst4contest de.x08.KST4Contest
|
flatpak install kst4contest de.x08.KST4Contest
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Flatpak Channels (nightly / beta / stable)
|
|
||||||
|
|
||||||
The Flatpak repository provides three channels, all served from the same remote:
|
|
||||||
|
|
||||||
| Channel | Content | Built on |
|
|
||||||
|---|---|---|
|
|
||||||
| `stable` | Current stable version | Every normal release tag |
|
|
||||||
| `beta` | Pre-release version | Tags prefixed with `beta-` |
|
|
||||||
| `nightly` | Development build (main branch) | Every push to main / daily |
|
|
||||||
|
|
||||||
Add the remote once, then install the channel you want:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
flatpak remote-add --if-not-exists kst4contest https://praktimarc.github.io/kst4contest/kst4contest.flatpakrepo
|
|
||||||
|
|
||||||
# Stable (default)
|
|
||||||
flatpak install kst4contest de.x08.KST4Contest
|
|
||||||
|
|
||||||
# Beta
|
|
||||||
flatpak install kst4contest de.x08.KST4Contest//beta
|
|
||||||
|
|
||||||
# Nightly
|
|
||||||
flatpak install kst4contest de.x08.KST4Contest//nightly
|
|
||||||
```
|
|
||||||
|
|
||||||
> **Note:** Flatpak only allows one installed version per App-ID at a time. To switch channels, uninstall the current version first:
|
|
||||||
> ```bash
|
|
||||||
> flatpak uninstall de.x08.KST4Contest
|
|
||||||
> flatpak install kst4contest de.x08.KST4Contest//nightly
|
|
||||||
> ```
|
|
||||||
|
|
||||||
Updates work as usual with `flatpak update`.
|
|
||||||
|
|
||||||
The `flatpakref` files for beta and stable are attached to their respective [GitHub Releases](https://github.com/praktimarc/kst4contest/releases). The nightly `flatpakref` (`de.x08.KST4Contest.nightly.flatpakref`) is available as an artifact on the [GitHub Actions](https://github.com/praktimarc/kst4contest/actions) tab (kept for 14 days) — for nightly builds, the manual remote approach above is usually more convenient.
|
|
||||||
|
|
||||||
### macOS
|
### macOS
|
||||||
1. Download the DMG file for your architecture (Apple Silicon or Intel).
|
1. Download the DMG file for your architecture (Apple Silicon or Intel).
|
||||||
2. Open the DMG file.
|
2. Open the DMG file.
|
||||||
|
|||||||
@@ -1205,26 +1205,12 @@ public class ChatController implements ThreadStatusCallback, PstRotatorEventList
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
public void fireUserListUpdate(String reason) {
|
||||||
* Notifies the UI that station-list derived values have changed.
|
if (statusListener != null) {
|
||||||
*
|
// Da UI Updates im JavaFX Thread passieren müssen, hier oder im Listener Platform.runLater nutzen
|
||||||
* <p>This method may be called from parser threads, UDP listener threads and
|
statusListener.onUserListUpdated(reason);
|
||||||
* reachability worker threads. Therefore the listener is always invoked on the
|
}
|
||||||
* JavaFX application thread.</p>
|
}
|
||||||
*
|
|
||||||
* @param reason short debug reason for the UI log
|
|
||||||
*/
|
|
||||||
public void fireUserListUpdate(String reason) {
|
|
||||||
if (statusListener == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Platform.isFxApplicationThread()) {
|
|
||||||
statusListener.onUserListUpdated(reason);
|
|
||||||
} else {
|
|
||||||
Platform.runLater(() -> statusListener.onUserListUpdated(reason));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * checks if the callsign-String of a given chatmember instance and a given list
|
// * checks if the callsign-String of a given chatmember instance and a given list
|
||||||
@@ -2485,8 +2471,6 @@ public class ChatController implements ThreadStatusCallback, PstRotatorEventList
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rebuildWorkedGrossFieldCacheFromDatabase();
|
|
||||||
|
|
||||||
HashMap<String, ChatMember> finalWorkedDataFromDatabase = workedDataFromDatabase;
|
HashMap<String, ChatMember> finalWorkedDataFromDatabase = workedDataFromDatabase;
|
||||||
|
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
|
|||||||
@@ -327,8 +327,7 @@ public class MessageBusManagementThread extends Thread {
|
|||||||
// 1. Store in the new Map (for future context/history)
|
// 1. Store in the new Map (for future context/history)
|
||||||
|
|
||||||
sender.addKnownFrequency(finalDetectedBand, finalDetectedFrequency);
|
sender.addKnownFrequency(finalDetectedBand, finalDetectedFrequency);
|
||||||
// No automatic full terrain analysis here.
|
client.getReachabilityService().ensureTropoMarginCalculated(sender, finalDetectedBand);
|
||||||
// The frequency is stored for later map/manual reachability requests.
|
|
||||||
|
|
||||||
//propagate known frequency to all instances of the same callsign (callRaw may exist multiple times)
|
//propagate known frequency to all instances of the same callsign (callRaw may exist multiple times)
|
||||||
try {
|
try {
|
||||||
@@ -337,9 +336,7 @@ public class MessageBusManagementThread extends Thread {
|
|||||||
ChatMember cm = client.getLst_chatMemberList().get(idx);
|
ChatMember cm = client.getLst_chatMemberList().get(idx);
|
||||||
if (cm != null && cm != sender) {
|
if (cm != null && cm != sender) {
|
||||||
cm.addKnownFrequency(finalDetectedBand, finalDetectedFrequency);
|
cm.addKnownFrequency(finalDetectedBand, finalDetectedFrequency);
|
||||||
// No automatic full terrain analysis here.
|
client.getReachabilityService().ensureTropoMarginCalculated(cm, finalDetectedBand); }
|
||||||
// Avoids exhausting the online terrain API when many stations mention QRGs.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("[SmartParser, warning]: failed to propagate known frequency across duplicates: " + e.getMessage());
|
System.out.println("[SmartParser, warning]: failed to propagate known frequency across duplicates: " + e.getMessage());
|
||||||
@@ -591,8 +588,7 @@ public class MessageBusManagementThread extends Thread {
|
|||||||
|
|
||||||
if (!client.getChatPreferences().getStn_loginCallSign().equals(newMember.getCallSign())) {
|
if (!client.getChatPreferences().getStn_loginCallSign().equals(newMember.getCallSign())) {
|
||||||
this.client.getLst_chatMemberList().add(newMember); //the own call will not be in the list
|
this.client.getLst_chatMemberList().add(newMember); //the own call will not be in the list
|
||||||
// this.client.getReachabilityService().ensureAutoTropoMarginCalculated(newMember);
|
this.client.getReachabilityService().ensureAutoTropoMarginCalculated(newMember);
|
||||||
// Reachability is calculated on demand only: map click, selected station, or manual request.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -638,7 +634,7 @@ public class MessageBusManagementThread extends Thread {
|
|||||||
newMember = this.client.getDbHandler().fetchChatMemberWkdDataForOnlyOneCallsignFromDB(newMember);
|
newMember = this.client.getDbHandler().fetchChatMemberWkdDataForOnlyOneCallsignFromDB(newMember);
|
||||||
|
|
||||||
this.client.getLst_chatMemberList().add(newMember);
|
this.client.getLst_chatMemberList().add(newMember);
|
||||||
// this.client.getReachabilityService().ensureAutoTropoMarginCalculated(newMember);
|
this.client.getReachabilityService().ensureAutoTropoMarginCalculated(newMember);
|
||||||
|
|
||||||
this.client.getDbHandler().storeChatMember(newMember);
|
this.client.getDbHandler().storeChatMember(newMember);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,4 @@
|
|||||||
package kst4contest.controller;
|
package kst4contest.controller;
|
||||||
import kst4contest.view.map.MapCallsignRawSnapshot;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import kst4contest.locatorUtils.Location;
|
import kst4contest.locatorUtils.Location;
|
||||||
@@ -15,12 +7,12 @@ import kst4contest.model.ChatCategory;
|
|||||||
import kst4contest.model.ChatMember;
|
import kst4contest.model.ChatMember;
|
||||||
import kst4contest.model.ChatPreferences;
|
import kst4contest.model.ChatPreferences;
|
||||||
import kst4contest.view.map.GeometryOnlyPathAnalysisService;
|
import kst4contest.view.map.GeometryOnlyPathAnalysisService;
|
||||||
|
|
||||||
import kst4contest.view.map.OpenMeteoTerrainProfileProvider;
|
import kst4contest.view.map.OpenMeteoTerrainProfileProvider;
|
||||||
import kst4contest.view.map.PathAnalysisRequest;
|
import kst4contest.view.map.PathAnalysisRequest;
|
||||||
import kst4contest.view.map.PathAnalysisResult;
|
import kst4contest.view.map.PathAnalysisResult;
|
||||||
import kst4contest.view.map.PathAnalysisService;
|
import kst4contest.view.map.PathAnalysisService;
|
||||||
import kst4contest.view.map.PathGeometryUtils;
|
import kst4contest.view.map.PathGeometryUtils;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -29,57 +21,26 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ThreadFactory;
|
import java.util.concurrent.ThreadFactory;
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Central service for tropo/path reachability calculations.
|
* Background service for station reachability values used by the station table.
|
||||||
*
|
*
|
||||||
* <p>This service is now the single calculation path for:
|
* <p>The service performs the expensive full path analysis off the JavaFX thread,
|
||||||
* <ul>
|
* stores the bidirectional SSB margin in the ChatMember, and leaves the UI with a
|
||||||
* <li>the station table Tropo column</li>
|
* simple numeric value for sorting/filtering.</p>
|
||||||
* <li>the Tropo filter/sorter</li>
|
|
||||||
* <li>the station map path-analysis detail panel</li>
|
|
||||||
* </ul>
|
|
||||||
*
|
|
||||||
* <p>The service always calculates a full {@link PathAnalysisResult}. When the
|
|
||||||
* result contains a usable link budget, the bidirectional SSB margin is copied
|
|
||||||
* into all matching {@link ChatMember} objects. The UI can then sort/filter by
|
|
||||||
* a simple number while the map still receives the full path result.</p>
|
|
||||||
*/
|
*/
|
||||||
public final class ReachabilityService {
|
public final class ReachabilityService {
|
||||||
|
|
||||||
private static final long FAILED_ANALYSIS_RETRY_DELAY_MS = 5L * 60L * 1000L;
|
|
||||||
|
|
||||||
private final ChatController chatController;
|
private final ChatController chatController;
|
||||||
private final PathAnalysisService pathAnalysisService;
|
private final PathAnalysisService pathAnalysisService;
|
||||||
private final ExecutorService executor;
|
private final ExecutorService executor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prevents duplicate jobs for the same path while a calculation is already
|
* Prevents duplicate jobs for the same logical station/band while a calculation
|
||||||
* queued or running.
|
* is already queued or running.
|
||||||
*/
|
*/
|
||||||
private final Set<String> queuedCalculationKeys = ConcurrentHashMap.newKeySet();
|
private final Set<String> queuedCalculationKeys = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stores completed usable path-analysis results. Failed/no-budget results are
|
|
||||||
* not permanently cached so transient terrain/network problems can be retried.
|
|
||||||
*/
|
|
||||||
private final Map<String, PathAnalysisResult> pathAnalysisResultCache = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Temporary callback list for map requests waiting for an already running
|
|
||||||
* background calculation.
|
|
||||||
*/
|
|
||||||
private final Map<String, List<Consumer<PathAnalysisResult>>> pendingMapCallbacksByKey = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prevents immediate retry loops for failed/no-budget analyses, especially
|
|
||||||
* when a TableView cell repeatedly asks for the same value.
|
|
||||||
*/
|
|
||||||
private final Map<String, Long> failedCalculationRetryAfterEpochMs = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
public ReachabilityService(ChatController chatController) {
|
public ReachabilityService(ChatController chatController) {
|
||||||
this.chatController = Objects.requireNonNull(chatController, "chatController");
|
this.chatController = Objects.requireNonNull(chatController, "chatController");
|
||||||
this.pathAnalysisService = new GeometryOnlyPathAnalysisService(new OpenMeteoTerrainProfileProvider());
|
this.pathAnalysisService = new GeometryOnlyPathAnalysisService(new OpenMeteoTerrainProfileProvider());
|
||||||
@@ -96,12 +57,8 @@ public final class ReachabilityService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensures that a station/band SSB-margin value exists if it is already cached.
|
* Ensures that a station/band SSB-margin value exists. Existing finite values
|
||||||
*
|
* and existing NaN failure markers are not recalculated automatically.
|
||||||
* <p>This method deliberately does not start online terrain analysis anymore.
|
|
||||||
* It is safe to call from table cells and filters because it will not consume
|
|
||||||
* API quota. Full calculations are now started only by explicit map/manual
|
|
||||||
* requests.</p>
|
|
||||||
*
|
*
|
||||||
* @param member chatmember to evaluate
|
* @param member chatmember to evaluate
|
||||||
* @param band band to evaluate
|
* @param band band to evaluate
|
||||||
@@ -111,110 +68,36 @@ public final class ReachabilityService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (member.hasFiniteTropoSsbMarginDb(band)) {
|
if (member.hasTropoSsbMarginDb(band)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PathAnalysisRequest request = buildRequestForChatMember(member, band);
|
String calculationKey = buildCalculationKey(member, band);
|
||||||
if (request == null) {
|
if (!queuedCalculationKeys.add(calculationKey)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PathAnalysisResult cachedResult = pathAnalysisResultCache.get(buildCalculationKey(request));
|
executor.submit(() -> {
|
||||||
if (cachedResult != null) {
|
double marginDb = Double.NaN;
|
||||||
storePathAnalysisResultInChatMembers(member, band, cachedResult);
|
try {
|
||||||
}
|
marginDb = calculateSsbMarginDb(member, band);
|
||||||
}
|
} catch (Exception exception) {
|
||||||
|
System.out.println("[ReachabilityService, warning]: analysis failed for "
|
||||||
|
+ member.getCallSignRaw() + " @" + band + ": " + exception.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
final double finalMarginDb = marginDb;
|
||||||
|
Runnable storeResult = () -> {
|
||||||
|
member.setTropoSsbMarginDb(band, finalMarginDb);
|
||||||
|
chatController.fireUserListUpdate("Reachability calculated");
|
||||||
|
};
|
||||||
|
|
||||||
|
if (Platform.isFxApplicationThread()) {
|
||||||
/**
|
storeResult.run();
|
||||||
* Requests a full path analysis for the station map.
|
} else {
|
||||||
*
|
Platform.runLater(storeResult);
|
||||||
* <p>This is the only normal automatic entry point for online/full terrain
|
}
|
||||||
* analysis. The map needs the full PathAnalysisResult, and the station table
|
});
|
||||||
* needs the SSB margin. Both are produced here through the same calculation.</p>
|
|
||||||
*
|
|
||||||
* @param member best matching ChatMember, may be null when only a map snapshot exists
|
|
||||||
* @param selectedSnapshot selected map snapshot
|
|
||||||
* @param fxCallback callback executed on the JavaFX thread
|
|
||||||
*/
|
|
||||||
public void requestPathAnalysisForMap(ChatMember member,
|
|
||||||
MapCallsignRawSnapshot selectedSnapshot,
|
|
||||||
Consumer<PathAnalysisResult> fxCallback) {
|
|
||||||
|
|
||||||
String ownLocator6 = normalizeLocator6(chatController.getChatPreferences().getStn_loginLocatorMainCat());
|
|
||||||
|
|
||||||
if (selectedSnapshot == null) {
|
|
||||||
dispatchFxCallback(fxCallback, PathAnalysisResult.waitingForSelection(ownLocator6));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String targetLocator6 = normalizeLocator6(selectedSnapshot.locator6());
|
|
||||||
|
|
||||||
if (ownLocator6.length() != 6) {
|
|
||||||
dispatchFxCallback(fxCallback,
|
|
||||||
PathAnalysisResult.waitingForValidHomeLocator(ownLocator6, targetLocator6));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!selectedSnapshot.hasUsablePosition()) {
|
|
||||||
dispatchFxCallback(fxCallback,
|
|
||||||
PathAnalysisResult.waitingForValidTarget(ownLocator6, targetLocator6));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
double analysisFrequencyMHz = PathGeometryUtils.resolveAnalysisFrequencyMHz(
|
|
||||||
selectedSnapshot.lastKnownFrequenciesByBand()
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!Double.isFinite(analysisFrequencyMHz) || analysisFrequencyMHz <= 0.0) {
|
|
||||||
Band fallbackBand = member == null ? Band.B_144 : resolveAutoBand(member);
|
|
||||||
analysisFrequencyMHz = resolveAnalysisFrequencyForBand(member, fallbackBand);
|
|
||||||
}
|
|
||||||
|
|
||||||
Band analysisBand = Band.fromFrequency(analysisFrequencyMHz);
|
|
||||||
if (analysisBand == null) {
|
|
||||||
analysisBand = member == null ? Band.B_144 : resolveAutoBand(member);
|
|
||||||
}
|
|
||||||
|
|
||||||
PathAnalysisRequest request = buildRequest(
|
|
||||||
ownLocator6,
|
|
||||||
selectedSnapshot.callSignRaw(),
|
|
||||||
targetLocator6,
|
|
||||||
selectedSnapshot.latitudeDeg(),
|
|
||||||
selectedSnapshot.longitudeDeg(),
|
|
||||||
analysisFrequencyMHz
|
|
||||||
);
|
|
||||||
|
|
||||||
requestPathAnalysisAndStore(member, analysisBand, request, fxCallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Starts a full on-demand reachability calculation for one station row.
|
|
||||||
*
|
|
||||||
* <p>Use this for explicit operator actions only. It may call the online terrain
|
|
||||||
* API and therefore must not be used from TableView cell factories or automatic
|
|
||||||
* chat-join processing.</p>
|
|
||||||
*
|
|
||||||
* @param member station to calculate
|
|
||||||
* @param band selected reachability band
|
|
||||||
*/
|
|
||||||
public void calculateSelectedStationOnDemand(ChatMember member, Band band) {
|
|
||||||
if (member == null || band == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
PathAnalysisRequest request = buildRequestForChatMember(member, band);
|
|
||||||
if (request == null) {
|
|
||||||
member.setTropoSsbMarginDb(band, Double.NaN);
|
|
||||||
chatController.fireUserListUpdate("Reachability unavailable");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
requestPathAnalysisAndStore(member, band, request, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -278,222 +161,42 @@ public final class ReachabilityService {
|
|||||||
executor.shutdownNow();
|
executor.shutdownNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private double calculateSsbMarginDb(ChatMember member, Band band) {
|
||||||
* Starts or reuses one shared path-analysis calculation.
|
|
||||||
*
|
|
||||||
* @param member matching ChatMember, may be null for map-only snapshots
|
|
||||||
* @param band band under which the value is stored in ChatMember
|
|
||||||
* @param request full path-analysis request
|
|
||||||
* @param fxCallback optional map callback
|
|
||||||
*/
|
|
||||||
private void requestPathAnalysisAndStore(ChatMember member,
|
|
||||||
Band band,
|
|
||||||
PathAnalysisRequest request,
|
|
||||||
Consumer<PathAnalysisResult> fxCallback) {
|
|
||||||
|
|
||||||
if (request == null || band == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String calculationKey = buildCalculationKey(request);
|
|
||||||
|
|
||||||
PathAnalysisResult cachedResult = pathAnalysisResultCache.get(calculationKey);
|
|
||||||
if (cachedResult != null) {
|
|
||||||
storePathAnalysisResultInChatMembers(member, band, cachedResult);
|
|
||||||
dispatchFxCallback(fxCallback, cachedResult);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Long retryAfterEpochMs = failedCalculationRetryAfterEpochMs.get(calculationKey);
|
|
||||||
if (retryAfterEpochMs != null && System.currentTimeMillis() < retryAfterEpochMs) {
|
|
||||||
dispatchFxCallback(fxCallback, createNoProfileResult(
|
|
||||||
request,
|
|
||||||
"Previous path analysis failed or the terrain API limit was reached. Retry is delayed briefly."
|
|
||||||
));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
addPendingCallback(calculationKey, fxCallback);
|
|
||||||
|
|
||||||
if (!queuedCalculationKeys.add(calculationKey)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
executor.submit(() -> {
|
|
||||||
PathAnalysisResult result;
|
|
||||||
|
|
||||||
try {
|
|
||||||
result = pathAnalysisService.analyze(request);
|
|
||||||
if (result == null) {
|
|
||||||
result = createNoProfileResult(request, "Path analysis returned no result.");
|
|
||||||
}
|
|
||||||
} catch (Exception exception) {
|
|
||||||
result = createNoProfileResult(
|
|
||||||
request,
|
|
||||||
"Path analysis failed: " + exception.getMessage()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean usableBudget = hasUsableLinkBudget(result);
|
|
||||||
|
|
||||||
if (usableBudget) {
|
|
||||||
pathAnalysisResultCache.put(calculationKey, result);
|
|
||||||
failedCalculationRetryAfterEpochMs.remove(calculationKey);
|
|
||||||
} else {
|
|
||||||
failedCalculationRetryAfterEpochMs.put(
|
|
||||||
calculationKey,
|
|
||||||
System.currentTimeMillis() + FAILED_ANALYSIS_RETRY_DELAY_MS
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
queuedCalculationKeys.remove(calculationKey);
|
|
||||||
|
|
||||||
PathAnalysisResult finalResult = result;
|
|
||||||
Runnable updateTask = () -> {
|
|
||||||
storePathAnalysisResultInChatMembers(member, band, finalResult);
|
|
||||||
dispatchAndClearPendingCallbacks(calculationKey, finalResult);
|
|
||||||
chatController.fireUserListUpdate("Reachability calculated");
|
|
||||||
};
|
|
||||||
|
|
||||||
if (Platform.isFxApplicationThread()) {
|
|
||||||
updateTask.run();
|
|
||||||
} else {
|
|
||||||
Platform.runLater(updateTask);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builds a path-analysis request from a ChatMember row.
|
|
||||||
*
|
|
||||||
* @param member station row
|
|
||||||
* @param band selected reachability band
|
|
||||||
* @return request or null if locators are not usable
|
|
||||||
*/
|
|
||||||
private PathAnalysisRequest buildRequestForChatMember(ChatMember member, Band band) {
|
|
||||||
String ownLocator6 = normalizeLocator6(chatController.getChatPreferences().getStn_loginLocatorMainCat());
|
String ownLocator6 = normalizeLocator6(chatController.getChatPreferences().getStn_loginLocatorMainCat());
|
||||||
String targetLocator6 = normalizeLocator6(member.getQra());
|
String targetLocator6 = normalizeLocator6(member.getQra());
|
||||||
|
|
||||||
if (ownLocator6.length() != 6 || targetLocator6.length() != 6) {
|
if (ownLocator6.length() != 6 || targetLocator6.length() != 6) {
|
||||||
return null;
|
return Double.NaN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Location homeLocation = new Location(ownLocator6);
|
||||||
Location targetLocation = new Location(targetLocator6);
|
Location targetLocation = new Location(targetLocator6);
|
||||||
|
|
||||||
double analysisFrequencyMHz = resolveAnalysisFrequencyForBand(member, band);
|
double analysisFrequencyMHz = resolveAnalysisFrequencyForBand(member, band);
|
||||||
|
|
||||||
return buildRequest(
|
PathAnalysisRequest request = new PathAnalysisRequest(
|
||||||
ownLocator6,
|
ownLocator6,
|
||||||
|
homeLocation.getLatitude().toDegrees(),
|
||||||
|
homeLocation.getLongitude().toDegrees(),
|
||||||
member.getCallSignRaw(),
|
member.getCallSignRaw(),
|
||||||
targetLocator6,
|
targetLocator6,
|
||||||
targetLocation.getLatitude().toDegrees(),
|
targetLocation.getLatitude().toDegrees(),
|
||||||
targetLocation.getLongitude().toDegrees(),
|
targetLocation.getLongitude().toDegrees(),
|
||||||
analysisFrequencyMHz
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builds the shared PathAnalysisRequest used by map and table/manual requests.
|
|
||||||
*/
|
|
||||||
private PathAnalysisRequest buildRequest(String ownLocator6,
|
|
||||||
String targetCallsignRaw,
|
|
||||||
String targetLocator6,
|
|
||||||
double targetLatitudeDeg,
|
|
||||||
double targetLongitudeDeg,
|
|
||||||
double analysisFrequencyMHz) {
|
|
||||||
|
|
||||||
Location homeLocation = new Location(ownLocator6);
|
|
||||||
|
|
||||||
return new PathAnalysisRequest(
|
|
||||||
ownLocator6,
|
|
||||||
homeLocation.getLatitude().toDegrees(),
|
|
||||||
homeLocation.getLongitude().toDegrees(),
|
|
||||||
targetCallsignRaw,
|
|
||||||
targetLocator6,
|
|
||||||
targetLatitudeDeg,
|
|
||||||
targetLongitudeDeg,
|
|
||||||
analysisFrequencyMHz,
|
analysisFrequencyMHz,
|
||||||
chatController.getChatPreferences().getStn_pathAnalysisOwnAntennaHeightMeters(),
|
chatController.getChatPreferences().getStn_pathAnalysisOwnAntennaHeightMeters(),
|
||||||
chatController.getChatPreferences().getStn_pathAnalysisDefaultTargetAntennaHeightMeters(),
|
chatController.getChatPreferences().getStn_pathAnalysisDefaultTargetAntennaHeightMeters(),
|
||||||
PathGeometryUtils.DEFAULT_EFFECTIVE_EARTH_RADIUS_FACTOR,
|
PathGeometryUtils.DEFAULT_EFFECTIVE_EARTH_RADIUS_FACTOR,
|
||||||
chatController.getChatPreferences().buildPathLinkBudgetSettings()
|
chatController.getChatPreferences().buildPathLinkBudgetSettings()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
PathAnalysisResult result = pathAnalysisService.analyze(request);
|
||||||
|
if (result == null || result.linkBudgetSummary() == null || !result.linkBudgetSummary().hasUsableBudget()) {
|
||||||
|
return Double.NaN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.linkBudgetSummary().bidirectionalSsbMarginDb();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Stores the SSB margin from a completed analysis in all matching ChatMember
|
|
||||||
* objects. Matching uses raw callsign and locator.
|
|
||||||
*/
|
|
||||||
private void storePathAnalysisResultInChatMembers(ChatMember primaryMember,
|
|
||||||
Band band,
|
|
||||||
PathAnalysisResult result) {
|
|
||||||
|
|
||||||
if (band == null || result == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
double marginDb = hasUsableLinkBudget(result)
|
|
||||||
? result.linkBudgetSummary().bidirectionalSsbMarginDb()
|
|
||||||
: Double.NaN;
|
|
||||||
|
|
||||||
if (primaryMember != null) {
|
|
||||||
primaryMember.setTropoSsbMarginDb(band, marginDb);
|
|
||||||
}
|
|
||||||
|
|
||||||
String resultCallSignRaw = normalizeCallsignRaw(result.toCallsignRaw());
|
|
||||||
String resultLocator6 = normalizeLocator6(result.toLocator6());
|
|
||||||
|
|
||||||
for (ChatMember member : chatController.snapshotChatMembers()) {
|
|
||||||
if (member == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
String memberCallSignRaw = normalizeCallsignRaw(member.getCallSignRaw());
|
|
||||||
if (!resultCallSignRaw.isBlank() && !resultCallSignRaw.equals(memberCallSignRaw)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
String memberLocator6 = normalizeLocator6(member.getQra());
|
|
||||||
if (!resultLocator6.isBlank() && !resultLocator6.equals(memberLocator6)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
member.setTropoSsbMarginDb(band, marginDb);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resolves the analysis frequency from a map snapshot first, because the map
|
|
||||||
* aggregates all visible ChatMember variants and often knows the best current
|
|
||||||
* frequency per band.
|
|
||||||
*
|
|
||||||
* @param member fallback member
|
|
||||||
* @param selectedSnapshot selected map snapshot
|
|
||||||
* @return analysis frequency in MHz
|
|
||||||
*/
|
|
||||||
private double resolveAnalysisFrequencyForSnapshot(ChatMember member, MapCallsignRawSnapshot selectedSnapshot) {
|
|
||||||
if (selectedSnapshot != null) {
|
|
||||||
double snapshotFrequencyMHz =
|
|
||||||
PathGeometryUtils.resolveAnalysisFrequencyMHz(selectedSnapshot.lastKnownFrequenciesByBand());
|
|
||||||
|
|
||||||
if (Double.isFinite(snapshotFrequencyMHz) && snapshotFrequencyMHz > 0.0) {
|
|
||||||
return snapshotFrequencyMHz;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Band fallbackBand = member == null ? Band.B_144 : resolveAutoBand(member);
|
|
||||||
return resolveAnalysisFrequencyForBand(member, fallbackBand);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resolves the analysis frequency for one member/band pair.
|
|
||||||
*
|
|
||||||
* <p>Preference order:
|
|
||||||
* <ol>
|
|
||||||
* <li>knownActiveBands frequency for the band</li>
|
|
||||||
* <li>current displayed QRG if it belongs to the same band</li>
|
|
||||||
* <li>band default frequency</li>
|
|
||||||
* </ol>
|
|
||||||
*/
|
|
||||||
private double resolveAnalysisFrequencyForBand(ChatMember member, Band band) {
|
private double resolveAnalysisFrequencyForBand(ChatMember member, Band band) {
|
||||||
if (member != null && member.getKnownActiveBands() != null) {
|
if (member != null && member.getKnownActiveBands() != null) {
|
||||||
ChatMember.ActiveFrequencyInfo activeFrequencyInfo = member.getKnownActiveBands().get(band);
|
ChatMember.ActiveFrequencyInfo activeFrequencyInfo = member.getKnownActiveBands().get(band);
|
||||||
@@ -504,148 +207,19 @@ public final class ReachabilityService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (member != null && member.getFrequency() != null && member.getFrequency().getValue() != null) {
|
|
||||||
double parsedFrequencyMHz = PathGeometryUtils.tryParseFrequencyMHz(member.getFrequency().getValue());
|
|
||||||
if (Double.isFinite(parsedFrequencyMHz) && parsedFrequencyMHz > 0.0) {
|
|
||||||
Band parsedBand = Band.fromFrequency(parsedFrequencyMHz);
|
|
||||||
if (parsedBand == null || parsedBand == band) {
|
|
||||||
return parsedFrequencyMHz;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return band.getDefaultAnalysisFrequencyMHz();
|
return band.getDefaultAnalysisFrequencyMHz();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private String buildCalculationKey(ChatMember member, Band band) {
|
||||||
* Adds a map callback to the pending callback list for one calculation key.
|
String callSignRaw = member.getCallSignRaw() == null ? "" : member.getCallSignRaw();
|
||||||
*
|
String locator = member.getQra() == null ? "" : member.getQra();
|
||||||
* @param calculationKey path key
|
return callSignRaw.trim().toUpperCase() + "|" + locator.trim().toUpperCase() + "|" + band.name();
|
||||||
* @param fxCallback callback to add
|
|
||||||
*/
|
|
||||||
private void addPendingCallback(String calculationKey, Consumer<PathAnalysisResult> fxCallback) {
|
|
||||||
if (fxCallback == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pendingMapCallbacksByKey
|
|
||||||
.computeIfAbsent(
|
|
||||||
calculationKey,
|
|
||||||
ignored -> Collections.synchronizedList(new ArrayList<>())
|
|
||||||
)
|
|
||||||
.add(fxCallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dispatches and removes all callbacks waiting for one completed calculation.
|
|
||||||
*
|
|
||||||
* @param calculationKey path key
|
|
||||||
* @param result completed result
|
|
||||||
*/
|
|
||||||
private void dispatchAndClearPendingCallbacks(String calculationKey, PathAnalysisResult result) {
|
|
||||||
List<Consumer<PathAnalysisResult>> callbacks = pendingMapCallbacksByKey.remove(calculationKey);
|
|
||||||
if (callbacks == null || callbacks.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Consumer<PathAnalysisResult>> callbackSnapshot;
|
|
||||||
synchronized (callbacks) {
|
|
||||||
callbackSnapshot = new ArrayList<>(callbacks);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Consumer<PathAnalysisResult> callback : callbackSnapshot) {
|
|
||||||
dispatchFxCallback(callback, result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Executes a map callback on the JavaFX application thread.
|
|
||||||
*
|
|
||||||
* @param fxCallback callback to execute
|
|
||||||
* @param result result to pass
|
|
||||||
*/
|
|
||||||
private void dispatchFxCallback(Consumer<PathAnalysisResult> fxCallback, PathAnalysisResult result) {
|
|
||||||
if (fxCallback == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Platform.isFxApplicationThread()) {
|
|
||||||
fxCallback.accept(result);
|
|
||||||
} else {
|
|
||||||
Platform.runLater(() -> fxCallback.accept(result));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether the result contains a usable link-budget summary.
|
|
||||||
*
|
|
||||||
* @param result path-analysis result
|
|
||||||
* @return true if SSB margin can be read
|
|
||||||
*/
|
|
||||||
private boolean hasUsableLinkBudget(PathAnalysisResult result) {
|
|
||||||
return result != null
|
|
||||||
&& result.linkBudgetSummary() != null
|
|
||||||
&& result.linkBudgetSummary().hasUsableBudget();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a no-profile/no-budget result for failed service calculations.
|
|
||||||
*
|
|
||||||
* @param request original request
|
|
||||||
* @param statusText status shown in the map detail panel
|
|
||||||
* @return placeholder path result
|
|
||||||
*/
|
|
||||||
private PathAnalysisResult createNoProfileResult(PathAnalysisRequest request, String statusText) {
|
|
||||||
return PathAnalysisResult.noProfile(
|
|
||||||
"Reachability",
|
|
||||||
request.fromLocator6(),
|
|
||||||
request.toLocator6(),
|
|
||||||
request.toCallsignRaw(),
|
|
||||||
Double.NaN,
|
|
||||||
Double.NaN,
|
|
||||||
request.homeAntennaHeightMeters(),
|
|
||||||
request.targetAntennaHeightMeters(),
|
|
||||||
request.frequencyMHz(),
|
|
||||||
statusText
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builds a stable calculation key.
|
|
||||||
*
|
|
||||||
* <p>The key includes station, locators, frequency, antenna heights and link
|
|
||||||
* budget settings. If any relevant input changes, a new calculation is allowed.</p>
|
|
||||||
*/
|
|
||||||
private String buildCalculationKey(PathAnalysisRequest request) {
|
|
||||||
return normalizeLocator6(request.fromLocator6())
|
|
||||||
+ "|"
|
|
||||||
+ normalizeCallsignRaw(request.toCallsignRaw())
|
|
||||||
+ "|"
|
|
||||||
+ normalizeLocator6(request.toLocator6())
|
|
||||||
+ "|"
|
|
||||||
+ String.format(Locale.US, "%.5f", request.toLatitudeDeg())
|
|
||||||
+ "|"
|
|
||||||
+ String.format(Locale.US, "%.5f", request.toLongitudeDeg())
|
|
||||||
+ "|"
|
|
||||||
+ String.format(Locale.US, "%.3f", request.frequencyMHz())
|
|
||||||
+ "|"
|
|
||||||
+ String.format(Locale.US, "%.1f", request.homeAntennaHeightMeters())
|
|
||||||
+ "|"
|
|
||||||
+ String.format(Locale.US, "%.1f", request.targetAntennaHeightMeters())
|
|
||||||
+ "|"
|
|
||||||
+ request.linkBudgetSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
private String normalizeCallsignRaw(String callSignRaw) {
|
|
||||||
return callSignRaw == null ? "" : callSignRaw.trim().toUpperCase(Locale.ROOT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String normalizeLocator6(String locator) {
|
private String normalizeLocator6(String locator) {
|
||||||
return locator == null ? "" : locator.trim().toUpperCase(Locale.ROOT);
|
return locator == null ? "" : locator.trim().toUpperCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static final class ReachabilityThreadFactory implements ThreadFactory {
|
private static final class ReachabilityThreadFactory implements ThreadFactory {
|
||||||
@Override
|
@Override
|
||||||
public Thread newThread(Runnable runnable) {
|
public Thread newThread(Runnable runnable) {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package kst4contest.controller;
|
|||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import kst4contest.ApplicationConstants;
|
import kst4contest.ApplicationConstants;
|
||||||
import kst4contest.model.Band;
|
|
||||||
import kst4contest.model.ChatMember;
|
import kst4contest.model.ChatMember;
|
||||||
import kst4contest.model.ThreadStateMessage;
|
import kst4contest.model.ThreadStateMessage;
|
||||||
import kst4contest.view.GuiUtils;
|
import kst4contest.view.GuiUtils;
|
||||||
@@ -287,72 +286,6 @@ public class ReadUDPByWintestThread extends Thread {
|
|||||||
// socket.send(new DatagramPacket(bytes, bytes.length, broadcast, 9871));
|
// socket.send(new DatagramPacket(bytes, bytes.length, broadcast, 9871));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resolves the project Band enum from Win-Test band IDs.
|
|
||||||
*
|
|
||||||
* <p>Only bands that exist in the current Band enum are returned. 50/70 MHz are
|
|
||||||
* still represented as worked flags in ChatMember, but they are not part of the
|
|
||||||
* current Reachability/New-Locator band enum.</p>
|
|
||||||
*
|
|
||||||
* @param bandId Win-Test band id from ADDQSO
|
|
||||||
* @return matching Band or null
|
|
||||||
*/
|
|
||||||
private Band helper_resolveBandFromWinTestBandId(String bandId) {
|
|
||||||
if (bandId == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (bandId.trim()) {
|
|
||||||
case "12": return Band.B_144;
|
|
||||||
case "14": return Band.B_432;
|
|
||||||
case "16": return Band.B_1296;
|
|
||||||
case "17": return Band.B_2320;
|
|
||||||
case "18": return Band.B_3400;
|
|
||||||
case "19": return Band.B_5760;
|
|
||||||
case "20": return Band.B_10G;
|
|
||||||
case "21": return Band.B_24G;
|
|
||||||
default: return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extracts the locator from a Win-Test ADDQSO packet.
|
|
||||||
*
|
|
||||||
* <p>Current parser model based on the existing split-by-quotes code:
|
|
||||||
* <ul>
|
|
||||||
* <li>{@code split("\"")[7]} = callsign</li>
|
|
||||||
* <li>{@code split("\"")[11]} = received exchange, e.g. 599001</li>
|
|
||||||
* <li>{@code split("\"")[13]} = locator, e.g. JO51UM</li>
|
|
||||||
* </ul>
|
|
||||||
*
|
|
||||||
* <p>If the dedicated locator field is empty, the exchange is used as fallback.</p>
|
|
||||||
*
|
|
||||||
* @param msg raw ADDQSO message
|
|
||||||
* @return normalized six-character locator or null
|
|
||||||
*/
|
|
||||||
private String helper_resolveLocatorFromWinTestAddQso(String msg) {
|
|
||||||
if (msg == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
String[] quotedParts = msg.split("\"");
|
|
||||||
|
|
||||||
if (quotedParts.length > 13) {
|
|
||||||
String locator = WorkedGrossFieldCache.extractLocator6(quotedParts[13]);
|
|
||||||
if (locator != null) {
|
|
||||||
return locator;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (quotedParts.length > 11) {
|
|
||||||
return WorkedGrossFieldCache.extractLocator6(quotedParts[11]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Catches add-qso messages of wintest if a new qso gets into the log<br/>
|
* Catches add-qso messages of wintest if a new qso gets into the log<br/>
|
||||||
*
|
*
|
||||||
@@ -377,22 +310,16 @@ public class ReadUDPByWintestThread extends Thread {
|
|||||||
// receivedQsos.put(qsoNumber, msg);
|
// receivedQsos.put(qsoNumber, msg);
|
||||||
// lastKnownQso = Math.max(lastKnownQso, qsoNumber);
|
// lastKnownQso = Math.max(lastKnownQso, qsoNumber);
|
||||||
String callSignCatched = msg.split("\"") [7];
|
String callSignCatched = msg.split("\"") [7];
|
||||||
String locatorFromLogger = helper_resolveLocatorFromWinTestAddQso(msg);
|
|
||||||
|
|
||||||
ChatMember workedCall = new ChatMember();
|
ChatMember workedCall = new ChatMember();
|
||||||
workedCall.setCallSign(callSignCatched);
|
workedCall.setCallSign(callSignCatched);
|
||||||
workedCall.setWorked(true); //its worked at this place, for sure!
|
workedCall.setWorked(true); //its worked at this place, for sure!
|
||||||
|
|
||||||
if (locatorFromLogger != null) {
|
|
||||||
workedCall.setQra(locatorFromLogger);
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrayList<Integer> markTheseChattersAsWorked = client.checkListForChatMemberIndexesByCallSign(workedCall);
|
ArrayList<Integer> markTheseChattersAsWorked = client.checkListForChatMemberIndexesByCallSign(workedCall);
|
||||||
|
|
||||||
String bandId;
|
String bandId;
|
||||||
bandId = msg.split("\"")[6].split(" ")[4].trim();
|
bandId = msg.split("\"")[6].split(" ")[4].trim();
|
||||||
|
|
||||||
Band workedBand = helper_resolveBandFromWinTestBandId(bandId);
|
|
||||||
switch (bandId) {
|
switch (bandId) {
|
||||||
case "10" -> workedCall.setWorked50(true);
|
case "10" -> workedCall.setWorked50(true);
|
||||||
case "11" -> workedCall.setWorked70(true);
|
case "11" -> workedCall.setWorked70(true);
|
||||||
@@ -409,10 +336,6 @@ public class ReadUDPByWintestThread extends Thread {
|
|||||||
default -> System.out.println("[WinTestUDPRcvr: warning] Unbekannte Band-ID: " + bandId);
|
default -> System.out.println("[WinTestUDPRcvr: warning] Unbekannte Band-ID: " + bandId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (workedBand != null && locatorFromLogger != null) {
|
|
||||||
this.client.registerWorkedGrossField(workedBand, locatorFromLogger, workedCall, "WINTEST");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!markTheseChattersAsWorked.isEmpty()) {
|
if (!markTheseChattersAsWorked.isEmpty()) {
|
||||||
//Worked call is part of the current chatmember list
|
//Worked call is part of the current chatmember list
|
||||||
|
|
||||||
@@ -422,13 +345,6 @@ public class ReadUDPByWintestThread extends Thread {
|
|||||||
|
|
||||||
modifyThat.setWorked(true); //worked its for sure
|
modifyThat.setWorked(true); //worked its for sure
|
||||||
|
|
||||||
if (locatorFromLogger != null
|
|
||||||
&& (modifyThat.getQra() == null
|
|
||||||
|| modifyThat.getQra().isBlank()
|
|
||||||
|| "unknown".equalsIgnoreCase(modifyThat.getQra()))) {
|
|
||||||
modifyThat.setQra(locatorFromLogger);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (workedCall.isWorked50()) {
|
if (workedCall.isWorked50()) {
|
||||||
modifyThat.setWorked50(true);
|
modifyThat.setWorked50(true);
|
||||||
} else if (workedCall.isWorked70()) {
|
} else if (workedCall.isWorked70()) {
|
||||||
@@ -482,11 +398,7 @@ public class ReadUDPByWintestThread extends Thread {
|
|||||||
if (!isInChat) {
|
if (!isInChat) {
|
||||||
|
|
||||||
workedCall.setName("unknown");
|
workedCall.setName("unknown");
|
||||||
|
workedCall.setQra("unknown");
|
||||||
if (workedCall.getQra() == null || workedCall.getQra().isBlank()) {
|
|
||||||
workedCall.setQra("unknown");
|
|
||||||
}
|
|
||||||
|
|
||||||
workedCall.setLastActivity(new Utils4KST().time_generateActualTimeInDateFormat());
|
workedCall.setLastActivity(new Utils4KST().time_generateActualTimeInDateFormat());
|
||||||
this.client.getDbHandler().storeChatMember(workedCall);
|
this.client.getDbHandler().storeChatMember(workedCall);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -404,6 +404,10 @@ public class ReadUDPbyUCXMessageThread extends Thread {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (!client.getMap_ucxLogInfoWorkedCalls().containsKey("call")) {
|
||||||
|
// client.getMap_ucxLogInfoWorkedCalls().put(call, workedCall);
|
||||||
|
|
||||||
|
// } else
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* That means, the station is worked already but maybe at another band. So we
|
* That means, the station is worked already but maybe at another band. So we
|
||||||
|
|||||||
@@ -659,27 +659,6 @@ public class ChatMember {
|
|||||||
return band != null && this.tropoSsbMarginDbByBand.containsKey(band);
|
return band != null && this.tropoSsbMarginDbByBand.containsKey(band);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true only when a finite, usable tropo SSB margin is stored for the band.
|
|
||||||
*
|
|
||||||
* <p>This is intentionally different from {@link #hasTropoSsbMarginDb(Band)}:
|
|
||||||
* a stored NaN means that an analysis was attempted but did not produce a usable
|
|
||||||
* link budget. Such failed values should not permanently block later retries.</p>
|
|
||||||
*
|
|
||||||
* @param band band to check
|
|
||||||
* @return true if a finite SSB margin exists
|
|
||||||
*/
|
|
||||||
public boolean hasFiniteTropoSsbMarginDb(Band band) {
|
|
||||||
if (band == null || !this.tropoSsbMarginDbByBand.containsKey(band)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Double storedValue = this.tropoSsbMarginDbByBand.get(band);
|
|
||||||
return storedValue != null && Double.isFinite(storedValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the calculated tropo SSB margin for one band.
|
* Reads the calculated tropo SSB margin for one band.
|
||||||
*
|
*
|
||||||
@@ -699,34 +678,21 @@ public class ChatMember {
|
|||||||
return OptionalDouble.of(storedValue);
|
return OptionalDouble.of(storedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats the calculated tropo margin for direct table display.
|
* Formats the calculated tropo margin for direct table display.
|
||||||
*
|
*
|
||||||
* <p>The method distinguishes three states:
|
|
||||||
* <ul>
|
|
||||||
* <li>{@code ... @144}: analysis has not run yet</li>
|
|
||||||
* <li>{@code ? @144}: analysis ran, but no usable link budget was produced</li>
|
|
||||||
* <li>{@code +8.4 dB @144}: finite SSB margin exists</li>
|
|
||||||
* </ul>
|
|
||||||
*
|
|
||||||
* @param band selected/auto-resolved reachability band
|
* @param band selected/auto-resolved reachability band
|
||||||
* @return display text such as "+8.4 dB @144", "? @144" or "... @144"
|
* @return display text such as "+8.4 dB @144" or "- @144"
|
||||||
*/
|
*/
|
||||||
public String formatTropoSsbMarginForBand(Band band) {
|
public String formatTropoSsbMarginForBand(Band band) {
|
||||||
String bandLabel = band == null ? "?" : band.getDisplayLabel();
|
String bandLabel = band == null ? "?" : band.getDisplayLabel();
|
||||||
|
OptionalDouble marginDb = getTropoSsbMarginDb(band);
|
||||||
|
|
||||||
if (band == null || !this.tropoSsbMarginDbByBand.containsKey(band)) {
|
if (marginDb.isEmpty() || !Double.isFinite(marginDb.getAsDouble())) {
|
||||||
return "... @" + bandLabel;
|
return "- @" + bandLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
Double storedValue = this.tropoSsbMarginDbByBand.get(band);
|
return String.format(Locale.US, "%+.1f dB @%s", marginDb.getAsDouble(), bandLabel);
|
||||||
|
|
||||||
if (storedValue == null || !Double.isFinite(storedValue)) {
|
|
||||||
return "? @" + bandLabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
return String.format(Locale.US, "%+.1f dB @%s", storedValue, bandLabel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -51,21 +51,26 @@ public class GuiUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private static void triggerUpdate(ChatController chatController) {
|
||||||
* Requests a safe UI refresh of the filtered ChatMember list.
|
{
|
||||||
*
|
//trick to trigger gui changes on property changes of obects
|
||||||
* <p>Older versions used the trick of adding/removing a dummy predicate. That can
|
|
||||||
* break JavaFX SortedList internals when the table is sorted and a FilteredList
|
|
||||||
* refilter happens at the same time. The controller-level refresh path is safer
|
|
||||||
* because Kst4ContestApplication now re-applies the existing predicates directly.</p>
|
|
||||||
*
|
|
||||||
* @param chatController central controller
|
|
||||||
*/
|
|
||||||
private static void triggerUpdate(ChatController chatController) {
|
|
||||||
if (chatController == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
chatController.fireUserListUpdate("Forced filtered ChatMember refresh");
|
Predicate<ChatMember> dummyPredicate = new Predicate<ChatMember>() {
|
||||||
}
|
@Override
|
||||||
|
public boolean test(ChatMember chatMember) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* //TODO: following 2 lines are a quick fix to making disappear worked chatmembers of the list
|
||||||
|
* Thats uncomfortable due to this also causes selection changes,
|
||||||
|
* Better way is to change all worked and qrv values to observables and then trigger the underlying
|
||||||
|
* list to fire an invalidationevent. Really Todo!
|
||||||
|
*/
|
||||||
|
chatController.getLst_chatMemberListFilterPredicates().add(dummyPredicate);
|
||||||
|
chatController.getLst_chatMemberListFilterPredicates().remove(dummyPredicate);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,10 +72,6 @@ import kst4contest.view.map.OfflineDemImportService;
|
|||||||
public class Kst4ContestApplication extends Application implements StatusUpdateListener {
|
public class Kst4ContestApplication extends Application implements StatusUpdateListener {
|
||||||
// private static final Kst4ContestApplication dbcontroller = new DBController();
|
// private static final Kst4ContestApplication dbcontroller = new DBController();
|
||||||
// Null means Auto: use the lowest session band, or category fallback.
|
// Null means Auto: use the lowest session band, or category fallback.
|
||||||
|
|
||||||
private PauseTransition userListRefreshCoalescer;
|
|
||||||
private String pendingUserListUpdateReason = "";
|
|
||||||
|
|
||||||
private Band selectedReachabilityBandOverride = null;
|
private Band selectedReachabilityBandOverride = null;
|
||||||
|
|
||||||
private StationMapView stationMapView; //view class for the avl stn map
|
private StationMapView stationMapView; //view class for the avl stn map
|
||||||
@@ -959,7 +955,7 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
return true;
|
return true;
|
||||||
} else return false;
|
} else return false;
|
||||||
} catch (NullPointerException SenderNull) {
|
} catch (NullPointerException SenderNull) {
|
||||||
// System.out.println("KST4ContestApp, <<<catched error>>>: Sender/receiver of the message is unknown, categorizing is impossible: " + SenderNull.getMessage());
|
System.out.println("KST4ContestApp, <<<catched error>>>: Sender/receiver of the message is unknown, categorizing is impossible: " + SenderNull.getMessage());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1044,7 +1040,7 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
} else return false;
|
} else return false;
|
||||||
|
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
// System.out.println("KST4ContestApplication <<<catched ERROR>>>>: cant get sender infos due to sender is not known yet" + exception.getMessage());
|
System.out.println("KST4ContestApplication <<<catched ERROR>>>>: cant get sender infos due to sender is not known yet" + exception.getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1060,31 +1056,6 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Applies the currently selected station filters to the ChatMember FilteredList.
|
|
||||||
*
|
|
||||||
* <p>This replaces the old predicate-property binding. The old binding worked
|
|
||||||
* for normal filter changes, but it became unstable when we tried to force a
|
|
||||||
* refresh by adding/removing a dummy predicate. Calling this method simply
|
|
||||||
* rebuilds the combined predicate and sets it directly on the FilteredList.</p>
|
|
||||||
*/
|
|
||||||
private void applyChatMemberFilterPredicates() {
|
|
||||||
if (chatcontroller == null
|
|
||||||
|| chatcontroller.getLst_chatMemberListFiltered() == null
|
|
||||||
|| chatcontroller.getLst_chatMemberListFilterPredicates() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Predicate<ChatMember> combinedPredicate =
|
|
||||||
chatcontroller.getLst_chatMemberListFilterPredicates()
|
|
||||||
.stream()
|
|
||||||
.reduce(chatMember -> true, Predicate::and);
|
|
||||||
|
|
||||||
chatcontroller.getLst_chatMemberListFiltered().setPredicate(combinedPredicate);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for furtherinfoPane
|
* Helper method for furtherinfoPane
|
||||||
* @param s
|
* @param s
|
||||||
@@ -6420,13 +6391,8 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
"-fx-border-color: lightgrey;");
|
"-fx-border-color: lightgrey;");
|
||||||
|
|
||||||
|
|
||||||
// chatcontroller.getLst_chatMemberListFiltered().predicateProperty().bind(Bindings.createObjectBinding(() -> chatcontroller.getLst_chatMemberListFilterPredicates().stream().reduce(x -> true, Predicate::and), chatcontroller.getLst_chatMemberListFilterPredicates()));
|
chatcontroller.getLst_chatMemberListFiltered().predicateProperty().bind(Bindings.createObjectBinding(() -> chatcontroller.getLst_chatMemberListFilterPredicates().stream().reduce(x -> true, Predicate::and), chatcontroller.getLst_chatMemberListFilterPredicates()));
|
||||||
|
|
||||||
applyChatMemberFilterPredicates();
|
|
||||||
|
|
||||||
chatcontroller.getLst_chatMemberListFilterPredicates().addListener(
|
|
||||||
(ListChangeListener<Predicate<ChatMember>>) change -> applyChatMemberFilterPredicates()
|
|
||||||
);
|
|
||||||
|
|
||||||
TextField chatMemberTableFilterTextField = new TextField("Find...");
|
TextField chatMemberTableFilterTextField = new TextField("Find...");
|
||||||
chatMemberTableFilterTextField.setFocusTraversable(false);
|
chatMemberTableFilterTextField.setFocusTraversable(false);
|
||||||
@@ -6468,9 +6434,7 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
chatcontroller.getLst_chatMemberListFilterPredicates().remove(searchTextPredicate);
|
chatcontroller.getLst_chatMemberListFilterPredicates().remove(searchTextPredicate);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!chatcontroller.getLst_chatMemberListFilterPredicates().contains(searchTextPredicate)) {
|
chatcontroller.getLst_chatMemberListFilterPredicates().add(searchTextPredicate);
|
||||||
chatcontroller.getLst_chatMemberListFilterPredicates().add(searchTextPredicate);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("KST4CApp " + chatMemberTableFilterTextField.textProperty().getValue().equals("") + " / " + !chatMemberTableFilterTextField.focusedProperty().getValue());
|
System.out.println("KST4CApp " + chatMemberTableFilterTextField.textProperty().getValue().equals("") + " / " + !chatMemberTableFilterTextField.focusedProperty().getValue());
|
||||||
@@ -6480,33 +6444,6 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
HBox chatMemberTableFilterWorkedBandFiltersHbx = new HBox();
|
HBox chatMemberTableFilterWorkedBandFiltersHbx = new HBox();
|
||||||
|
|
||||||
|
|
||||||
Button btnCalculateSelectedTropo = new Button("Calc selected");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calculates full terrain/path reachability only for the currently selected
|
|
||||||
* station. This is intentionally operator-triggered to avoid API-limit problems.
|
|
||||||
*/
|
|
||||||
btnCalculateSelectedTropo.setOnAction(new EventHandler<ActionEvent>() {
|
|
||||||
@Override
|
|
||||||
public void handle(ActionEvent event) {
|
|
||||||
ChatMember selectedMember = tbl_chatMember.getSelectionModel().getSelectedItem();
|
|
||||||
|
|
||||||
if (selectedMember == null && chatcontroller.getScoreService() != null) {
|
|
||||||
selectedMember = chatcontroller.getScoreService().getSelectedChatMember();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selectedMember == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Band selectedBand = resolveReachabilityBandForUi(selectedMember);
|
|
||||||
chatcontroller.getReachabilityService().calculateSelectedStationOnDemand(selectedMember, selectedBand);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnCalculateSelectedTropo.setTooltip(new Tooltip("Calculate full Tropo/path analysis for the selected station only"));
|
|
||||||
|
|
||||||
|
|
||||||
ComboBox<String> cmbReachabilityBand = new ComboBox<>();
|
ComboBox<String> cmbReachabilityBand = new ComboBox<>();
|
||||||
cmbReachabilityBand.getItems().add("Auto");
|
cmbReachabilityBand.getItems().add("Auto");
|
||||||
for (Band band : chatcontroller.getReachabilityService().getEnabledStationBands()) {
|
for (Band band : chatcontroller.getReachabilityService().getEnabledStationBands()) {
|
||||||
@@ -6518,26 +6455,16 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
@Override
|
@Override
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
selectedReachabilityBandOverride = parseReachabilityBandSelection(cmbReachabilityBand.getValue());
|
selectedReachabilityBandOverride = parseReachabilityBandSelection(cmbReachabilityBand.getValue());
|
||||||
|
for (ChatMember member : chatcontroller.getLst_chatMemberList()) {
|
||||||
// Changing the display band must not start batch terrain analysis.
|
Band bandToCalculate = resolveReachabilityBandForUi(member);
|
||||||
// Existing cached values are shown; new values are calculated on map click
|
chatcontroller.getReachabilityService().ensureTropoMarginCalculated(member, bandToCalculate);
|
||||||
// or via the explicit "Calc selected" button.
|
}
|
||||||
chatcontroller.fireUserListUpdate("Reachability band changed");
|
chatcontroller.fireUserListUpdate("Reachability band changed");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
chatMemberTableFilterWorkedBandFiltersHbx.getChildren().add(new Label("Reachability:"));
|
chatMemberTableFilterWorkedBandFiltersHbx.getChildren().add(new Label("Reachability:"));
|
||||||
chatMemberTableFilterWorkedBandFiltersHbx.getChildren().add(cmbReachabilityBand);
|
chatMemberTableFilterWorkedBandFiltersHbx.getChildren().add(cmbReachabilityBand);
|
||||||
chatMemberTableFilterWorkedBandFiltersHbx.getChildren().add(btnCalculateSelectedTropo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* In order to work the filters needs the proper band settings, which should be worked
|
|
||||||
*/
|
|
||||||
if (chatcontroller.getReachabilityService().getEnabledStationBands().isEmpty()) {
|
|
||||||
Label bandSetupWarning = new Label("Please enable at least one active station band for New Locator/New Band filters.");
|
|
||||||
bandSetupWarning.setStyle("-fx-text-fill: orange; -fx-font-weight: bold;");
|
|
||||||
chatMemberTableFilterWorkedBandFiltersHbx.getChildren().add(bandSetupWarning);
|
|
||||||
}
|
|
||||||
|
|
||||||
ToggleButton btnTglwkd = new ToggleButton("wkd");
|
ToggleButton btnTglwkd = new ToggleButton("wkd");
|
||||||
|
|
||||||
@@ -9572,43 +9499,16 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUserListUpdated(String reason) {
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
|
||||||
/**
|
// tbl_chatMember.sort();
|
||||||
* Forces the station FilteredList to evaluate all active predicates again.
|
tbl_chatMember.refresh();
|
||||||
*
|
|
||||||
* <p>Several filters depend on mutable ChatMember fields, for example worked
|
|
||||||
* flags, AirScout windows or calculated Tropo values. Updating such fields does
|
|
||||||
* not necessarily create a JavaFX list-change event. Therefore we explicitly
|
|
||||||
* re-apply the combined predicate instead of adding/removing a dummy predicate.
|
|
||||||
* The dummy-predicate trick can corrupt SortedList mapping in JavaFX.</p>
|
|
||||||
*/
|
|
||||||
private void forceChatMemberFilterRefresh() {
|
|
||||||
applyChatMemberFilterPredicates();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
System.out.println("KST4Capp, UI Update Trigger: " + reason);
|
||||||
public void onUserListUpdated(String reason) {
|
});
|
||||||
Platform.runLater(() -> {
|
}
|
||||||
pendingUserListUpdateReason = reason;
|
|
||||||
|
|
||||||
if (userListRefreshCoalescer == null) {
|
|
||||||
userListRefreshCoalescer = new PauseTransition(Duration.millis(300));
|
|
||||||
userListRefreshCoalescer.setOnFinished(event -> {
|
|
||||||
forceChatMemberFilterRefresh();
|
|
||||||
|
|
||||||
if (tbl_chatMember != null) {
|
|
||||||
tbl_chatMember.refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshStationMapIfVisible();
|
|
||||||
|
|
||||||
System.out.println("KST4Capp, UI Update Trigger: " + pendingUserListUpdateReason);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
userListRefreshCoalescer.playFromStart();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// public class MaidenheadLocatorMapPane extends Pane {
|
// public class MaidenheadLocatorMapPane extends Pane {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import javafx.collections.ListChangeListener;
|
|||||||
import javafx.scene.control.TableView;
|
import javafx.scene.control.TableView;
|
||||||
import javafx.util.Duration;
|
import javafx.util.Duration;
|
||||||
import kst4contest.controller.ChatController;
|
import kst4contest.controller.ChatController;
|
||||||
|
import kst4contest.locatorUtils.Location;
|
||||||
import kst4contest.model.ChatMember;
|
import kst4contest.model.ChatMember;
|
||||||
import kst4contest.model.ChatPreferences;
|
import kst4contest.model.ChatPreferences;
|
||||||
|
|
||||||
@@ -14,13 +15,12 @@ import java.util.Comparator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.ThreadFactory;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import kst4contest.model.Band;
|
|
||||||
import java.util.function.Predicate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Synchronizes the application state with the station map window.
|
* Synchronizes the application state with the station map window.
|
||||||
*
|
*
|
||||||
@@ -32,7 +32,7 @@ import java.util.function.Predicate;
|
|||||||
*/
|
*/
|
||||||
public final class StationMapBridge {
|
public final class StationMapBridge {
|
||||||
|
|
||||||
|
private final ExecutorService pathAnalysisExecutor = Executors.newSingleThreadExecutor(new PathAnalysisThreadFactory());
|
||||||
private final AtomicLong pathAnalysisGeneration = new AtomicLong(0);
|
private final AtomicLong pathAnalysisGeneration = new AtomicLong(0);
|
||||||
|
|
||||||
private final ChatController chatController;
|
private final ChatController chatController;
|
||||||
@@ -45,7 +45,8 @@ public final class StationMapBridge {
|
|||||||
|
|
||||||
|
|
||||||
private final MapCallsignRawSnapshotBuilder snapshotBuilder = new MapCallsignRawSnapshotBuilder();
|
private final MapCallsignRawSnapshotBuilder snapshotBuilder = new MapCallsignRawSnapshotBuilder();
|
||||||
|
// private final OfflineDemManager offlineDemManager = new OfflineDemManager();
|
||||||
|
private final PathAnalysisService pathAnalysisService;
|
||||||
|
|
||||||
private String lastPathAnalysisRequestSignature = "";
|
private String lastPathAnalysisRequestSignature = "";
|
||||||
|
|
||||||
@@ -63,7 +64,9 @@ public final class StationMapBridge {
|
|||||||
|
|
||||||
this.refreshCoalescer.setOnFinished(event -> refreshNow());
|
this.refreshCoalescer.setOnFinished(event -> refreshNow());
|
||||||
|
|
||||||
|
this.pathAnalysisService = new GeometryOnlyPathAnalysisService(
|
||||||
|
new OpenMeteoTerrainProfileProvider()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void install() {
|
public void install() {
|
||||||
@@ -82,10 +85,6 @@ public final class StationMapBridge {
|
|||||||
(obs, oldValue, newValue) -> scheduleRefresh()
|
(obs, oldValue, newValue) -> scheduleRefresh()
|
||||||
);
|
);
|
||||||
|
|
||||||
chatController.getLst_chatMemberListFilterPredicates().addListener(
|
|
||||||
(ListChangeListener<Predicate<ChatMember>>) change -> requestImmediateRefresh()
|
|
||||||
);
|
|
||||||
|
|
||||||
requestImmediateRefresh();
|
requestImmediateRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,17 +170,6 @@ public final class StationMapBridge {
|
|||||||
requestPathAnalysisAsync(preferences.getStn_loginLocatorMainCat(), selectedSnapshot);
|
requestPathAnalysisAsync(preferences.getStn_loginLocatorMainCat(), selectedSnapshot);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Requests the selected station path analysis through the central reachability
|
|
||||||
* service.
|
|
||||||
*
|
|
||||||
* <p>The map no longer owns a separate PathAnalysisService. This ensures that
|
|
||||||
* the map detail panel, the Tropo table column and the station filters all use
|
|
||||||
* exactly the same path/link-budget calculation.</p>
|
|
||||||
*
|
|
||||||
* @param ownLocator6 own locator from preferences
|
|
||||||
* @param selectedSnapshot selected map marker snapshot
|
|
||||||
*/
|
|
||||||
private void requestPathAnalysisAsync(String ownLocator6, MapCallsignRawSnapshot selectedSnapshot) {
|
private void requestPathAnalysisAsync(String ownLocator6, MapCallsignRawSnapshot selectedSnapshot) {
|
||||||
String normalizedOwnLocator6 = normalizeLocator6(ownLocator6);
|
String normalizedOwnLocator6 = normalizeLocator6(ownLocator6);
|
||||||
|
|
||||||
@@ -214,28 +202,20 @@ public final class StationMapBridge {
|
|||||||
PathAnalysisResult.loading(normalizedOwnLocator6, normalizedTargetLocator6, targetCallsignRaw)
|
PathAnalysisResult.loading(normalizedOwnLocator6, normalizedTargetLocator6, targetCallsignRaw)
|
||||||
);
|
);
|
||||||
|
|
||||||
ChatMember selectedMember = resolveBestChatMember(targetCallsignRaw);
|
pathAnalysisExecutor.submit(() -> {
|
||||||
|
PathAnalysisResult result = buildPathAnalysisResult(normalizedOwnLocator6, selectedSnapshot);
|
||||||
|
|
||||||
chatController.getReachabilityService().requestPathAnalysisForMap(
|
Platform.runLater(() -> {
|
||||||
selectedMember,
|
if (generation != pathAnalysisGeneration.get()) {
|
||||||
selectedSnapshot,
|
return;
|
||||||
result -> {
|
|
||||||
if (generation != pathAnalysisGeneration.get()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
stationMapView.setPathAnalysisResult(result);
|
|
||||||
}
|
}
|
||||||
);
|
stationMapView.setPathAnalysisResult(result);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Invalidates pending map callbacks.
|
|
||||||
*
|
|
||||||
* <p>The actual calculation executor is owned by ReachabilityService now, so
|
|
||||||
* this bridge no longer shuts down any path-analysis thread directly.</p>
|
|
||||||
*/
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
pathAnalysisGeneration.incrementAndGet();
|
pathAnalysisExecutor.shutdownNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleMapCallsignSelection(String callSignRaw) {
|
private void handleMapCallsignSelection(String callSignRaw) {
|
||||||
@@ -306,6 +286,43 @@ public final class StationMapBridge {
|
|||||||
return callSignRaw.trim().toUpperCase(Locale.ROOT);
|
return callSignRaw.trim().toUpperCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private PathAnalysisResult buildPathAnalysisResult(String ownLocator6, MapCallsignRawSnapshot selectedSnapshot) {
|
||||||
|
String normalizedOwnLocator6 = normalizeLocator6(ownLocator6);
|
||||||
|
|
||||||
|
if (selectedSnapshot == null) {
|
||||||
|
return PathAnalysisResult.waitingForSelection(normalizedOwnLocator6);
|
||||||
|
}
|
||||||
|
|
||||||
|
String normalizedTargetLocator6 = normalizeLocator6(selectedSnapshot.locator6());
|
||||||
|
|
||||||
|
if (normalizedOwnLocator6.length() != 6) {
|
||||||
|
return PathAnalysisResult.waitingForValidHomeLocator(normalizedOwnLocator6, normalizedTargetLocator6);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!selectedSnapshot.hasUsablePosition()) {
|
||||||
|
return PathAnalysisResult.waitingForValidTarget(normalizedOwnLocator6, normalizedTargetLocator6);
|
||||||
|
}
|
||||||
|
|
||||||
|
Location homeLocation = new Location(normalizedOwnLocator6);
|
||||||
|
double analysisFrequencyMHz = resolveAnalysisFrequencyMHz(selectedSnapshot);
|
||||||
|
|
||||||
|
PathAnalysisRequest request = new PathAnalysisRequest(
|
||||||
|
normalizedOwnLocator6,
|
||||||
|
homeLocation.getLatitude().toDegrees(),
|
||||||
|
homeLocation.getLongitude().toDegrees(),
|
||||||
|
selectedSnapshot.callSignRaw(),
|
||||||
|
normalizedTargetLocator6,
|
||||||
|
selectedSnapshot.latitudeDeg(),
|
||||||
|
selectedSnapshot.longitudeDeg(),
|
||||||
|
analysisFrequencyMHz,
|
||||||
|
chatController.getChatPreferences().getStn_pathAnalysisOwnAntennaHeightMeters(),
|
||||||
|
chatController.getChatPreferences().getStn_pathAnalysisDefaultTargetAntennaHeightMeters(),
|
||||||
|
PathGeometryUtils.DEFAULT_EFFECTIVE_EARTH_RADIUS_FACTOR,
|
||||||
|
chatController.getChatPreferences().buildPathLinkBudgetSettings()
|
||||||
|
);
|
||||||
|
|
||||||
|
return pathAnalysisService.analyze(request);
|
||||||
|
}
|
||||||
|
|
||||||
private double resolveAnalysisFrequencyMHz(MapCallsignRawSnapshot selectedSnapshot) {
|
private double resolveAnalysisFrequencyMHz(MapCallsignRawSnapshot selectedSnapshot) {
|
||||||
if (selectedSnapshot == null) {
|
if (selectedSnapshot == null) {
|
||||||
@@ -359,5 +376,12 @@ public final class StationMapBridge {
|
|||||||
return locator.trim().toUpperCase(Locale.ROOT);
|
return locator.trim().toUpperCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final class PathAnalysisThreadFactory implements ThreadFactory {
|
||||||
|
@Override
|
||||||
|
public Thread newThread(Runnable runnable) {
|
||||||
|
Thread thread = new Thread(runnable, "station-map-path-analysis");
|
||||||
|
thread.setDaemon(true);
|
||||||
|
return thread;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2370,4 +2370,3 @@ DO5SA;unknown;unknown;StringProperty [value: null]; wkd true; wkd144 true; wkd43
|
|||||||
9A2HM;unknown;unknown;StringProperty [value: null]; wkd true; wkd144 false; wkd432false; wkd1240false; wkd2300false; wkd3400false; wkd5600false; wkd10Gfalse ; null
|
9A2HM;unknown;unknown;StringProperty [value: null]; wkd true; wkd144 false; wkd432false; wkd1240false; wkd2300false; wkd3400false; wkd5600false; wkd10Gfalse ; null
|
||||||
9A2HM;null;null;StringProperty [value: null]; wkd true; wkd144 false; wkd432true; wkd1240false; wkd2300false; wkd3400false; wkd5600false; wkd10Gfalse ; null
|
9A2HM;null;null;StringProperty [value: null]; wkd true; wkd144 false; wkd432true; wkd1240false; wkd2300false; wkd3400false; wkd5600false; wkd10Gfalse ; null
|
||||||
9A2HM;null;null;StringProperty [value: null]; wkd true; wkd144 false; wkd432false; wkd1240false; wkd2300true; wkd3400false; wkd5600false; wkd10Gfalse ; null
|
9A2HM;null;null;StringProperty [value: null]; wkd true; wkd144 false; wkd432false; wkd1240false; wkd2300true; wkd3400false; wkd5600false; wkd10Gfalse ; null
|
||||||
OV3T;Thomas;JO46CM;StringProperty [value: null]; wkd true; wkd144 true; wkd432false; wkd1240false; wkd2300false; wkd3400false; wkd5600false; wkd10Gfalse ; 2: 144/432 MHz
|
|
||||||
Reference in New Issue
Block a user