-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added CustomChecksumSentence and NmeaSentenceType.custom
- Loading branch information
1 parent
bd9c259
commit fc3dc6c
Showing
9 changed files
with
93 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import 'package:nmea/src/checksum_sentence.dart'; | ||
import 'package:nmea/src/nmea_sentence_type.dart'; | ||
|
||
/// A [ChecksumSentence] where the data format is completely customizable, as | ||
/// long as it fits in the general envelope of an NMEA0183 sentence (begins with | ||
/// '$' and ends with windows-style newline characters) and has a checksum. | ||
class CustomChecksumSentence extends ChecksumSentence { | ||
/// Returns the identifier used to identify this sentence type | ||
final String identifier; | ||
|
||
/// Decides whether or not to validate the checksum on this sentence | ||
final bool validateChecksums; | ||
|
||
/// The [CustomChecksumSentence] constructor forwards all arguments to the | ||
/// [ChecksumSentence] constructor, except the [type] parameter. | ||
/// The [type] is always [NmeaSentenceType.custom]. | ||
CustomChecksumSentence( | ||
{required this.identifier, | ||
required super.raw, | ||
super.prefix, | ||
this.validateChecksums = true}) | ||
: super(type: NmeaSentenceType.custom); | ||
|
||
@override | ||
bool get hasValidChecksum => super.hasValidChecksum || !validateChecksums; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,15 @@ | ||
import 'package:nmea/src/checksum_sentence.dart'; | ||
import 'package:nmea/src/nmea_sentence_type.dart'; | ||
import 'package:nmea/nmea.dart'; | ||
|
||
/// The data format is completely customizable, as long as it fits in the general | ||
/// envelope of an NMEA0183 sentence (begins with '$' and ends with windows- | ||
/// style newline characters). | ||
class CustomSentence extends ChecksumSentence { | ||
/// An [NmeaSentence] where the data format is completely customizable, as | ||
/// long as it fits in the general envelope of an NMEA0183 sentence (begins with | ||
/// '$' and ends with windows-style newline characters). | ||
class CustomSentence extends NmeaSentence { | ||
/// Returns the identifier used to identify this sentence type | ||
final String identifier; | ||
final bool validateChecksums; | ||
|
||
CustomSentence( | ||
{required this.identifier, | ||
required super.raw, | ||
super.prefix, | ||
this.validateChecksums = true}) | ||
: super(type: NmeaSentenceType.unknown); | ||
|
||
@override | ||
bool get hasValidChecksum => super.hasValidChecksum || !validateChecksums; | ||
/// The [CustomChecksumSentence] constructor forwards all arguments to the | ||
/// [NmeaSentence] constructor, except the [type] parameter. | ||
/// The [type] is always [NmeaSentenceType.custom]. | ||
CustomSentence({required this.identifier, required super.raw, super.prefix}) | ||
: super(type: NmeaSentenceType.custom); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters