修复wifi配置含中文
This commit is contained in:
@@ -1,2 +1,2 @@
|
|||||||
flutter.android.versionName=2.0.5
|
flutter.android.versionName=2.0.7
|
||||||
flutter.android.versionCode=10
|
flutter.android.versionCode=11
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
[
|
[
|
||||||
"assets/miniapp/mhtControl_1.0.85.zip"
|
"assets/miniapp/mhtControl_1.0.87.zip"
|
||||||
]
|
]
|
||||||
Binary file not shown.
@@ -1,7 +1,10 @@
|
|||||||
//蓝牙指令
|
//蓝牙指令
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:EasyDartModule/EasyDartModule.dart' as edm;
|
import 'package:EasyDartModule/EasyDartModule.dart' as edm;
|
||||||
import 'package:easydevice/src/app/thapp.dart';
|
import 'package:easydevice/src/app/thapp.dart';
|
||||||
|
import 'package:ef/ef.dart';
|
||||||
import 'package:vbvs_app/common/util/DailyLogUtils.dart';
|
import 'package:vbvs_app/common/util/DailyLogUtils.dart';
|
||||||
|
|
||||||
// wifi列表指令
|
// wifi列表指令
|
||||||
@@ -86,7 +89,8 @@ Future<bool> sendWifiSetting(wifiItem, String password, THapp tHapp) async {
|
|||||||
// ".wifi.sta.ssid=${wifiItem['ssid']} .wifi.sta.pwd=$password";
|
// ".wifi.sta.ssid=${wifiItem['ssid']} .wifi.sta.pwd=$password";
|
||||||
String cmd = "vtouch save update -a -i .wifi.sta.auth=${wifiItem['auth']} "
|
String cmd = "vtouch save update -a -i .wifi.sta.auth=${wifiItem['auth']} "
|
||||||
".wifi.sta.ssid=\"${wifiItem['ssid']}\" .wifi.sta.pwd=\"$password\"";
|
".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")) {
|
if (log.log.contains("update parm is successful")) {
|
||||||
print("[wifi456]:" + log.log);
|
print("[wifi456]:" + log.log);
|
||||||
edm.EasyDartModule.logger.info("WiFi配置参数成功-》log:$log");
|
edm.EasyDartModule.logger.info("WiFi配置参数成功-》log:$log");
|
||||||
@@ -110,13 +114,20 @@ Future<bool> 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("发送请求设备已配置网络状态指令");
|
edm.EasyDartModule.logger.info("发送请求设备已配置网络状态指令");
|
||||||
DailyLogUtils.writeLog("发送请求设备已配置网络状态指令");
|
DailyLogUtils.writeLog("发送请求设备已配置网络状态指令");
|
||||||
print("at+system info");
|
print("at+system info");
|
||||||
|
bool success = false;
|
||||||
try {
|
try {
|
||||||
var result = await tHapp.send("at+system info", true, (ss) {
|
var result = await tHapp.send(
|
||||||
|
"at+system info",
|
||||||
|
true,
|
||||||
|
(ss) {
|
||||||
var log = ss.log;
|
var log = ss.log;
|
||||||
// 匹配设备状态
|
// 匹配设备状态
|
||||||
final statusMatch = RegExp(r'Status=([^\s]+)').firstMatch(log);
|
final statusMatch = RegExp(r'Status=([^\s]+)').firstMatch(log);
|
||||||
@@ -149,6 +160,12 @@ getDeviceWifiStatus(THapp tHapp, int times) async {
|
|||||||
'ch': ch,
|
'ch': ch,
|
||||||
'bssid': bssid,
|
'bssid': bssid,
|
||||||
};
|
};
|
||||||
|
ss.over = true;
|
||||||
|
success = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!link) {
|
||||||
ss.over = true;
|
ss.over = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -156,14 +173,19 @@ getDeviceWifiStatus(THapp tHapp, int times) async {
|
|||||||
}
|
}
|
||||||
// 继续监听
|
// 继续监听
|
||||||
return false;
|
return false;
|
||||||
}, times);
|
},
|
||||||
|
times,
|
||||||
|
);
|
||||||
|
if(!success){
|
||||||
|
return success;
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print(e);
|
print(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//只有4g并且没有wifi
|
||||||
Future<String> getDeviceNetVersion(THapp tHapp, int times) async {
|
Future<String> getDeviceNetVersion(THapp tHapp, int times) async {
|
||||||
edm.EasyDartModule.logger.info("发送请求设备的网络信息");
|
edm.EasyDartModule.logger.info("发送请求设备的网络信息");
|
||||||
DailyLogUtils.writeLog("发送请求设备的网络信息");
|
DailyLogUtils.writeLog("发送请求设备的网络信息");
|
||||||
|
|||||||
@@ -629,7 +629,7 @@ void initEasyDartModule() {
|
|||||||
try {
|
try {
|
||||||
EasyDartModule.init(
|
EasyDartModule.init(
|
||||||
loggerConfig:
|
loggerConfig:
|
||||||
LoggerConfig(host: ServiceConstant.logService, serviceName: "智慧眠花糖在线"),
|
LoggerConfig(host: ServiceConstant.logService, serviceName: "智慧眠花糖在线2025-10-9"),
|
||||||
webSocketConfig:
|
webSocketConfig:
|
||||||
WebSocketConfig(ServiceConstant.webSocketService, (data) {
|
WebSocketConfig(ServiceConstant.webSocketService, (data) {
|
||||||
// 接收到服务消息
|
// 接收到服务消息
|
||||||
|
|||||||
@@ -968,6 +968,10 @@ class _AfterWifiPagePersonState extends State<AfterWifiPagePerson> {
|
|||||||
// 连接设备
|
// 连接设备
|
||||||
// await targetDevice.device.connect();
|
// await targetDevice.device.connect();
|
||||||
THapp bledevice = THapp(device: targetDevice.device);
|
THapp bledevice = THapp(device: targetDevice.device);
|
||||||
|
bledevice.logingStream.listen((event) {
|
||||||
|
edm.EasyDartModule.logger.info("[wifi配置]:" + event);
|
||||||
|
print("[bleeeee]:" + event);
|
||||||
|
});
|
||||||
await bledevice.device.connect();
|
await bledevice.device.connect();
|
||||||
var res2 = bledevice.isConnected;
|
var res2 = bledevice.isConnected;
|
||||||
if (res2) {
|
if (res2) {
|
||||||
@@ -1021,6 +1025,7 @@ class _AfterWifiPagePersonState extends State<AfterWifiPagePerson> {
|
|||||||
fontSize: AppConstants().title_text_fontSize),
|
fontSize: AppConstants().title_text_fontSize),
|
||||||
));
|
));
|
||||||
// return;
|
// return;
|
||||||
|
await initWifiStatusAndWifiList();
|
||||||
} else if (aa == 'unknown') {
|
} else if (aa == 'unknown') {
|
||||||
blueteethBindController.netType.value = 3;
|
blueteethBindController.netType.value = 3;
|
||||||
blueteethBindController.updateAll();
|
blueteethBindController.updateAll();
|
||||||
@@ -1032,6 +1037,7 @@ class _AfterWifiPagePersonState extends State<AfterWifiPagePerson> {
|
|||||||
textColor: themeController.currentColor.sc9,
|
textColor: themeController.currentColor.sc9,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
await initWifiStatusAndWifiList();
|
||||||
} else {
|
} else {
|
||||||
blueteethBindController.netType.value = 1;
|
blueteethBindController.netType.value = 1;
|
||||||
blueteethBindController.updateAll();
|
blueteethBindController.updateAll();
|
||||||
|
|||||||
@@ -220,6 +220,7 @@ class _HomePageState extends State<MainPageBBottomChange>
|
|||||||
type: 1,
|
type: 1,
|
||||||
)));
|
)));
|
||||||
await Future.delayed(Duration(seconds: 1));
|
await Future.delayed(Duration(seconds: 1));
|
||||||
|
//5 广播
|
||||||
edm.EasyDartModule.websocket.sendData(jsonEncode(
|
edm.EasyDartModule.websocket.sendData(jsonEncode(
|
||||||
WebSocketMessage(path: "/smartbed/connect", type: 5, data: {
|
WebSocketMessage(path: "/smartbed/connect", type: 5, data: {
|
||||||
'mac': webviewTestController.selectDevice['mac'],
|
'mac': webviewTestController.selectDevice['mac'],
|
||||||
|
|||||||
@@ -583,7 +583,8 @@ class _MHTWifiPageState extends State<MHTWifiPage> {
|
|||||||
.wifiStatus
|
.wifiStatus
|
||||||
.value =
|
.value =
|
||||||
aa != null ? 1 : 0;
|
aa != null ? 1 : 0;
|
||||||
if (aa != null) {
|
if (aa != null&&
|
||||||
|
aa != false) {
|
||||||
updateDeviceBindStatus(
|
updateDeviceBindStatus(
|
||||||
blueteethBindController
|
blueteethBindController
|
||||||
.currentDeviceMac!
|
.currentDeviceMac!
|
||||||
@@ -598,6 +599,9 @@ class _MHTWifiPageState extends State<MHTWifiPage> {
|
|||||||
.sc2,
|
.sc2,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
blueteethBindController
|
||||||
|
.connect_wifi
|
||||||
|
.value = {};
|
||||||
TopSlideNotification
|
TopSlideNotification
|
||||||
.show(
|
.show(
|
||||||
context,
|
context,
|
||||||
@@ -609,6 +613,9 @@ class _MHTWifiPageState extends State<MHTWifiPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
blueteethBindController
|
||||||
|
.connect_wifi
|
||||||
|
.value = {};
|
||||||
TopSlideNotification.show(
|
TopSlideNotification.show(
|
||||||
context,
|
context,
|
||||||
text: "配网失败".tr,
|
text: "配网失败".tr,
|
||||||
@@ -619,6 +626,7 @@ class _MHTWifiPageState extends State<MHTWifiPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize:
|
mainAxisSize:
|
||||||
@@ -973,7 +981,7 @@ class _MHTWifiPageState extends State<MHTWifiPage> {
|
|||||||
blueteethBindController.blueConnectFlag.value = 2;
|
blueteethBindController.blueConnectFlag.value = 2;
|
||||||
TopSlideNotification.show(
|
TopSlideNotification.show(
|
||||||
context,
|
context,
|
||||||
text: "蓝牙绑定.连接成功".tr,
|
text: "连接成功".tr,
|
||||||
textColor: themeController.currentColor.sc2,
|
textColor: themeController.currentColor.sc2,
|
||||||
);
|
);
|
||||||
blueteethBindController.currentDevice = bledevice;
|
blueteethBindController.currentDevice = bledevice;
|
||||||
|
|||||||
@@ -526,6 +526,12 @@ class _MHTWifiAfterPageState extends State<MHTWifiAfterPage> {
|
|||||||
wifiItem['ssid'] ??
|
wifiItem['ssid'] ??
|
||||||
'未命名'.tr,
|
'未命名'.tr,
|
||||||
onConfirm: () async {
|
onConfirm: () async {
|
||||||
|
blueteethBindController
|
||||||
|
.currentDevice!
|
||||||
|
.logingStream
|
||||||
|
.listen((event) {
|
||||||
|
ef.log("[命令日志]:$event");
|
||||||
|
});
|
||||||
blueteethBindController
|
blueteethBindController
|
||||||
.selectWifi
|
.selectWifi
|
||||||
.value = wifiItem;
|
.value = wifiItem;
|
||||||
@@ -539,7 +545,7 @@ class _MHTWifiAfterPageState extends State<MHTWifiAfterPage> {
|
|||||||
var aa = await getDeviceWifiStatus(
|
var aa = await getDeviceWifiStatus(
|
||||||
blueteethBindController
|
blueteethBindController
|
||||||
.currentDevice!,
|
.currentDevice!,
|
||||||
1);
|
1,link: true);
|
||||||
blueteethBindController
|
blueteethBindController
|
||||||
.selectWifi
|
.selectWifi
|
||||||
.value = {};
|
.value = {};
|
||||||
@@ -556,8 +562,12 @@ class _MHTWifiAfterPageState extends State<MHTWifiAfterPage> {
|
|||||||
blueteethBindController
|
blueteethBindController
|
||||||
.wifiStatus
|
.wifiStatus
|
||||||
.value =
|
.value =
|
||||||
aa != null ? 1 : 0;
|
(aa != null &&
|
||||||
if (aa != null) {
|
aa != false)
|
||||||
|
? 1
|
||||||
|
: 0;
|
||||||
|
if (aa != null &&
|
||||||
|
aa != false) {
|
||||||
updateDeviceBindStatus(
|
updateDeviceBindStatus(
|
||||||
blueteethBindController
|
blueteethBindController
|
||||||
.currentDeviceMac!
|
.currentDeviceMac!
|
||||||
@@ -572,6 +582,9 @@ class _MHTWifiAfterPageState extends State<MHTWifiAfterPage> {
|
|||||||
.sc2,
|
.sc2,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
blueteethBindController
|
||||||
|
.connect_wifi
|
||||||
|
.value = {};
|
||||||
TopSlideNotification
|
TopSlideNotification
|
||||||
.show(
|
.show(
|
||||||
context,
|
context,
|
||||||
@@ -583,6 +596,9 @@ class _MHTWifiAfterPageState extends State<MHTWifiAfterPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
blueteethBindController
|
||||||
|
.connect_wifi
|
||||||
|
.value = {};
|
||||||
TopSlideNotification.show(
|
TopSlideNotification.show(
|
||||||
context,
|
context,
|
||||||
text: "配网失败".tr,
|
text: "配网失败".tr,
|
||||||
@@ -947,7 +963,7 @@ class _MHTWifiAfterPageState extends State<MHTWifiAfterPage> {
|
|||||||
blueteethBindController.blueConnectFlag.value = 2;
|
blueteethBindController.blueConnectFlag.value = 2;
|
||||||
TopSlideNotification.show(
|
TopSlideNotification.show(
|
||||||
context,
|
context,
|
||||||
text: "蓝牙绑定.连接成功".tr,
|
text: "连接成功".tr,
|
||||||
textColor: themeController.currentColor.sc2,
|
textColor: themeController.currentColor.sc2,
|
||||||
);
|
);
|
||||||
blueteethBindController.currentDevice = bledevice;
|
blueteethBindController.currentDevice = bledevice;
|
||||||
|
|||||||
@@ -563,7 +563,10 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
|
|||||||
onFailure: (res) {
|
onFailure: (res) {
|
||||||
EasyDartModule.logger.warning("请求睡眠信息列表失败: ${res.msg}");
|
EasyDartModule.logger.warning("请求睡眠信息列表失败: ${res.msg}");
|
||||||
TopSlideNotification.show(context,
|
TopSlideNotification.show(context,
|
||||||
text: "请求失败".tr, textColor: themeController.currentColor.sc9);
|
text: res.msg ?? "请求失败".tr,
|
||||||
|
textColor: themeController.currentColor.sc9);
|
||||||
|
homeSleepDays.value = [];
|
||||||
|
updateAll();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user