forked from N0BOY/FT8CN
-
Notifications
You must be signed in to change notification settings - Fork 3
Honor WSJT-X Reply df on Android (answer on the requested audio tone) #563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
patrickrb
merged 2 commits into
dev
from
optio/task-5f39a1ad-a8cc-414c-a9d1-3c9f62f9edee
Jul 13, 2026
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
ft8af/app/src/test/java/com/k1af/ft8af/ReplyTxFrequencyTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| package com.k1af.ft8af; | ||
|
|
||
| import static com.google.common.truth.Truth.assertThat; | ||
|
|
||
| import org.junit.Test; | ||
|
|
||
| /** | ||
| * Unit tests for {@link MainViewModel#replyTxFrequencyHz} — the bound applied to the | ||
| * (untrusted) audio frequency a WSJT-X companion asks us to answer on via an inbound | ||
| * Reply request's {@code df} field. A plausible df is honored so we key up on the | ||
| * requested tone; anything non-positive or beyond the audio passband is ignored so a | ||
| * malformed/garbled UDP datagram can never push the TX tone off the band. | ||
| */ | ||
| public class ReplyTxFrequencyTest { | ||
|
|
||
| private static final int MAX = GeneralVariables.MAX_SPECTRUM_WIDTH_HZ; // 5000 | ||
|
|
||
| @Test | ||
| public void midBandFrequency_isHonored() { | ||
| assertThat(MainViewModel.replyTxFrequencyHz(1500, MAX)).isEqualTo(1500); | ||
| } | ||
|
|
||
| @Test | ||
| public void lowestValidFrequency_isHonored() { | ||
| assertThat(MainViewModel.replyTxFrequencyHz(1, MAX)).isEqualTo(1); | ||
| } | ||
|
|
||
| @Test | ||
| public void maxFrequency_isHonored() { | ||
| assertThat(MainViewModel.replyTxFrequencyHz(MAX, MAX)).isEqualTo(MAX); | ||
| } | ||
|
patrickrb marked this conversation as resolved.
Outdated
|
||
|
|
||
| @Test | ||
| public void zeroFrequency_keepsCurrent() { | ||
| // df == 0 means "unspecified" in the WSJT-X message. | ||
| assertThat(MainViewModel.replyTxFrequencyHz(0, MAX)).isEqualTo(-1); | ||
| } | ||
|
|
||
| @Test | ||
| public void negativeFrequency_keepsCurrent() { | ||
| // A hostile/garbled df decoded as a negative int must be ignored. | ||
| assertThat(MainViewModel.replyTxFrequencyHz(-200, MAX)).isEqualTo(-1); | ||
| } | ||
|
|
||
| @Test | ||
| public void aboveMax_keepsCurrent() { | ||
| // Beyond the widest possible audio passband — can't be tuned; ignore it. | ||
| assertThat(MainViewModel.replyTxFrequencyHz(MAX + 1, MAX)).isEqualTo(-1); | ||
| assertThat(MainViewModel.replyTxFrequencyHz(50_000, MAX)).isEqualTo(-1); | ||
| } | ||
|
patrickrb marked this conversation as resolved.
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.