[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{
[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;