/// <summary> /// Subclasses need to override with their own parsing method /// </summary> /// <param name="sixState"></param> /// <exception cref="SixbitsExhaustedException"></exception> /// <exception cref="AisMessageException"></exception> public override void Parse(Sixbit sixState) { if (sixState.BitLength != 168) { throw new AisMessageException("Message 11 wrong length"); } base.Parse(sixState); /* Parse the Message 11 */ UtcYear = (int)sixState.Get(14); UtcMonth = (int)sixState.Get(4); UtcDay = (int)sixState.Get(5); UtcHour = (int)sixState.Get(5); UtcMinute = (int)sixState.Get(6); UtcSecond = (int)sixState.Get(6); PosAcc = (int)sixState.Get(1); Pos = new Position { Longitude = sixState.Get(28), Latitude = sixState.Get(27) }; PosType = (int)sixState.Get(4); Spare = (int)sixState.Get(10); Raim = (int)sixState.Get(1); SotdmaState = new Sotdma(); SotdmaState.Parse(sixState); }
public override List <Tuple <string, string> > getAttributes() { List <Tuple <string, string> > _listAttribute = base.getAttributes(); this.Sotdma = new SOTDMA(); this.Itdma = new ITDMA(); List <Tuple <string, string> > _listSotdma = Sotdma.getAttributes(); List <Tuple <string, string> > _listItdma = Itdma.getAttributes(); List <Tuple <string, string> > _attributes = new List <Tuple <string, string> > { new Tuple <string, string>("Userr ID", ""), new Tuple <string, string>("SOG", ""), new Tuple <string, string>("Position Accuracy", ""), new Tuple <string, string>("Longitude", ""), new Tuple <string, string>("Latitude", ""), new Tuple <string, string>("COG", ""), new Tuple <string, string>("True Heading", ""), new Tuple <string, string>("Time Stamp", ""), new Tuple <string, string>("Spare 2", ""), new Tuple <string, string>("Class B Unit Flag", ""), new Tuple <string, string>("Class B Display Flag", ""), new Tuple <string, string>("Class B DSC Flag", ""), new Tuple <string, string>("Class B Band Flag", ""), new Tuple <string, string>("Class B Message 22 Flag", ""), new Tuple <string, string>("Mode Flag", ""), new Tuple <string, string>("RAIM Flag", ""), new Tuple <string, string>("Communication State Selector Flag", ""), }; _listAttribute.AddRange(_attributes); foreach (var att in _listSotdma) { _listAttribute.Add(new Tuple <string, string>(att.Item1, att.Item2)); } foreach (var att in _listItdma) { _listAttribute.Add(new Tuple <string, string>(att.Item1, att.Item2)); } return(_listAttribute); }
/// <summary> /// Subclasses need to override with their own parsing method /// </summary> /// <param name="sixState"></param> /// <exception cref="SixbitsExhaustedException"></exception> /// <exception cref="AisMessageException"></exception> public override void Parse(Sixbit sixState) { if (sixState.BitLength != 168) { throw new AisMessageException("Message 18 wrong length"); } base.Parse(sixState); Regional1 = (int)sixState.Get(8); Sog = (int)sixState.Get(10); PosAcc = (int)sixState.Get(1); Pos = new Position(); Pos.Longitude = sixState.Get(28); Pos.Latitude = sixState.Get(27); Cog = (int)sixState.Get(12); TrueHeading = (int)sixState.Get(9); UtcSec = (int)sixState.Get(6); Regional2 = (int)sixState.Get(2); UnitFlag = (int)sixState.Get(1); DisplayFlag = (int)sixState.Get(1); DscFlag = (int)sixState.Get(1); BandFlag = (int)sixState.Get(1); Msg22Flag = (int)sixState.Get(1); ModeFlag = (int)sixState.Get(1); Raim = (int)sixState.Get(1); CommState = (int)sixState.Get(1); if (CommState == 0) { SotdmaState = new Sotdma(sixState); } else { ItdmaState = new Itdma(sixState); } }
/// <summary> /// Subclasses need to override with their own parsing method /// </summary> /// <param name="sixState"></param> /// <exception cref="SixbitsExhaustedException"></exception> /// <exception cref="AisMessageException"></exception> public override void Parse(Sixbit sixState) { if (sixState.BitLength != 168) { throw new AisMessageException("Message 9 wrong length"); } base.Parse(sixState); Altitude = (int)sixState.Get(12); Sog = (int)sixState.Get(10); PosAcc = (int)sixState.Get(1); Pos = new Position { Longitude = sixState.Get(28), Latitude = sixState.Get(27) }; Cog = (int)sixState.Get(12); UtcSec = (int)sixState.Get(6); Regional = (char)sixState.Get(8); Dte = (char)sixState.Get(1); Spare = (char)sixState.Get(3); Assigned = (char)sixState.Get(1); Raim = (char)sixState.Get(1); CommState = (char)sixState.Get(1); if (CommState == 0) { SotdmaState = new Sotdma(sixState); } else { ItdmaState = new Itdma(sixState); } }