修复眠花糖设置闹钟无效
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:easydevice/easydevice.dart';
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:mhtctrl/mhtctrl.dart';
|
||||
import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
||||
import 'package:vbvs_app/common/color/app_uri_status.dart';
|
||||
import 'package:vbvs_app/common/util/DailyLogUtils.dart';
|
||||
@@ -18,6 +19,8 @@ import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/model/BleDeviceData.dart';
|
||||
import 'package:vbvs_app/model/api_response.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/component/mht_bind_dialog.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/device/component/tool/BedControlService.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/device/component/tool/DeviceType.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/device/controller/mht_bluetooth_controller.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/device/model/BlueToothDataModel.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/homepage/controller/mht_home_controller.dart';
|
||||
@@ -42,6 +45,8 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
||||
MHTBlueToothController blueteethBindController = Get.find();
|
||||
MHTHomeController homeController = Get.find();
|
||||
var lisObj;
|
||||
late MattressControlService service;
|
||||
late BedControlService bedService;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -232,6 +237,8 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
||||
TopSlideNotification.show(context,
|
||||
text: response.msg!);
|
||||
if (response.code == HttpStatusCodes.ok) {
|
||||
//关闭闹钟和打鼾干预
|
||||
// resetLastDeviceConfig(widget.bleDevice);
|
||||
homeController.getPersonList();
|
||||
//请求绑定设备列表
|
||||
// homeController.getSleepReport();
|
||||
@@ -761,6 +768,49 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
||||
|
||||
throw Exception("获取MAC超时".tr);
|
||||
}
|
||||
|
||||
//重置设备闹钟数据和打鼾干预
|
||||
// void resetLastDeviceConfig(BlueToothDataModel bleDevice) {
|
||||
// int deviceType = bleDevice.type;
|
||||
// if (deviceType == 2) {
|
||||
// //床垫
|
||||
// service = MattressControlService((pkg) async {
|
||||
// var bytes = pkg.toBytes();
|
||||
// String serviceCode = "";
|
||||
// if (bleDevice != null) {
|
||||
// if (deviceType == DeviceType.smartBed.value) {
|
||||
// serviceCode = "ffe0/ffe1";
|
||||
// }
|
||||
// if (deviceType == DeviceType.smartMattress.value) {
|
||||
// serviceCode = "fff0/fff2";
|
||||
// }
|
||||
// }
|
||||
// if (bytes[7] != 0x00) {
|
||||
// //打印bytes
|
||||
// String hex = bytes.toString();
|
||||
// print("--------->" + hex);
|
||||
// String hexString = bytes
|
||||
// .map((e) => e.toRadixString(16).padLeft(2, '0'))
|
||||
// .join(' ')
|
||||
// .toUpperCase();
|
||||
// print("--------->hex->" + hexString);
|
||||
// }
|
||||
// int aa = await blueteethBindController.currentDevice!
|
||||
// .write(bleDevice.mac, serviceCode, bytes, withresponse: true);
|
||||
// ef.log(bytes.toString());
|
||||
// return aa == 0 ? true : false;
|
||||
// });
|
||||
// } else if (deviceType == 3) {
|
||||
// //床
|
||||
// bedService = BedControlService(_writeToDevice); // 初始化
|
||||
// }
|
||||
// }
|
||||
|
||||
// Future<bool> _writeToDevice(Uint8List pkg) async {
|
||||
// int result = await bleToolController.ble
|
||||
// .write(macAddress.value, "ffe0/ffe1", pkg, withresponse: true);
|
||||
// return result == 0;
|
||||
// }
|
||||
}
|
||||
|
||||
String parseMacFromBleResponse(List<int> data) {
|
||||
|
||||
Reference in New Issue
Block a user