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

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

View File

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

View File

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