Skip to content

Commit

Permalink
feat(comnav): override NmeaGsv sat Id for ComNav device
Browse files Browse the repository at this point in the history
  • Loading branch information
malobanov committed Sep 16, 2023
1 parent 775a663 commit 580cfa1
Showing 1 changed file with 33 additions and 4 deletions.
37 changes: 33 additions & 4 deletions src/Asv.Gnss/Devices/ComNav/ComNavDeviceHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,14 @@ public static async Task SetBaseStationSettings(this IComNavDevice device, doubl
await device.Push(new ComNavSaveConfigCommand(), cancel).ConfigureAwait(false);
}

public static async Task SetRoverSettings(this IComNavDevice device, CancellationToken cancel = default)
public static Task SetRoverSettings(this IComNavDevice device, CancellationToken cancel = default)
{

return Task.CompletedTask;
}

private static ComNavSatelliteSystemEnum? GetSatelliteSystemFromNmeaGsa(int prn)
private static ComNavSatelliteSystemEnum? GetSatelliteSystemFromNmeaGsa(int satId)
{
return prn switch
return satId switch
{
>= 1 and <= 32 => ComNavSatelliteSystemEnum.GPS,
>= 38 and <= 61 => ComNavSatelliteSystemEnum.GLONASS,
Expand All @@ -178,5 +178,34 @@ public static async Task SetRoverSettings(this IComNavDevice device, Cancellatio
};
}


public static bool GetPrnFromNmeaGsvSatId(this IComNavDevice device, int satId, out int PRN, out NmeaNavigationSystemEnum nav)
{
nav = NmeaNavigationSystemEnum.SYS_NONE;
PRN = -1;
if (satId <= 0) return false;

switch (satId)
{
case >= 1 and <= 32:
nav = NmeaNavigationSystemEnum.SYS_GPS;
PRN = satId;
return true;
case >= 38 and <= 61:
nav = NmeaNavigationSystemEnum.SYS_GLO;
PRN = satId - 37;
return true;
case >= 71 and <= 106:
nav = NmeaNavigationSystemEnum.SYS_GAL;
PRN = satId - 70;
return true;
case >= 141 and <= 177:
nav = NmeaNavigationSystemEnum.SYS_CMP;
PRN = satId - 140;
return true;
}
return false;
}

}
}

0 comments on commit 580cfa1

Please sign in to comment.