12345678910111213141516171819202122232425262728 |
- import 'package:vnote_device_plugin/consts/status.dart';
- import 'package:vnote_device_plugin/devices/base.dart';
- import 'package:vnote_device_plugin/event_type.dart';
- class TempDeviceWorker extends DeviceWorkerBase {
- TempDeviceWorker({
- required super.model,
- required super.mac,
- }) : super(
- "temp",
- maxStatus: 1003,
- minStatus: 1000,
- );
- final successEvent = FEventHandler<double>();
- final errorEvent = FEventHandler<String>();
- @override
- void onEventCallback(int status, Map<String, dynamic> data) {
- if (VDeviceSdkStatus.EXAM_TEMP_ERROR == status) {
- errorEvent.emit(this, "Error"); //TODO:
- } else {
- //TODO: 处理过高or过低
- final value = data["TEMP"];
- successEvent.emit(this, value);
- }
- }
- }
|