修复自动开启传感器蓝牙日志

This commit is contained in:
wyf
2025-12-08 15:45:40 +08:00
parent 8285599aa9
commit ba145ba26f
4 changed files with 30 additions and 25 deletions

View File

@@ -10,6 +10,7 @@ import 'package:vbvs_app/common/util/DailyLogUtils.dart';
// wifi列表指令
getWifiList(THapp tHapp) async {
try {
await openDlog(tHapp);
print("wscan scan");
edm.EasyDartModule.logger.info("发送请求网络列表指令");
DailyLogUtils.writeLog("发送请求网络列表指令");
@@ -53,6 +54,7 @@ getWifiList(THapp tHapp) async {
}
getWifiStatus(THapp tHapp) async {
await openDlog(tHapp);
edm.EasyDartModule.logger.info("发送请求设备网络状态指令");
DailyLogUtils.writeLog("发送请求设备网络状态指令");
var result = await tHapp.send(
@@ -83,6 +85,7 @@ getWifiStatus(THapp tHapp) async {
Future<bool> sendWifiSetting(wifiItem, String password, THapp tHapp) async {
try {
await openDlog(tHapp);
edm.EasyDartModule.logger.info("发送wifi配置指令");
DailyLogUtils.writeLog("发送wifi配置指令->");
// String cmd = "vtouch save update -a -i .wifi.sta.auth=${wifiItem['auth']} "
@@ -119,6 +122,7 @@ getDeviceWifiStatus(
int times, {
bool link = false,
}) async {
await openDlog(tHapp);
DailyLogUtils.writeLog("发送请求设备已配置网络状态指令");
bool success = false;
final now = DateTime.now();
@@ -203,6 +207,7 @@ getDeviceWifiStatus(
//只有4g并且没有wifi
Future<String> getDeviceNetVersion(THapp tHapp, int times) async {
await openDlog(tHapp);
edm.EasyDartModule.logger.info("发送请求设备的网络信息");
DailyLogUtils.writeLog("发送请求设备的网络信息");
print("ls /root/mnt");
@@ -240,6 +245,7 @@ Future<String> getDeviceNetVersion(THapp tHapp, int times) async {
/// 发送关闭blog日志与开启业务日志的指令
Future<bool> sendBlogAndDlogCommands(THapp tHapp) async {
await openDlog(tHapp);
edm.EasyDartModule.logger.info("发送 blog disable 与 dlog on business 指令");
DailyLogUtils.writeLog("发送 blog disable 与 dlog on business 指令");
try {
@@ -293,6 +299,7 @@ Future<bool> sendBlogAndDlogCommands(THapp tHapp) async {
/// 执行 wscan close -> 延迟 1s -> wscan open
Future<bool> sendCloseAndOpenWscanCommand(THapp tHapp) async {
await openDlog(tHapp);
edm.EasyDartModule.logger.info("执行 wscan close -> wscan open 指令");
DailyLogUtils.writeLog("执行 wscan close -> wscan open 指令开始");
@@ -336,7 +343,6 @@ Future<bool> sendCloseAndOpenWscanCommand(THapp tHapp) async {
}
}
/// 查询设备内存状态(指令: free all
///
/// 示例返回:
@@ -346,6 +352,7 @@ Future<bool> sendCloseAndOpenWscanCommand(THapp tHapp) async {
/// 若匹配到“关键内存剩余:xxxx 字节”,其中 xxxx < 20000 返回 false
/// 否则返回 true。
Future<bool> queryMemory(THapp tHapp, {int times = 1}) async {
await openDlog(tHapp);
edm.EasyDartModule.logger.info("发送查询内存状态指令 (free all)");
DailyLogUtils.writeLog("发送查询内存状态指令 (free all)");
@@ -358,8 +365,7 @@ Future<bool> queryMemory(THapp tHapp, {int times = 1}) async {
final match = RegExp(r'关键内存剩余:(\d+)\s*字节').firstMatch(log);
if (match != null) {
final freeValue = int.tryParse(match.group(1) ?? "0") ?? 0;
edm.EasyDartModule.logger
.info("提取到关键内存剩余: $freeValue 字节");
edm.EasyDartModule.logger.info("提取到关键内存剩余: $freeValue 字节");
DailyLogUtils.writeLog("提取到关键内存剩余: $freeValue 字节");
// 判断内存是否充足
@@ -375,8 +381,7 @@ Future<bool> queryMemory(THapp tHapp, {int times = 1}) async {
// result 就是 send 内部设置的 ss.result
if (result is bool) {
edm.EasyDartModule.logger
.info("内存检测结果 -> ${result ? "充足" : "不足"}");
edm.EasyDartModule.logger.info("内存检测结果 -> ${result ? "充足" : "不足"}");
DailyLogUtils.writeLog("内存检测结果 -> ${result ? "充足" : "不足"}");
return result;
}
@@ -391,12 +396,12 @@ Future<bool> queryMemory(THapp tHapp, {int times = 1}) async {
}
}
/// 重启设备指令
///
/// 发送 "reboot" 命令,若响应中包含 reboot / restart / ok / success 等关键字
/// 视为执行成功,返回 true否则返回 false。
Future<bool> rebootDevice(THapp tHapp) async {
await openDlog(tHapp);
edm.EasyDartModule.logger.info("发送设备重启指令 (reboot)");
DailyLogUtils.writeLog("发送设备重启指令 (reboot)");
@@ -440,4 +445,6 @@ Future<bool> rebootDevice(THapp tHapp) async {
}
}
openDlog(THapp tHapp) async {
await tHapp.send("dlog on hal");
}

View File

@@ -358,7 +358,6 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
// WIFI 配置 —— 单独判断
if (hasBasePermission || hasWifiPermission) {
if (hasWifiPermission) {
items.add(
_buildMenuItem(
text: "WIFI配置".tr,
@@ -372,7 +371,6 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
},
),
);
}
// 下面这些 **只受 hasBasePermission 影响**
if (hasBasePermission) {

View File

@@ -690,7 +690,7 @@ class _MinePageState extends State<MinePage> {
mainAxisSize: MainAxisSize.max,
children: [
Text(
'V1.0.2512.03',
'V1.0.2512.08',
style: TextStyle(
fontFamily: 'Inter',
// color: Color(0xFFD9E3EB),

View File

@@ -44,8 +44,8 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
web = WebviewHelper(
isheadless: false,
jsbridge: buildsdk(
// father: this,
// clientId: '494641114',
father: this,
clientId: '494641114',
// clientId: '123',
// dbgserverUrl: 'ws://192.168.1.2:9001',
),