diff --git a/android/version.properties b/android/version.properties index 97d6e0b..d209e3e 100644 --- a/android/version.properties +++ b/android/version.properties @@ -1,2 +1,2 @@ -flutter.android.versionName=2.0.5 -flutter.android.versionCode=10 \ No newline at end of file +flutter.android.versionName=2.0.7 +flutter.android.versionCode=11 \ No newline at end of file diff --git a/assets/file.json b/assets/file.json index df7873a..ddc19b9 100644 --- a/assets/file.json +++ b/assets/file.json @@ -1,3 +1,3 @@ [ - "assets/miniapp/mhtControl_1.0.85.zip" + "assets/miniapp/mhtControl_1.0.87.zip" ] \ No newline at end of file diff --git a/assets/miniapp/mhtControl_1.0.85.zip b/assets/miniapp/mhtControl_1.0.87.zip similarity index 97% rename from assets/miniapp/mhtControl_1.0.85.zip rename to assets/miniapp/mhtControl_1.0.87.zip index 353c150..aad3054 100644 Binary files a/assets/miniapp/mhtControl_1.0.85.zip and b/assets/miniapp/mhtControl_1.0.87.zip differ diff --git a/lib/component/tool/cmd.dart b/lib/component/tool/cmd.dart index 401951b..c454452 100644 --- a/lib/component/tool/cmd.dart +++ b/lib/component/tool/cmd.dart @@ -1,7 +1,10 @@ //蓝牙指令 +import 'dart:convert'; + import 'package:EasyDartModule/EasyDartModule.dart' as edm; import 'package:easydevice/src/app/thapp.dart'; +import 'package:ef/ef.dart'; import 'package:vbvs_app/common/util/DailyLogUtils.dart'; // wifi列表指令 @@ -86,7 +89,8 @@ Future sendWifiSetting(wifiItem, String password, THapp tHapp) async { // ".wifi.sta.ssid=${wifiItem['ssid']} .wifi.sta.pwd=$password"; String cmd = "vtouch save update -a -i .wifi.sta.auth=${wifiItem['auth']} " ".wifi.sta.ssid=\"${wifiItem['ssid']}\" .wifi.sta.pwd=\"$password\""; - final success = await tHapp.send(cmd, true, (log) { + ef.log("[wifi配置指令]:${cmd}"); + final success = await tHapp.send(utf8.encode(cmd), true, (log) { if (log.log.contains("update parm is successful")) { print("[wifi456]:" + log.log); edm.EasyDartModule.logger.info("WiFi配置参数成功-》log:$log"); @@ -110,60 +114,78 @@ Future sendWifiSetting(wifiItem, String password, THapp tHapp) async { } } -getDeviceWifiStatus(THapp tHapp, int times) async { +getDeviceWifiStatus( + THapp tHapp, + int times, { + bool link = false, +}) async { edm.EasyDartModule.logger.info("发送请求设备已配置网络状态指令"); DailyLogUtils.writeLog("发送请求设备已配置网络状态指令"); print("at+system info"); - + bool success = false; try { - var result = await tHapp.send("at+system info", true, (ss) { - var log = ss.log; - // 匹配设备状态 - final statusMatch = RegExp(r'Status=([^\s]+)').firstMatch(log); - final status = statusMatch?.group(1); - if (status != null) { - print('提取到的 status: $status'); + var result = await tHapp.send( + "at+system info", + true, + (ss) { + var log = ss.log; + // 匹配设备状态 + final statusMatch = RegExp(r'Status=([^\s]+)').firstMatch(log); + final status = statusMatch?.group(1); + if (status != null) { + print('提取到的 status: $status'); - // 如果设备连接状态是 "connect",继续检测 - if (status.contains('connect')) { - // 匹配 Wi-Fi 连接信息 - final wifiInfoMatch = RegExp( - r'WIFI CONNECTED INFO:SSID=([^\s]+),RSSI=([-0-9]+),AUTH=([0-9]+),CH=([0-9]+),BSSID=([A-F0-9]+)') - .firstMatch(log); - if (wifiInfoMatch != null) { - final ssid = wifiInfoMatch.group(1); - final rssi = wifiInfoMatch.group(2); - final auth = wifiInfoMatch.group(3); - final ch = wifiInfoMatch.group(4); - final bssid = wifiInfoMatch.group(5); + // 如果设备连接状态是 "connect",继续检测 + if (status.contains('connect')) { + // 匹配 Wi-Fi 连接信息 + final wifiInfoMatch = RegExp( + r'WIFI CONNECTED INFO:SSID=([^\s]+),RSSI=([-0-9]+),AUTH=([0-9]+),CH=([0-9]+),BSSID=([A-F0-9]+)') + .firstMatch(log); + if (wifiInfoMatch != null) { + final ssid = wifiInfoMatch.group(1); + final rssi = wifiInfoMatch.group(2); + final auth = wifiInfoMatch.group(3); + final ch = wifiInfoMatch.group(4); + final bssid = wifiInfoMatch.group(5); - // 打印并返回 Wi-Fi 信息 - print( - 'Wi-Fi 信息: SSID=$ssid, RSSI=$rssi, AUTH=$auth, CH=$ch, BSSID=$bssid'); + // 打印并返回 Wi-Fi 信息 + print( + 'Wi-Fi 信息: SSID=$ssid, RSSI=$rssi, AUTH=$auth, CH=$ch, BSSID=$bssid'); - // 停止监听并返回信息 - ss.result = { - 'ssid': ssid, - 'rssi': rssi, - 'auth': auth, - 'ch': ch, - 'bssid': bssid, - }; - ss.over = true; - return true; + // 停止监听并返回信息 + ss.result = { + 'ssid': ssid, + 'rssi': rssi, + 'auth': auth, + 'ch': ch, + 'bssid': bssid, + }; + ss.over = true; + success = true; + return true; + } + } else { + if (!link) { + ss.over = true; + return true; + } } } - } - // 继续监听 - return false; - }, times); - + // 继续监听 + return false; + }, + times, + ); + if(!success){ + return success; + } return result; } catch (e) { print(e); } } +//只有4g并且没有wifi Future getDeviceNetVersion(THapp tHapp, int times) async { edm.EasyDartModule.logger.info("发送请求设备的网络信息"); DailyLogUtils.writeLog("发送请求设备的网络信息"); diff --git a/lib/main.dart b/lib/main.dart index 3976f6d..300f56f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -629,7 +629,7 @@ void initEasyDartModule() { try { EasyDartModule.init( loggerConfig: - LoggerConfig(host: ServiceConstant.logService, serviceName: "智慧眠花糖在线"), + LoggerConfig(host: ServiceConstant.logService, serviceName: "智慧眠花糖在线2025-10-9"), webSocketConfig: WebSocketConfig(ServiceConstant.webSocketService, (data) { // 接收到服务消息 diff --git a/lib/pages/device_bind/after/after_wifi_page_person.dart b/lib/pages/device_bind/after/after_wifi_page_person.dart index 8184951..de11ce3 100644 --- a/lib/pages/device_bind/after/after_wifi_page_person.dart +++ b/lib/pages/device_bind/after/after_wifi_page_person.dart @@ -968,6 +968,10 @@ class _AfterWifiPagePersonState extends State { // 连接设备 // await targetDevice.device.connect(); THapp bledevice = THapp(device: targetDevice.device); + bledevice.logingStream.listen((event) { + edm.EasyDartModule.logger.info("[wifi配置]:" + event); + print("[bleeeee]:" + event); + }); await bledevice.device.connect(); var res2 = bledevice.isConnected; if (res2) { @@ -1021,6 +1025,7 @@ class _AfterWifiPagePersonState extends State { fontSize: AppConstants().title_text_fontSize), )); // return; + await initWifiStatusAndWifiList(); } else if (aa == 'unknown') { blueteethBindController.netType.value = 3; blueteethBindController.updateAll(); @@ -1032,6 +1037,7 @@ class _AfterWifiPagePersonState extends State { textColor: themeController.currentColor.sc9, ); }); + await initWifiStatusAndWifiList(); } else { blueteethBindController.netType.value = 1; blueteethBindController.updateAll(); diff --git a/lib/pages/main_bottom/component/main_page_b_bottom_change.dart b/lib/pages/main_bottom/component/main_page_b_bottom_change.dart index 627e55a..25a91de 100644 --- a/lib/pages/main_bottom/component/main_page_b_bottom_change.dart +++ b/lib/pages/main_bottom/component/main_page_b_bottom_change.dart @@ -220,6 +220,7 @@ class _HomePageState extends State type: 1, ))); await Future.delayed(Duration(seconds: 1)); + //5 广播 edm.EasyDartModule.websocket.sendData(jsonEncode( WebSocketMessage(path: "/smartbed/connect", type: 5, data: { 'mac': webviewTestController.selectDevice['mac'], diff --git a/lib/pages/mh_page/device/mht_wifi_page.dart b/lib/pages/mh_page/device/mht_wifi_page.dart index 62f7f6d..fbce998 100644 --- a/lib/pages/mh_page/device/mht_wifi_page.dart +++ b/lib/pages/mh_page/device/mht_wifi_page.dart @@ -583,7 +583,8 @@ class _MHTWifiPageState extends State { .wifiStatus .value = aa != null ? 1 : 0; - if (aa != null) { + if (aa != null&& + aa != false) { updateDeviceBindStatus( blueteethBindController .currentDeviceMac! @@ -598,6 +599,9 @@ class _MHTWifiPageState extends State { .sc2, ); } else { + blueteethBindController + .connect_wifi + .value = {}; TopSlideNotification .show( context, @@ -609,6 +613,9 @@ class _MHTWifiPageState extends State { ); } } else { + blueteethBindController + .connect_wifi + .value = {}; TopSlideNotification.show( context, text: "配网失败".tr, @@ -619,6 +626,7 @@ class _MHTWifiPageState extends State { ); } }); + }, child: Row( mainAxisSize: @@ -973,7 +981,7 @@ class _MHTWifiPageState extends State { blueteethBindController.blueConnectFlag.value = 2; TopSlideNotification.show( context, - text: "蓝牙绑定.连接成功".tr, + text: "连接成功".tr, textColor: themeController.currentColor.sc2, ); blueteethBindController.currentDevice = bledevice; diff --git a/lib/pages/mh_page/device/mht_wifi_page_after.dart b/lib/pages/mh_page/device/mht_wifi_page_after.dart index 86ebf8d..c6a32c2 100644 --- a/lib/pages/mh_page/device/mht_wifi_page_after.dart +++ b/lib/pages/mh_page/device/mht_wifi_page_after.dart @@ -526,6 +526,12 @@ class _MHTWifiAfterPageState extends State { wifiItem['ssid'] ?? '未命名'.tr, onConfirm: () async { + blueteethBindController + .currentDevice! + .logingStream + .listen((event) { + ef.log("[命令日志]:$event"); + }); blueteethBindController .selectWifi .value = wifiItem; @@ -539,7 +545,7 @@ class _MHTWifiAfterPageState extends State { var aa = await getDeviceWifiStatus( blueteethBindController .currentDevice!, - 1); + 1,link: true); blueteethBindController .selectWifi .value = {}; @@ -556,8 +562,12 @@ class _MHTWifiAfterPageState extends State { blueteethBindController .wifiStatus .value = - aa != null ? 1 : 0; - if (aa != null) { + (aa != null && + aa != false) + ? 1 + : 0; + if (aa != null && + aa != false) { updateDeviceBindStatus( blueteethBindController .currentDeviceMac! @@ -572,6 +582,9 @@ class _MHTWifiAfterPageState extends State { .sc2, ); } else { + blueteethBindController + .connect_wifi + .value = {}; TopSlideNotification .show( context, @@ -583,6 +596,9 @@ class _MHTWifiAfterPageState extends State { ); } } else { + blueteethBindController + .connect_wifi + .value = {}; TopSlideNotification.show( context, text: "配网失败".tr, @@ -947,7 +963,7 @@ class _MHTWifiAfterPageState extends State { blueteethBindController.blueConnectFlag.value = 2; TopSlideNotification.show( context, - text: "蓝牙绑定.连接成功".tr, + text: "连接成功".tr, textColor: themeController.currentColor.sc2, ); blueteethBindController.currentDevice = bledevice; diff --git a/lib/pages/mh_page/homepage/controller/mht_home_controller.dart b/lib/pages/mh_page/homepage/controller/mht_home_controller.dart index ce7ceb6..20b88a7 100644 --- a/lib/pages/mh_page/homepage/controller/mht_home_controller.dart +++ b/lib/pages/mh_page/homepage/controller/mht_home_controller.dart @@ -563,7 +563,10 @@ class MHTHomeController extends GetControllerEx { onFailure: (res) { EasyDartModule.logger.warning("请求睡眠信息列表失败: ${res.msg}"); TopSlideNotification.show(context, - text: "请求失败".tr, textColor: themeController.currentColor.sc9); + text: res.msg ?? "请求失败".tr, + textColor: themeController.currentColor.sc9); + homeSleepDays.value = []; + updateAll(); }, ); } diff --git a/lib/pages/sleep_report/component/Vital_signs.dart b/lib/pages/sleep_report/component/Vital_signs.dart index 3decec9..bce5ebd 100644 --- a/lib/pages/sleep_report/component/Vital_signs.dart +++ b/lib/pages/sleep_report/component/Vital_signs.dart @@ -181,7 +181,7 @@ class _VitalSignsWidgetState extends State { 'person_show': false, 'itemName': 206, 'retrun_fresh': true, - 'reportPadding':false, + 'reportPadding':false, }); if (widget.onRefresh != null) { widget.onRefresh!();