Add signal id to GSV

This commit is contained in:
Morten Nielsen 2020-09-23 20:44:33 -07:00
parent 84bb5f5118
commit abf660df7e
5 changed files with 238 additions and 13 deletions

View file

@ -54,8 +54,30 @@
BorderBrush="Black"
Margin="5,0" Width="20"
BorderThickness="1"
ToolTip="{Binding SignalToNoiseRatio}"
VerticalAlignment="Bottom">
<Border.ToolTip>
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="System: " />
<TextBlock Text="{Binding Converter={StaticResource heightconv}, ConverterParameter=Name}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Azimuth: " />
<TextBlock Text="{Binding Azimuth}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Elevation: " />
<TextBlock Text="{Binding Elevation}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="SNR: " />
<TextBlock Text="{Binding SignalToNoiseRatio}" />
<TextBlock Text="dB" />
</StackPanel>
</StackPanel>
</Border.ToolTip>
<Border.Background>
<SolidColorBrush Color="{Binding Converter={StaticResource conv}}" />
</Border.Background>

View file

@ -27,10 +27,10 @@ namespace SampleApp.WinDesktop
{
InitializeComponent();
}
Dictionary<Talker, Gsv> messages = new Dictionary<Talker, Gsv>();
Dictionary<string, Gsv> messages = new Dictionary<string, Gsv>();
public void SetGsv(Gsv message)
{
messages[message.TalkerId] = message;
messages[message.TalkerId + "+" + message.GnssSignalId] = message;
UpdateSatellites();
}
public void ClearGsv()
@ -41,16 +41,128 @@ namespace SampleApp.WinDesktop
private void UpdateSatellites()
{
satellites.ItemsSource = messages.Values.SelectMany(g => g.SVs);
}
}
satellites.ItemsSource = messages.Values.SelectMany(g => g.SVs).OrderBy(s=>s.GnssSignalId).OrderBy(s => s.Id).OrderByDescending(s => s.TalkerId);
}
internal static string SignalIdToName(char signalId, Talker talkerId)
{
if (signalId != '0')
{
var talker = talkerId;
if (talker == Talker.GlobalPositioningSystem)
{
switch (signalId)
{
case '1': return "L1 C/A";
case '2': return "L1 P(Y)";
case '3': return "L1 M";
case '4': return "L2 P(Y)";
case '5': return "L2C-M";
case '6': return "L2C-L";
case '7': return "L5-I";
case '8': return "L5-Q";
}
}
else if (talker == Talker.GlonassReceiver)
{
switch (signalId)
{
case '1': return "G1 C/A";
case '2': return "G1 P";
case '3': return "G2 C/A";
case '4': return "GLONASS (M) G2 P";
}
}
else if (talker == Talker.GalileoPositioningSystem)
{
switch (signalId)
{
case '1': return "E5a";
case '2': return "E5b";
case '3': return "E5 a+b";
case '4': return "E6-A";
case '5': return "E6-BC";
case '6': return "L1-A";
case '7': return "L1-BC";
}
}
else if (talker == Talker.BeiDouNavigationSatelliteSystem)
{
switch (signalId)
{
case '1': return "B1I";
case '2': return "B1Q";
case '3': return "B1C";
case '4': return "B1A";
case '5': return "B2-a";
case '6': return "B2-b";
case '7': return "B2 a+b";
case '8': return "B3I";
case '9': return "B3Q";
case 'A': return "B3A";
case 'B': return "B2I";
case 'C': return "B2Q";
}
}
else if (talker == Talker.QuasiZenithSatelliteSystem)
{
switch (signalId)
{
case '1': return "L1 C/A";
case '2': return "L1C (D)";
case '3': return "L1C (P)";
case '4': return "LIS";
case '5': return "L2C-M";
case '6': return "L2C-L";
case '7': return "L5-I";
case '8': return "L5-Q";
case '9': return "L6D";
case 'A': return "L6E";
}
}
else if (talker == Talker.IndianRegionalNavigationSatelliteSystem)
{
switch (signalId)
{
case '1': return "L5-SPS";
case '2': return "S-SPS<";
case '3': return "L5-RS";
case '4': return "S-RS";
case '5': return "L1-SPS";
}
}
}
return string.Empty;
}
}
public class SnrToHeightConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if(value is SatelliteVehicle sv)
{
return Math.Max(10, sv.SignalToNoiseRatio * 2);
if (parameter as string == "Name")
{
string name;
if (sv.TalkerId == Talker.GlobalPositioningSystem)
name = "GPS";
else if (sv.TalkerId == Talker.GlonassReceiver)
name = "GLONASS";
else if (sv.TalkerId == Talker.BeiDouNavigationSatelliteSystem)
name = "BeiDou";
else if (sv.TalkerId == Talker.QuasiZenithSatelliteSystem)
name = "QZSS";
else if (sv.TalkerId == Talker.IndianRegionalNavigationSatelliteSystem)
name = "NavIC IRNSS";
else
name = sv.TalkerId.ToString();
var signalName = SatelliteSnr.SignalIdToName(sv.GnssSignalId, sv.TalkerId);
if (!string.IsNullOrEmpty(signalName))
name += " (" + signalName + ")";
return name;
}
else
return Math.Max(10, sv.SignalToNoiseRatio * 2);
}
return value;
}

View file

@ -27,10 +27,10 @@ namespace SampleApp.WinDesktop
{
InitializeComponent();
}
Dictionary<Talker, Gsv> messages = new Dictionary<Talker, Gsv>();
Dictionary<string, Gsv> messages = new Dictionary<string, Gsv>();
public void SetGsv(Gsv message)
{
messages[message.TalkerId] = message;
messages[message.TalkerId + "+" + message.GnssSignalId] = message;
UpdateSatellites();
}
public void ClearGsv()