26 lines
582 B
Dart
26 lines
582 B
Dart
// ignore_for_file: constant_identifier_names
|
|
|
|
import 'parser.dart';
|
|
import 'sentence.dart';
|
|
|
|
const TypeDPT = "DPT";
|
|
|
|
class DPT {
|
|
double depth;
|
|
double offset;
|
|
double? rangeScale; // Optional property
|
|
|
|
DPT({required this.depth, required this.offset, this.rangeScale});
|
|
static DPT newDPT(BaseSentence s) {
|
|
var p = Parser(s);
|
|
double rangeScale = 0;
|
|
if (s.fields.length > 2) {
|
|
rangeScale = p.float64(2, "range scale");
|
|
}
|
|
return DPT(
|
|
depth: p.float64(0, "depth"),
|
|
offset: p.float64(1, "offset"),
|
|
rangeScale: rangeScale);
|
|
}
|
|
}
|