Skip to content
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

Add an auto-set listen mode setting to status actions #298

Merged
merged 3 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 23 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ After installation the plugin actions are available under the TrackAudio categor
## Configuring a station status action

The station status action displays the current status of a single station's button in TrackAudio, including
whether communication is currently active. Pressing the action will toggle the equivalent button in TrackAudio,
whether communication is currently active. It also automatically adds the station to TrackAudio after
a voice connection is established.

Pressing the action will toggle the equivalent button in TrackAudio,
convenient for listening to other frequencies while controlling with the ability to quickly turn off listening
to those frequencies when things get busy. A long press of the action will refresh the action's state.

Expand All @@ -52,27 +55,30 @@ configure the station status action like this to show that RX is enabled and the

### Station status settings <!-- omit from toc -->

| Setting | Description | Default |
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| Title | The title to show on the action. Optional. | Station callsign and listen to value |
| Callsign | The callsign for the station you want to display status for. Required. | |
| Listen to | What status to display on the button, either RX, TX, or XCA. Required. | RX |
| Last received callsigns | Sets the number of last received callsigns to display, newest to oldest, and will age off after five minutes. Only supported when listen to is set to `RX` or `XCA`. If set to `0` no last received callsigns will be shown. | `0` |
| Active comms | The image to display when a transmission is actively taking place. Optional. | ![Orange background](docs/images/stationstatus-receiving.png) |
| Blocked | The image to display when both an aircraft and the ATC position are transmitting at the same time. Optional. | ![Green/orange gradient background](docs/images/stationstatus-blocked.png) |
| Listening | The image to display when the station is active. Optional. | ![Green background](docs/images/stationstatus-listening.png) |
| Not listening | The image to display when the station is not currently active. Optional. | ![Black background](docs/images/stationstatus-notlistening.png) |
| Unavailable | The image to display when the station is not added in TrackAudio. Optional, defaults to a warning icon. | ![Warning icon](docs/images/stationstatus-unavailable.png) |
| Show callsign | Show the callsign on the action. | false |
| Show frequency | Show the callsign's frequency on the action. | false |
| Show listen to | Show the listen to value on the action. | false |
| Show title | Show the title on the action. | true |
| Clear callsigns after (minutes) | How long to leave callsigns displayed before they age off. Set to 0 to persist callsigns until they are pushed by newer callsigns. | 3 minutes |
| Setting | Description | Default |
| --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| Title | The title to show on the action. Optional. | Station callsign and listen to value |
| Callsign | The callsign for the station you want to display status for. Required. | |
| Listen to | What status to display on the button, either RX, TX, or XCA. Required. | RX |
| Last received callsigns | Sets the number of last received callsigns to display, newest to oldest, and will age off after five minutes. Only supported when listen to is set to `RX` or `XCA`. If set to `0` no last received callsigns will be shown. | `0` |
| Active comms | The image to display when a transmission is actively taking place. Optional. | ![Orange background](docs/images/stationstatus-receiving.png) |
| Blocked | The image to display when both an aircraft and the ATC position are transmitting at the same time. Optional. | ![Green/orange gradient background](docs/images/stationstatus-blocked.png) |
| Listening | The image to display when the station is active. Optional. | ![Green background](docs/images/stationstatus-listening.png) |
| Not listening | The image to display when the station is not currently active. Optional. | ![Black background](docs/images/stationstatus-notlistening.png) |
| Unavailable | The image to display when the station is not added in TrackAudio. Optional, defaults to a warning icon. | ![Warning icon](docs/images/stationstatus-unavailable.png) |
| Automatically enable speaker mode | Enables speaker mode on the station after a TrackAudio voice connection is established | false |
| Automatically set Rx mode | Enables Rx mode on the station after a TrackAudio voice connection is established | false |
| Show callsign | Show the callsign on the action. | false |
| Show frequency | Show the callsign's frequency on the action. | false |
| Show listen to | Show the listen to value on the action. | false |
| Show title | Show the title on the action. | true |
| Clear callsigns after (minutes) | How long to leave callsigns displayed before they age off. Set to 0 to persist callsigns until they are pushed by newer callsigns. | 3 minutes |

## Configuring a hotline action

The hotline action provides a quick way to toggle between two stations for voice transmissions. This is typically
used by center controllers who have a hotline frequency established with neighbouring sectors.
It also automatically adds the primary and hotline stations to TrackAudio after a voice connection is established.

To use the hotline action start by adding the appropriate stations to TrackAudio. Your primary station should
be added with `XCA` enabled and the hotline station should be added with `RX` enabled. Then configure the
Expand Down
6 changes: 6 additions & 0 deletions com.neil-enns.trackaudio.sdPlugin/pi/stationStatus.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@
label="Automatically enable speaker mode"
></sdpi-checkbox>

<summary>Advanced options</summary>
<sdpi-checkbox
setting="autoSetRx"
label="Automatically set Rx mode"
></sdpi-checkbox>

<sdpi-checkbox
setting="showCallsign"
label="Show callsign"
Expand Down
3 changes: 2 additions & 1 deletion src/actions/stationStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ export class StationStatus extends SingletonAction<StationSettings> {
}

export interface StationSettings {
autoSetSpk?: boolean;
autoSetListen?: boolean;
autoSetRx?: boolean;
blockedCommsImagePath?: string;
activeCommsImagePath?: string;
callsign?: string;
Expand Down
9 changes: 8 additions & 1 deletion src/controllers/stationStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,17 @@ export class StationStatusController extends BaseController {
/**
* Returns the autoSetSpk setting, or false if undefined.
*/
get autoAddSpk() {
get autoSetSpk() {
return this.settings.autoSetSpk ?? false;
}

/**
* Returns the autoSetRx setting, or false if undefined.
*/
get autoSetRx() {
return this.settings.autoSetRx ?? false;
}

/**
* Returns the showTitle setting, or true if undefined.
*/
Expand Down
6 changes: 4 additions & 2 deletions src/managers/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -499,15 +499,17 @@ class ActionManager extends EventEmitter {
this.getStationStatusControllers()
.filter((entry) => entry.frequency === frequency)
.forEach((entry) => {
// Set up the base message to send.
const update = {
type: "kSetStationState",
value: {
frequency: entry.frequency,
headset: !entry.autoAddSpk, // Headset is the opposite of speaker, so invert the value
headset: entry.autoSetSpk ? false : undefined, // Headset is the opposite of speaker, so use false to turn on speaker.
rx: entry.autoSetRx ? true : undefined,
},
} as SetStationState;

if (entry.settings.autoSetSpk) {
if (entry.autoSetSpk || entry.autoSetRx) {
trackAudioManager.sendMessage(update);
}
});
Expand Down