|
@@ -0,0 +1,37 @@
|
|
|
+import 'package:vnote_device_plugin/consts/status.dart';
|
|
|
+import 'package:vnote_device_plugin/consts/types.dart';
|
|
|
+import 'package:vnote_device_plugin/devices/base.dart';
|
|
|
+import 'package:vnote_device_plugin/events/event_type.dart';
|
|
|
+import 'package:vnote_device_plugin/models/exams/heart.dart';
|
|
|
+
|
|
|
+/// 心电
|
|
|
+class HeartDeviceWorker extends DeviceWorkerBase {
|
|
|
+ HeartDeviceWorker({
|
|
|
+ required super.model,
|
|
|
+ required super.mac,
|
|
|
+ }) : super(type: DeviceTypes.HEART) {
|
|
|
+ // injectStatusCallback(VDeviceEventStatus.EXAM_Heart_SUCCESS, _onValue);
|
|
|
+ // injectStatusCallback(VDeviceEventStatus.EXAM_Heart_POINTS, _onPoints);
|
|
|
+ // injectStatusCallback(
|
|
|
+ // VDeviceEventStatus.EXAM_HeartPROBE_FALLOFF_ERROR, _onFalloffError);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 实时更新事件
|
|
|
+ final valueUpdateEvent = FEventHandler<HeartExamData>();
|
|
|
+
|
|
|
+ /// 接收结构事件
|
|
|
+ final resultReceivedEvent = FEventHandler<int>();
|
|
|
+
|
|
|
+ /// 测量错误事件
|
|
|
+ final errorEvent = FEventHandler<String>();
|
|
|
+
|
|
|
+ void _onValueUpdate(Map<String, dynamic>? data) {
|
|
|
+ final HeartExamData examData = HeartExamData.fromEventData(data!);
|
|
|
+ valueUpdateEvent.emit(this, examData);
|
|
|
+ }
|
|
|
+
|
|
|
+ void _onFalloffError(Map<String, dynamic>? data) {
|
|
|
+ const String msg = "导联脱落"; // TODO: pick message from data
|
|
|
+ errorEvent.emit(this, msg);
|
|
|
+ }
|
|
|
+}
|