GPSWing gps;
public override Task Initialize()
{
Console.WriteLine("Initialize...");
var serial = Device.CreateSerialMessagePort(
Device.PlatformOS.GetSerialPortName("Com4"),
suffixDelimiter: Encoding.ASCII.GetBytes("\r\n"),
preserveDelimiter: true,
baudRate: 9600);
gps = new GPSWing(serial);
gps.GgaReceived += (object sender, GnssPositionInfo location) =>
{
Console.WriteLine("*********************************************");
Console.WriteLine(location);
Console.WriteLine("*********************************************");
};
gps.GllReceived += (object sender, GnssPositionInfo location) =>
{
Console.WriteLine("*********************************************");
Console.WriteLine(location);
Console.WriteLine("*********************************************");
};
gps.GsaReceived += (object sender, ActiveSatellites activeSatellites) =>
{
Console.WriteLine("*********************************************");
Console.WriteLine(activeSatellites);
Console.WriteLine("*********************************************");
};
gps.RmcReceived += (object sender, GnssPositionInfo positionCourseAndTime) =>
{
Console.WriteLine("*********************************************");
Console.WriteLine(positionCourseAndTime);
Console.WriteLine("*********************************************");
};
gps.VtgReceived += (object sender, CourseOverGround courseAndVelocity) =>
{
Console.WriteLine("*********************************************");
Console.WriteLine($"{courseAndVelocity}");
Console.WriteLine("*********************************************");
};
gps.GsvReceived += (object sender, SatellitesInView satellites) =>
{
Console.WriteLine("*********************************************");
Console.WriteLine($"{satellites}");
Console.WriteLine("*********************************************");
};
return Task.CompletedTask;
}
public override Task Run()
{
gps.StartUpdating();
return Task.CompletedTask;
}