Ais.Net.Models provides a series of C# 9.0 records which define the the message types, a series of interfaces that define common behaviours, and extension methods to help with type conversions & calculations.
Package | Status |
---|---|
Ais.Net.Models |
The AIS.NET project contains a series of layers, from a low-level high performance NMEA AIS sentence decoder, to a rich high-level C# 9.0 models of AIS message types, a receiver component that can listen to TCP streams of NMEA sentences and expose them as an IObservable<string>
of raw sentences or an decoded IObservable<IAisMessage>
, and finally a Storage Client implementation to persisting the raw NMEA sentence stream to Azure Blob storage for future processing.
The table below shows the messages, their properties and how they are mapped to interfaces.
Show AIS Message Types and .NET Interfaces
Message Type 1 to 3 | Message Type 5 | Message Type 18 | Message Type 19 | Message Type 24 Part 0 | Message Type 24 Part 1 | Message Type 27 | |
---|---|---|---|---|---|---|---|
IAisMessageType5 | AisVersion | ||||||
ICallSign | CallSign | CallSign | |||||
IAisMessageType18 | CanAcceptMessage22ChannelAssignment | ||||||
IAisMessageType18 | CanSwitchBands | ||||||
IVesselCourseOverGround | CourseOverGround | CourseOverGround | CourseOverGround | CourseOverGround | |||
IAisMessageType18 | CsUnit | ||||||
IAisMessageType5 | Destination | ||||||
IVesselDimensions | DimensionToBow | DimensionToBow | DimensionToBow | ||||
IVesselDimensions | DimensionToPort | DimensionToPort | DimensionToPort | ||||
IVesselDimensions | DimensionToStarboard | DimensionToStarboard | DimensionToStarboard | ||||
IVesselDimensions | DimensionToStern | DimensionToStern | DimensionToStern | ||||
IAisMessageType5 | Draught10thMetres | ||||||
IAisMessageType5 | EtaMonth | ||||||
IAisMessageType5 | EtaDay | ||||||
IAisMessageType5 | EtaHour | ||||||
IAisMessageType5 | EtaMinute | ||||||
IAisMessageType18 | HasDisplay | ||||||
IIsAssigned | IsAssigned | IsAssigned | |||||
IAisMessageType18 | IsDscAttached | ||||||
IAisMessageType5 | ImoNumber | ||||||
IAisIsDteNotReady | IsDteNotReady | IsDteNotReady | |||||
IVesselNavigation | Latitude10000thMins | Latitude10000thMins | Latitude10000thMins | ||||
IVesselNavigation | Longitude10000thMins | Longitude10000thMins | Longitude10000thMins | ||||
IAisMessageType1to3 | ManoeuvreIndicator | ||||||
IAisMessageType24Part1 | MothershipMmsi | ||||||
IAisMessageType | MessageType | MessageType | MessageType | MessageType | MessageType | MessageType | |
IVesselIdentity | Mmsi | Mmsi | Mmsi | Mmsi | Mmsi | Mmsi | |
IAisMultipartMessage | PartNumber | PartNumber | |||||
IVesselPositionAccuracy | PositionAccuracy | PositionAccuracy | PositionAccuracy | PositionAccuracy | |||
IAisPositionFixType | PositionFixType | PositionFixType | |||||
IAisMessageType18 | RadioStatusType | ||||||
IAisMessageType1to3 | RadioSlotTimeout | ||||||
IAisMessageType1to3 | RadioSubMessage | ||||||
IAisMessageType1to3 | RadioSyncState | ||||||
IAisMessageType19 | RegionalReserved139 | ||||||
IAisMessageType19 | RegionalReserved38 | ||||||
IRaimFlag | RaimFlag | RaimFlag | RaimFlag | RaimFlag | |||
IAisMessageType18 | RegionalReserved139 | ||||||
IAisMessageType18 | RegionalReserved38 | ||||||
IAisMessageType1to3 | RateOfTurn | ||||||
IRepeatIndicator | RepeatIndicator | RepeatIndicator | RepeatIndicator | RepeatIndicator | RepeatIndicator | RepeatIndicator | RepeatIndicator |
IAisMessageType24Part1 | SerialNumber | ||||||
IAisMessageType19 | ShipName | ||||||
IShipType | ShipType | ShipType | ShipType | ||||
IAisMessageType1to3 | SpareBits145 | ||||||
IAisMessageType24Part0 | Spare160 | ||||||
IAisMessageType24Part1 | Spare162 | ||||||
IAisMessageType5 | Spare423 | ||||||
IAisMessageType19 | Spare308 | ||||||
IVesselSpeedOverGround | SpeedOverGround | SpeedOverGround | SpeedOverGround | SpeedOverGround | |||
IVesselNavigation | TimeStampSecond | TimeStampSecond | TimeStampSecond | ||||
IVesselNavigation | TrueHeadingDegrees | TrueHeadingDegrees | TrueHeadingDegrees | ||||
IAisMessageType24Part1 | UnitModelCode | ||||||
IAisMessageType24Part1 | VendorIdRev3 | ||||||
IAisMessageType24Part1 | VendorIdRev4 | ||||||
IVesselName | VesselName | ||||||
IAisMessageType27 | GnssPositionStatus | ||||||
IAisMessageType27 | Position | ||||||
IVesselNavigationStatus | NavigationStatus | NavigationStatus |
The C# record types then implement the relevant interfaces, which enables simpler higher level programming constructs, such as Rx queries over an IAisMessage
stream:
IObservable<IGroupedObservable<uint, IAisMessage>> byVessel = receiverHost.Messages.GroupBy(m => m.Mmsi);
IObservable<(uint mmsi, IVesselNavigation navigation, IVesselName name)>? vesselNavigationWithNameStream =
from perVesselMessages in byVessel
let vesselNavigationUpdates = perVesselMessages.OfType<IVesselNavigation>()
let vesselNames = perVesselMessages.OfType<IVesselName>()
let vesselLocationsWithNames = vesselNavigationUpdates.CombineLatest(vesselNames, (navigation, name) => (navigation, name))
from vesselLocationAndName in vesselLocationsWithNames
select (mmsi: perVesselMessages.Key, vesselLocationAndName.navigation, vesselLocationAndName.name);
This project is available under the Apache 2.0 open source license.
For any licensing questions, please email licensing@endjin.com
This project is sponsored by endjin, a UK based Technology Consultancy which specializes in Data & Analytics, AI & Cloud Native App Dev, and is a .NET Foundation Corporate Sponsor.
We help small teams achieve big things.
We produce two free weekly newsletters:
- Azure Weekly for all things about the Microsoft Azure Platform
- Power BI Weekly for all things Power BI, Microsoft Fabric, and Azure Synapse Analytics
Keep up with everything that's going on at endjin via our blog, follow us on Twitter, YouTube or LinkedIn.
We have become the maintainers of a number of popular .NET Open Source Projects:
And we have over 50 Open Source projects of our own, spread across the following GitHub Orgs:
And the DevOps tooling we have created for managing all these projects is available on the PowerShell Gallery.
For more information about our products and services, or for commercial support of this project, please contact us.
This project has adopted a code of conduct adapted from the Contributor Covenant to clarify expected behaviour in our community. This code of conduct has been adopted by many other projects. For more information see the Code of Conduct FAQ or contact hello@endjin.com with any additional questions or comments.
The IP Maturity Model is endjin's IP quality assessment framework, which we've developed over a number of years when doing due diligence assessments of 3rd party systems. We've codified the approach into a configurable set of rules, which are committed into the root of a repo, and a Azure Function HttpTrigger HTTP endpoint which can evaluate the ruleset, and render an svg badge for display in repo's readme.md
.