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;