修复蓝牙连接休眠后无法使用APPbug
authorliangzhenying <867174124@qq.com>
Thu, 5 Jun 2025 04:23:57 +0000 (12:23 +0800)
committerliangzhenying <867174124@qq.com>
Thu, 5 Jun 2025 04:23:57 +0000 (12:23 +0800)
MouseSdk/AiMouseSdk/Manager/BleManager.m
MouseSdk/MouseSdk/ViewController.m

index 3b4cb75..c8d992b 100644 (file)
     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) {
 }
 
 - (void)disconnected{
+    self.connectStateCallBack(@"",false);
     self.curentPeripheral = nil;
+    
 }
 @end
index 5f3d8f8..5f6ab4c 100644 (file)
     if ([DeviceManger shared].isConneted) {
         [self geviceInfoAction];
     }
-   [self performSelector:@selector(getDeviceIinfo) withObject:nil afterDelay:1];
+   [self performSelector:@selector(getDeviceIinfo) withObject:nil afterDelay:5];
 }
 @end