-
-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
Hello.
"!AIVDM,2,1,6,A,56T6Bb82;pLA<t;N20Lht84j0qD8U8622222216:@@<55QW0=Rl45Dp888,0*48"
<- I can decode this strings with online AIS decoder well, but when I put it in your library, it returns null.
using System;
using System.Windows.Forms;
using MissionPlanner;
using MissionPlanner.Utilities;
using System.Collections.Generic;
using System.Linq;
using MissionPlanner.Controls;
using AisParser;
using System.Text.RegularExpressions;
namespace AISParserSanityTestPlugins
{
public class AISParserSanityTestPlugins : MissionPlanner.Plugin.Plugin
{
AisParser.Parser parser;
public override string Name
{
get { return "AIS Parser Sanity Test Plugins"; }
}
public override string Version
{
get { return "0.30"; }
}
public override string Author
{
get { return "Open Source Community"; }
}
public override bool Init()
{
return true;
}
public override bool Loaded() //Loaded called after the plugin dll successfully loaded(different from loop())
{
parser = new AisParser.Parser();
loopratehz = 12.0f;
return true;
}
public override bool Loop()
{
string test_string = "!AIVDM,2,1,6,A,56T6Bb82;pL`A<t;N20Lht84j0qD8U8622222216:@@<55QW0=Rl`45Dp888,0*48";
try
{
var aisMessage = parser.Parse(test_string);
//Console.WriteLine("MMSI Number : " + aisMessage.Mmsi); //Error. Mmsi is null.
//Console.WriteLine("MMSI Number : " + aisMessage.mmsi); //Error. there is no member mmsi.
//Console.WriteLine("Ship Name : " + aisMessage.ShipName); //Error. no member. "ShipName" even though web AIS parser get ship name on this string.
//Console.WriteLine(aisMessage); //Print blank Texts.
//Console.WriteLine("ShipType : " + aisMessage.ShipType); //no member. "ShipType"
Console.WriteLine("Latitude : " + aisMessage.Latitude); //no member. "Latitude"
}
catch (Exception e)
{
Console.WriteLine("Error with this string : " + test_string);
Console.WriteLine("Error code : " + e);
Console.WriteLine("Stack Trace : " + e.StackTrace);
}
loopratehz = 20.0f;
return true;
}
public override bool Exit()
{
return true;
}
}
}
this code is mission planner plugin.
you can test this by install mission planner and put this *.cs file to plugins folder.
I can decode almost all message, but sometimes static and voyage related data? message doesn't read well.
Metadata
Metadata
Assignees
Labels
No labels