连接上设备获取到设备信息立即通知sdk ByteDance
authorliangzhenying <867174124@qq.com>
Tue, 7 Jan 2025 06:11:02 +0000 (14:11 +0800)
committerliangzhenying <867174124@qq.com>
Tue, 7 Jan 2025 06:11:02 +0000 (14:11 +0800)
MouseSdk/AiMouseSdk/AiMouseSdk/AiMouseSdk.m
MouseSdk/AiMouseSdk/ByteDance/ByteDanceSdk.m
MouseSdk/AiMouseSdk/Manager/DeviceManger.m
MouseSdk/MouseSdk.xcworkspace/xcuserdata/yaozuopan.xcuserdatad/UserInterfaceState.xcuserstate

index fd5fabf..749e1ae 100644 (file)
                 [ws switchConnect:ws.connectType isConnected:false];
                 return;
             }
-//            if ([DeviceManger shared].appType == 2 || [DeviceManger shared].appType == 4) {
-            if (([DeviceManger shared].appType == 2 || [DeviceManger shared].appType == 4) && ws.byteSdk.info == nil) {
+//            if (([DeviceManger shared].appType == 2 || [DeviceManger shared].appType == 4) && ws.byteSdk.info.token == nil) {
+//                [ws.byteSdk startAuth:^(ByteDanceInfo *info) {
+//                    deviceInfo.byteAuthInfo = info;
+//                    [ws showLog:deviceInfo.description];
+//                    if([ws.delegate respondsToSelector:@selector(aiMouseConnectStateDidChange:)]) [ws.delegate aiMouseConnectStateDidChange:ws.connected];
+//                    if(ws.delegate) [ws.delegate aiMouseAuthenticationResult:true];
+//                }];
+//            }
+//            else{
+//                if([ws.delegate respondsToSelector:@selector(aiMouseConnectStateDidChange:)]) [ws.delegate aiMouseConnectStateDidChange:ws.connected];
+//                if(ws.delegate) [ws.delegate aiMouseAuthenticationResult:true];
+//            }
+            
+            if (([DeviceManger shared].appType == 2 || [DeviceManger shared].appType == 4) && ws.byteSdk.info.token == nil) {
                 [ws.byteSdk startAuth:^(ByteDanceInfo *info) {
                     deviceInfo.byteAuthInfo = info;
                     [ws showLog:deviceInfo.description];
-                    if([ws.delegate respondsToSelector:@selector(aiMouseConnectStateDidChange:)]) [ws.delegate aiMouseConnectStateDidChange:ws.connected];
-                    if(ws.delegate) [ws.delegate aiMouseAuthenticationResult:true];
                 }];
+
             }
-            else{
+            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                 if([ws.delegate respondsToSelector:@selector(aiMouseConnectStateDidChange:)]) [ws.delegate aiMouseConnectStateDidChange:ws.connected];
                 if(ws.delegate) [ws.delegate aiMouseAuthenticationResult:true];
-            }            
+            });
         }];
     }
     else{
index c4deac4..c3dafdd 100644 (file)
@@ -212,13 +212,17 @@ int32_t STB_STDCALL cus_hal_send_data2device(uint8_t* data, uint32_t len)
         [fullData appendData:cmdData];
         [fullData appendBytes:&tail length:3];
     
-    if (fullData.length < 64) {
-        NSInteger len = 64 - fullData.length;
-        for (NSInteger i = 0; i < len; i++) {
-            uint8_t d = 0x00;
-            [fullData  appendBytes:&d length:1];
+    
+    if([AiMouse shared].connectType == AiMouseConnectType_hid){
+        if (fullData.length < 64) {
+            NSInteger len = 64 - fullData.length;
+            for (NSInteger i = 0; i < len; i++) {
+                uint8_t d = 0x00;
+                [fullData  appendBytes:&d length:1];
+            }
         }
     }
+
     
         [[AiMouse shared] sendToBle:fullData];
     return 0;
index 2f0617f..c74161b 100644 (file)
@@ -54,7 +54,7 @@
 //        [self setupBle];
 //        [self setupHid];
 //        [self setupTimer];
-        self.version = @"MouseSdk_v2025010301";
+        self.version = @"MouseSdk_v2025010303";
     }
     return self;
 }
index 16c4631..7b99edf 100644 (file)
Binary files a/MouseSdk/MouseSdk.xcworkspace/xcuserdata/yaozuopan.xcuserdatad/UserInterfaceState.xcuserstate and b/MouseSdk/MouseSdk.xcworkspace/xcuserdata/yaozuopan.xcuserdatad/UserInterfaceState.xcuserstate differ