67 lines
2.1 KiB
Dart
67 lines
2.1 KiB
Dart
|
// TypeDSC type of DSC sentence for Digital Selective Calling Information
|
||
|
// ignore_for_file: constant_identifier_names
|
||
|
|
||
|
import 'sentence.dart';
|
||
|
import 'parser.dart';
|
||
|
|
||
|
const TypeDSC = "DSC";
|
||
|
|
||
|
// AcknowledgementRequestDSC is type for Acknowledge request
|
||
|
const AcknowledgementRequestDSC = "R";
|
||
|
// AcknowledgementDSC is type for Acknowledgement
|
||
|
const AcknowledgementDSC = "B";
|
||
|
// AcknowledgementNeitherDSC is type for Neither (end of sequence)
|
||
|
const AcknowledgementNeitherDSC = "S";
|
||
|
|
||
|
class DSC {
|
||
|
String formatSpecifier;
|
||
|
String address;
|
||
|
String category;
|
||
|
String distressCauseOrTeleCommand1;
|
||
|
String commandTypeOrTeleCommand2;
|
||
|
String positionOrCanal;
|
||
|
String timeOrTelephoneNumber;
|
||
|
String mmsi;
|
||
|
String distressCause;
|
||
|
String acknowledgement;
|
||
|
String expansionIndicator;
|
||
|
DSC({
|
||
|
required this.formatSpecifier,
|
||
|
required this.address,
|
||
|
required this.category,
|
||
|
required this.distressCauseOrTeleCommand1,
|
||
|
required this.commandTypeOrTeleCommand2,
|
||
|
required this.positionOrCanal,
|
||
|
required this.timeOrTelephoneNumber,
|
||
|
required this.mmsi,
|
||
|
required this.distressCause,
|
||
|
required this.acknowledgement,
|
||
|
required this.expansionIndicator,
|
||
|
});
|
||
|
static DSC newDSC(BaseSentence s) {
|
||
|
var p = Parser(s);
|
||
|
return DSC(
|
||
|
formatSpecifier: p.string(0, "format specifier"),
|
||
|
address: p.string(1, "address"),
|
||
|
category: p.string(2, "category"),
|
||
|
distressCauseOrTeleCommand1:
|
||
|
p.string(3, "cause of the distress or first telecommand"),
|
||
|
commandTypeOrTeleCommand2:
|
||
|
p.string(4, "type of communication or second telecommand"),
|
||
|
positionOrCanal: p.string(5, "position or canal"),
|
||
|
timeOrTelephoneNumber: p.string(6, "time or telephone"),
|
||
|
mmsi: p.string(7, "MMSI"),
|
||
|
distressCause: p.string(8, "distress cause"),
|
||
|
acknowledgement: p.enumString(9, "acknowledgement", [
|
||
|
AcknowledgementRequestDSC,
|
||
|
" $AcknowledgementRequestDSC",
|
||
|
AcknowledgementDSC,
|
||
|
" $AcknowledgementDSC",
|
||
|
AcknowledgementNeitherDSC,
|
||
|
" $AcknowledgementNeitherDSC",
|
||
|
]).trim(),
|
||
|
expansionIndicator: p.string(10, "expansion indicator"),
|
||
|
);
|
||
|
}
|
||
|
}
|