Class NmeaLineToAisStreamAdapter
Processes NMEA message lines, and passes their payloads as complete AIS messages to an INmeaAisMessageStreamProcessor, reassembling any messages that were split across multiple NMEA lines.
Inheritance
Namespace: Ais.Net
Assembly: Ais.Net.dll
Syntax
public class NmeaLineToAisStreamAdapter : object, INmeaLineStreamProcessor, IDisposable
Constructors
| Improve this Doc View SourceNmeaLineToAisStreamAdapter(INmeaAisMessageStreamProcessor)
Creates a NmeaLineToAisStreamAdapter.
Declaration
public NmeaLineToAisStreamAdapter(INmeaAisMessageStreamProcessor messageProcessor)
Parameters
Type | Name | Description |
---|---|---|
INmeaAisMessageStreamProcessor | messageProcessor | The message process to which complete AIS messages are to be passed. |
NmeaLineToAisStreamAdapter(INmeaAisMessageStreamProcessor, NmeaParserOptions)
Creates a NmeaLineToAisStreamAdapter.
Declaration
public NmeaLineToAisStreamAdapter(INmeaAisMessageStreamProcessor messageProcessor, NmeaParserOptions options)
Parameters
Type | Name | Description |
---|---|---|
INmeaAisMessageStreamProcessor | messageProcessor | The message process to which complete AIS messages are to be passed. |
NmeaParserOptions | options | Configures parser behaviour. |
Methods
| Improve this Doc View SourceDispose()
Declaration
public void Dispose()
OnCompleted()
Called when all lines have been processed.
Declaration
public void OnCompleted()
OnError(ReadOnlySpan<Byte>, Exception, Int32)
Called when a line cannot be parsed, e.g. it does not contain a well-formed NMEA message.
Declaration
public void OnError(in ReadOnlySpan<byte> line, Exception error, int lineNumber)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlySpan<System.Byte> | line | The line that cannot be parsed. |
Exception | error | An exception describing the problem. |
System.Int32 | lineNumber | The 1-based line number on which the error was detected. |
OnNext(NmeaLineParser, Int32)
Called for each non-empty line.
Declaration
public void OnNext(in NmeaLineParser parsedLine, int lineNumber)
Parameters
Type | Name | Description |
---|---|---|
NmeaLineParser | parsedLine | The parsed line. |
System.Int32 | lineNumber | The 1-based line number. |
Progress(Boolean, Int32, Int32, Int32, Int32)
Called regularly to provide progress reports, and always called at the end.
Declaration
public void Progress(bool done, int totalLines, int totalTicks, int linesSinceLastUpdate, int ticksSinceLastUpdate)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | done | True if all processing is complete. |
System.Int32 | totalLines | The number of lines processed. |
System.Int32 | totalTicks | The number of milliseconds of processing. |
System.Int32 | linesSinceLastUpdate | The number of lines since the last progress notification. |
System.Int32 | ticksSinceLastUpdate | The number of ticks since the last progress notification. |