<key>AiMouseSdk copy.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
- <integer>2</integer>
+ <integer>4</integer>
</dict>
<key>AiMouseSdk.xcscheme_^#shared#^_</key>
<dict>
[ws switchConnect:ws.connectType isConnected:false];
return;
}
- if ([DeviceManger shared].appType == 2 || [DeviceManger shared].appType == 4) {
- [self.byteSdk startAuth:^(ByteDanceInfo *info) {
+// if ([DeviceManger shared].appType == 2 || [DeviceManger shared].appType == 4) {
+ if (([DeviceManger shared].appType == 2 || [DeviceManger shared].appType == 4) && ws.byteSdk.info == nil) {
+ [ws.byteSdk startAuth:^(ByteDanceInfo *info) {
deviceInfo.byteAuthInfo = info;
[ws showLog:deviceInfo.description];
- if([self.delegate respondsToSelector:@selector(aiMouseConnectStateDidChange:)]) [self.delegate aiMouseConnectStateDidChange:self.connected];
- if(self.delegate) [self.delegate aiMouseAuthenticationResult:true];
+ if([ws.delegate respondsToSelector:@selector(aiMouseConnectStateDidChange:)]) [ws.delegate aiMouseConnectStateDidChange:ws.connected];
+ if(ws.delegate) [ws.delegate aiMouseAuthenticationResult:true];
}];
}
else{
- (void)checkAuthSuccess{
if (self.info.urlParams && self.info.expireTime && self.info.token && self.info.host) {
- if(self.byteDanceAuthInfoCallback)self.byteDanceAuthInfoCallback(self.info);
- stb_app_stop_identify();
+ if(self.byteDanceAuthInfoCallback){
+ self.byteDanceAuthInfoCallback(self.info);
+ }
+// [self performSelector:@selector(stopAuth) withObject:nil afterDelay:5];
}
}
+- (void)stopAuth{
+ stb_app_stop_identify();
+}
- (void)sendCmdToBle:(NSDictionary *)dict{
NSData *data = [AiMouseTools dictionaryToData:dict];
NSString *str = [AiMouseTools dataToUtf8String:data];
NSMutableData *fullData = [[NSMutableData alloc] init];
uint8_t head[] = { 0x2d, 0x24, 0x24};
- uint8_t tail[] = {0x24, 0x24,0x2d,0x0a};
+ uint8_t tail[] = {0x24, 0x24,0x2d};
[fullData appendBytes:&head length:3];
[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];
+ }
+ }
+
[[AiMouse shared] sendToBle:fullData];
return 0;
}
// [self setupBle];
// [self setupHid];
// [self setupTimer];
- self.version = @"MouseSdk_v2024122602";
+ self.version = @"MouseSdk_v2025010301";
}
return self;
}
}
///获取设备信息
- (void)getDeviceInfo:(void (^)(AiMouseDeviceInfo *deviceInfo,NSError *error))finished{
+ [self showLog:@"app主动获取设备信息 。。。"];
if(self.productType == AiMouseProductType_keyboard){
[self.kbSdk getDeviceInfo:finished];
}
#import <Carbon/Carbon.h>
#import <Cocoa/Cocoa.h>
#import "AiDeviceAuthManager.h"
-
+#import "TlwTools.h"
@interface HidManager ()
@property(nonatomic, assign) IOHIDManagerRef hidManager;///hid管理
@property(nonatomic, assign) IOHIDDeviceRef deviceInfoCha;//设备信息通道
}
else{
NSData *data1 = [[NSData alloc] initWithBytes:report length:reportLength];
- // [[HidManager shared] showLog:[NSString stringWithFormat:@"receive = %@",data1]];
+ [[HidManager shared] showLog:[NSString stringWithFormat:@"收到usb = %@",[TlwTools dataToHexString:data1]]];
NSInteger len = get_data_len(report, reportLength);
NSData *data = [[NSData alloc] initWithBytes:report length:len];
if(self.logCallBack) self.logCallBack(text);
}
+///// 实际到数据长度
+//static inline int get_data_len(uint8_t *buf, u_long len) {
+// if (len <= 0 ) return 0;
+// int url_len = 0;
+// while (buf[url_len] != 0x00) url_len++;
+// return url_len;
+//}
+
/// 实际到数据长度
-static inline int get_data_len(uint8_t *buf, u_long len) {
+static inline int get_data_len(uint8_t *buf, int len) {
if (len <= 0 ) return 0;
- int url_len = 0;
- while (buf[url_len] != 0x00) url_len++;
- return url_len;
+ int end = len - 1;
+ while (end >= 0 && (buf[end] == 0 || buf[end - 1] == 0)) {
+ end--;
+ }
+ return end + 1;
}
/// 获取对应属性值
version = "2.0">
<Breakpoints>
<BreakpointProxy
- BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+ BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
- uuid = "29B61A37-1C91-4041-B4D4-6808C309F66F"
+ uuid = "B13C82BB-F468-4E93-A44A-F14FFAD4D10D"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
- filePath = "AiMouseSdk/AiMouseSdk/AiDeviceInfoManager.m"
- startingColumnNumber = "9223372036854775807"
- endingColumnNumber = "9223372036854775807"
- startingLineNumber = "510"
- endingLineNumber = "510"
- landmarkName = "-sendCmdToBle:"
- landmarkType = "7">
+ breakpointStackSelectionBehavior = "1"
+ scope = "1"
+ stopOnStyle = "0">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
#pragma mark - action
- (void)setupDeviceManger{
DeviceManger *manager = [DeviceManger shared];
- [manager initSdk:1];
- manager.debugLevel = 1;
+ [manager initSdk:2];
+ manager.debugLevel = 2;
__weak typeof(self) ws = self;
// manager.aiMouseAddLogCallBack = ^(NSString * _Nonnull log) {
<key>Masonry.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
- <integer>3</integer>
+ <integer>2</integer>
</dict>
<key>Pods-MouseSdk.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
- <integer>4</integer>
+ <integer>3</integer>
</dict>
</dict>
</dict>