vid_us_mode.dart 962 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import 'dart:typed_data';
  2. import 'package:vid/us/vid_us_data_reader.dart';
  3. import 'package:vid/us/vid_us_data_writer.dart';
  4. enum VidUsModeType {
  5. Undefined,
  6. Tissue,
  7. Flow,
  8. Doppler,
  9. TissueTM,
  10. Tissue3D,
  11. FlowM,
  12. }
  13. class VidUsMode {
  14. String _name, _displayName;
  15. VidUsModeType _type;
  16. String get name => _name;
  17. String get displayName => _displayName;
  18. VidUsModeType get type => _type;
  19. VidUsMode(this._name, this._displayName, this._type);
  20. Uint8List toBytes() {
  21. var writer = new VidUsDataWriter();
  22. writer.writeString(this.name);
  23. writer.writeString(this.displayName);
  24. writer.writeByte(this._type.index);
  25. return writer.data;
  26. }
  27. static VidUsMode fromBytes(Uint8List bytes) {
  28. var reader = new VidUsDataReader(bytes);
  29. var name = reader.readString();
  30. var displayName = reader.readString();
  31. var type = VidUsModeType.values[reader.readByte()];
  32. return new VidUsMode(name, displayName, type);
  33. }
  34. }