Mirror a radio from another computer's broadcast data
Listen for Radio broadcast data from another Nonemm or N1MM computer and record its frequency, mode and split as this computer's own radio. No radio is controlled. The settings are in the Configure Radios dialog. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,21 @@
|
||||
<TextBox Name="BoxPortBox" />
|
||||
<TextBlock TextWrapping="Wrap" FontSize="11" Opacity="0.75" Margin="0,8,0,0"
|
||||
Text="With a second radio the station is SO2R: both are read and both show on the bandmap, but only the one you are on drives the entry window. Ctrl+Tab moves you to the other, and Ctrl+Shift+Tab puts both in the headphones. An OTRSP box follows, routing the key and the headphones." />
|
||||
<Separator Margin="0,10,0,4" />
|
||||
<TextBlock TextWrapping="Wrap" FontSize="11" Opacity="0.75"
|
||||
Text="Mirror a radio: record the frequency, mode and split of a radio on another Nonemm or N1MM computer as this computer's own, when this computer has no port to the radio. The other computer must send Radio data to this computer (Config > Broadcast Data). Nothing is sent back, and no radio is controlled." />
|
||||
<CheckBox Name="MirrorEnabledCheck" Content="Mirror a radio from another computer" />
|
||||
<Grid ColumnDefinitions="200,*" RowDefinitions="Auto,Auto,Auto,Auto" RowSpacing="6">
|
||||
<TextBlock Text="UDP port to listen on" VerticalAlignment="Center" />
|
||||
<TextBox Name="MirrorPortBox" Grid.Column="1" />
|
||||
<TextBlock Grid.Row="1" Text="Computer name (empty: any)" VerticalAlignment="Center" />
|
||||
<TextBox Name="MirrorStationBox" Grid.Row="1" Grid.Column="1" />
|
||||
<TextBlock Grid.Row="2" Text="Radio on the other computer" VerticalAlignment="Center" />
|
||||
<TextBox Name="MirrorSourceBox" Grid.Row="2" Grid.Column="1" />
|
||||
<TextBlock Grid.Row="3" Text="Radio on this computer" VerticalAlignment="Center" />
|
||||
<TextBox Name="MirrorTargetBox" Grid.Row="3" Grid.Column="1" />
|
||||
</Grid>
|
||||
<TextBlock Name="ProblemText" TextWrapping="Wrap" Foreground="OrangeRed" IsVisible="False" />
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Spacing="6" Margin="0,8,0,0">
|
||||
<Button Content="Cancel" Click="OnCancel" />
|
||||
<Button Content="Save" Click="OnSave" IsDefault="True" />
|
||||
|
||||
@@ -4,7 +4,7 @@ using Nonemm.App.Configuration;
|
||||
|
||||
namespace Nonemm.App.Dialogs;
|
||||
|
||||
/// The radios on the desk, one rigctld each.
|
||||
/// The radios on the desk, one rigctld each, and the radio mirror.
|
||||
public sealed partial class RadioDialog : Window
|
||||
{
|
||||
private const int DefaultPort = 4532;
|
||||
@@ -18,6 +18,11 @@ public sealed partial class RadioDialog : Window
|
||||
Show(0, HostBox, PortBox, EnabledBox);
|
||||
Show(1, SecondHostBox, SecondPortBox, SecondEnabledBox);
|
||||
BoxPortBox.Text = settings.So2rBoxPort;
|
||||
MirrorEnabledCheck.IsChecked = settings.MirrorRadioEnabled;
|
||||
MirrorPortBox.Text = settings.MirrorRadioPort.ToString();
|
||||
MirrorStationBox.Text = settings.MirrorRadioStation;
|
||||
MirrorSourceBox.Text = settings.MirrorRadioSource.ToString();
|
||||
MirrorTargetBox.Text = settings.MirrorRadioTarget.ToString();
|
||||
}
|
||||
|
||||
private void Show(int at, TextBox host, TextBox port, CheckBox enabled)
|
||||
@@ -30,15 +35,40 @@ public sealed partial class RadioDialog : Window
|
||||
enabled.IsChecked = radio.IsEnabled;
|
||||
}
|
||||
|
||||
private void OnSave(object? sender, RoutedEventArgs e) => Close(settings with
|
||||
private void OnSave(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
Radios =
|
||||
[
|
||||
Read(HostBox, PortBox, EnabledBox),
|
||||
Read(SecondHostBox, SecondPortBox, SecondEnabledBox),
|
||||
],
|
||||
So2rBoxPort = (BoxPortBox.Text ?? "").Trim(),
|
||||
});
|
||||
List<string> problems = [];
|
||||
if (!int.TryParse(MirrorPortBox.Text, out int mirrorPort) || mirrorPort is < 1 or > 65535)
|
||||
{
|
||||
problems.Add("The mirror port must be a number from 1 to 65535.");
|
||||
}
|
||||
bool isSourceValid = int.TryParse(MirrorSourceBox.Text, out int source) && source is 1 or 2;
|
||||
bool isTargetValid = int.TryParse(MirrorTargetBox.Text, out int target) && target is 1 or 2;
|
||||
if (!isSourceValid || !isTargetValid)
|
||||
{
|
||||
problems.Add("The mirror radio numbers must be 1 or 2.");
|
||||
}
|
||||
if (problems.Count > 0)
|
||||
{
|
||||
ProblemText.Text = string.Join("\n", problems);
|
||||
ProblemText.IsVisible = true;
|
||||
return;
|
||||
}
|
||||
Close(settings with
|
||||
{
|
||||
Radios =
|
||||
[
|
||||
Read(HostBox, PortBox, EnabledBox),
|
||||
Read(SecondHostBox, SecondPortBox, SecondEnabledBox),
|
||||
],
|
||||
So2rBoxPort = (BoxPortBox.Text ?? "").Trim(),
|
||||
MirrorRadioEnabled = MirrorEnabledCheck.IsChecked == true,
|
||||
MirrorRadioPort = mirrorPort,
|
||||
MirrorRadioStation = (MirrorStationBox.Text ?? "").Trim(),
|
||||
MirrorRadioSource = source,
|
||||
MirrorRadioTarget = target,
|
||||
});
|
||||
}
|
||||
|
||||
private static StoredRadio Read(TextBox host, TextBox port, CheckBox enabled) => new()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user