From: liangzhenying <867174124@qq.com> Date: Thu, 5 Jun 2025 04:23:57 +0000 (+0800) Subject: 修复蓝牙连接休眠后无法使用APPbug X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=8b41ac8fb5c8c22c6f90983464e18f36b3f4b814;p=mirrors%2FMouseSdk-MacOS.git 修复蓝牙连接休眠后无法使用APPbug --- diff --git a/MouseSdk/AiMouseSdk/Manager/BleManager.m b/MouseSdk/AiMouseSdk/Manager/BleManager.m index 3b4cb75..c8d992b 100644 --- a/MouseSdk/AiMouseSdk/Manager/BleManager.m +++ b/MouseSdk/AiMouseSdk/Manager/BleManager.m @@ -273,6 +273,11 @@ if (self.deviceInfoCha ==nil) { return; } + if(self.curentPeripheral.state == CBPeripheralStateDisconnected){ + [self showLog:@"蓝牙已经断开连接"]; + [self disconnected]; + return; + } [self showLog:[NSString stringWithFormat:@"向蓝牙设备发送数据 %@\n%@",self.deviceInfoCha,data]]; if (self.productType == AiMouseProductType_tlw) { @@ -320,6 +325,8 @@ } - (void)disconnected{ + self.connectStateCallBack(@"",false); self.curentPeripheral = nil; + } @end diff --git a/MouseSdk/MouseSdk/ViewController.m b/MouseSdk/MouseSdk/ViewController.m index 5f3d8f8..5f6ab4c 100644 --- a/MouseSdk/MouseSdk/ViewController.m +++ b/MouseSdk/MouseSdk/ViewController.m @@ -205,6 +205,6 @@ if ([DeviceManger shared].isConneted) { [self geviceInfoAction]; } - [self performSelector:@selector(getDeviceIinfo) withObject:nil afterDelay:1]; + [self performSelector:@selector(getDeviceIinfo) withObject:nil afterDelay:5]; } @end