From e543e40e1768e9f2280cf1139d890be02d953a36 Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Sat, 22 Mar 2025 07:56:50 -0400 Subject: [PATCH] add support to indicate the Tx mode of a channel (RED for CLEAR, ORANGE for ENC); remove PTT button from PLAYBACK widget (the playback widget shouldn't have a PTT, it is confusing); --- dvmconsole/Controls/ChannelBox.xaml.cs | 21 ++++++++++++++++++++- dvmconsole/MainWindow.xaml.cs | 4 +++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/dvmconsole/Controls/ChannelBox.xaml.cs b/dvmconsole/Controls/ChannelBox.xaml.cs index e8c4b05..4e58d4e 100644 --- a/dvmconsole/Controls/ChannelBox.xaml.cs +++ b/dvmconsole/Controls/ChannelBox.xaml.cs @@ -148,6 +148,11 @@ namespace dvmconsole.Controls /// public bool IsReceivingEncrypted { get; set; } = false; + /// + /// Flag indicating whether or not the console is transmitting with encryption. + /// + public bool IsTxEncrypted { get; set; } = false; + /// /// Last Source ID received. /// @@ -446,13 +451,27 @@ namespace dvmconsole.Controls VolumeSlider.IsEnabled = false; } + /// + /// Helper to hide the PTT button. + /// + public void HidePTTButton() + { + PttButton.IsEnabled = false; + PttButton.Visibility = Visibility.Hidden; + } + /// /// /// private void UpdatePTTColor() { if (PttState) - PttButton.Background = RED_GRADIENT; + { + if (IsTxEncrypted) + PttButton.Background = ORANGE_GRADIENT; + else + PttButton.Background = RED_GRADIENT; + } else PttButton.Background = GRAY_GRADIENT; } diff --git a/dvmconsole/MainWindow.xaml.cs b/dvmconsole/MainWindow.xaml.cs index c780263..c828734 100644 --- a/dvmconsole/MainWindow.xaml.cs +++ b/dvmconsole/MainWindow.xaml.cs @@ -416,6 +416,8 @@ namespace dvmconsole { ChannelBox channelBox = new ChannelBox(selectedChannelsManager, audioManager, channel.Name, channel.System, channel.Tgid, settingsManager.TogglePTTMode); channelBox.ChannelMode = channel.Mode.ToUpperInvariant(); + if (channel.GetAlgoId() != P25Defines.P25_ALGO_UNENCRYPT && channel.GetKeyId() > 0) + channelBox.IsTxEncrypted = true; systemStatuses.Add(channel.Name, new SlotStatus()); @@ -487,6 +489,7 @@ namespace dvmconsole // initialize the playback channel playbackChannelBox = new ChannelBox(selectedChannelsManager, audioManager, PLAYBACKCHNAME, PLAYBACKSYS, PLAYBACKTG); playbackChannelBox.ChannelMode = "Local"; + playbackChannelBox.HidePTTButton(); // playback box shouldn't have PTT if (settingsManager.ChannelPositions.TryGetValue(PLAYBACKCHNAME, out var pos)) { @@ -499,7 +502,6 @@ namespace dvmconsole Canvas.SetTop(playbackChannelBox, offsetY); } - playbackChannelBox.PTTButtonClicked += ChannelBox_PTTButtonClicked; playbackChannelBox.PageButtonClicked += ChannelBox_PageButtonClicked; playbackChannelBox.HoldChannelButtonClicked += ChannelBox_HoldChannelButtonClicked;