From: liangzhenying <867174124@qq.com> Date: Tue, 16 Apr 2024 03:38:59 +0000 (+0800) Subject: 整理SDK架构资料 X-Git-Tag: 阿里鉴权^0 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=5b8bf4327ce1adfcf9ffc6494c8cf25ec19dfbe6;p=mirrors%2FMouseSdk-MacOS.git 整理SDK架构资料 --- diff --git "a/Document/AiMouseSDK\346\225\260\346\215\256\344\272\244\344\272\222\346\265\201\347\250\213.pdf" "b/Document/AiMouseSDK\346\225\260\346\215\256\344\272\244\344\272\222\346\265\201\347\250\213.pdf" deleted file mode 100644 index fa7982d..0000000 Binary files "a/Document/AiMouseSDK\346\225\260\346\215\256\344\272\244\344\272\222\346\265\201\347\250\213.pdf" and /dev/null differ diff --git "a/Document/MouseSdk\346\225\260\346\215\256\344\272\244\344\272\222\346\265\201\347\250\213.pdf" "b/Document/MouseSdk\346\225\260\346\215\256\344\272\244\344\272\222\346\265\201\347\250\213.pdf" new file mode 100644 index 0000000..34a9806 Binary files /dev/null and "b/Document/MouseSdk\346\225\260\346\215\256\344\272\244\344\272\222\346\265\201\347\250\213.pdf" differ diff --git "a/Document/MouseSdk\346\226\207\346\241\243.zip" "b/Document/MouseSdk\346\226\207\346\241\243.zip" new file mode 100644 index 0000000..c2cf0fa Binary files /dev/null and "b/Document/MouseSdk\346\226\207\346\241\243.zip" differ diff --git "a/Document/MouseSdk\346\226\207\346\241\243/AiMouse.h" "b/Document/MouseSdk\346\226\207\346\241\243/AiMouse.h" new file mode 100644 index 0000000..c8f174b --- /dev/null +++ "b/Document/MouseSdk\346\226\207\346\241\243/AiMouse.h" @@ -0,0 +1,85 @@ +// +// Ai.h +// AiMouse +// +// Created by incar on 2024/2/28. +// + +#import +#import + +typedef NS_ENUM(NSInteger,AiMouseConnectType) { + AiMouseConnectType_bluetooth = 0,///蓝牙 + AiMouseConnectType_hid,///hid +}; + +typedef NS_ENUM(NSInteger,AiMouseAuthState) { + AiMouseAuthState_Unknow = 0,///未知 + AiMouseAuthState_Success,///鉴权成功 + AiMouseAuthState_Failure///鉴权失败 +}; + +@protocol AiMouseDelegate + +/// 鉴权数据回调,需要将此数据通过鉴权特征转发给蓝牙设备 +/// - Parameter data: 数据 +- (void)aiMouseSendAuthData:(NSData *)data; + +/// 设备信息数据回调,需要将此数据通过设备信息特征转发给蓝牙设备 +/// - Parameter data: 数据 +- (void)aiMouseSendDeviceInfoData:(NSData *)data; + +/// 鼠标按键指令回调 +/// - Parameter data: 数据。 +/// 前 第一次单击31(开始录音), 第二次单击32(结束录音) , 按下21(开始录音)抬起22(结束录音) +/// 中 单击42, 按下25(开始录音)抬起26(结束录音) +/// 后 单击43,按下27(开始录音)抬起28(结束录音) +/// 其他未定义 +- (void)aiMouseSendCmdData:(NSData *)data; + +/// 录音回调 +/// - Parameter data: pcm格式语音数据 +- (void)aiMouseSendRecordData:(NSData *)data; + +@end + +@interface AiMouse : NSObject +@property (nonatomic, readonly) NSString *version;/// 版本号 +@property (nonatomic, weak) id delegate;/// 代理 +@property (nonatomic, readonly) AiMouseConnectType connectType;//连接类型 +@property (nonatomic, readonly) AiMouseAuthState authState;/// 鉴权状态,默认是Unknow。所以必须在连上蓝牙设备找到鉴权特征后,需要主动调用startAuthentication方法去鉴权。(只有鉴权成功,AI功能才可用) + +/// 单利 ++(AiMouse *)shared; + +/// 切换连接类型 +/// - Parameter type: 连接类型 +- (void)switchConnect:(AiMouseConnectType)type; + +/// 开始鉴权 +/// - Parameter finished: 鉴权结果回调 +- (void)startAuthentication:(void (^)(AiMouseAuthState state))finished; + +/// 传输鉴权数据给sdk +/// - Parameter data: 鉴权特征传过来的数据 +- (void)sendAuthDataToSdk:(NSData *)data; + +/// 传输业务数据给sdk +/// - Parameter data:ai特征传过来的数据 +- (void)sendAiDataToSdk:(NSData *)data; + +/// 传输设备信息数据给sdk +/// - Parameter data:设备信息特征传过来的数据 +- (void)sendDeviceDataToSdk:(NSData *)data; + +/// 获取设备信息 +/// - Parameter completation: 如果获取成功,则deviceInfo有值,否则为空 +- (void)getDeviceInfo:(void (^)(AiMouseDeviceInfo *deviceInfo,NSError *error))completation; + +/// 设置CPI +/// - Parameters: +/// - value: AiMouseDeviceInfo 中可以设置的值CPI_list +/// - finished: 设置结果回调 +- (void)setCPI:(NSInteger)value completation:(void (^)(BOOL isSuccess,NSError *error))finished; +@end + diff --git "a/Document/MouseSdk\346\226\207\346\241\243/MouseSdk\346\225\260\346\215\256\344\272\244\344\272\222\346\265\201\347\250\213.pdf" "b/Document/MouseSdk\346\226\207\346\241\243/MouseSdk\346\225\260\346\215\256\344\272\244\344\272\222\346\265\201\347\250\213.pdf" new file mode 100644 index 0000000..34a9806 Binary files /dev/null and "b/Document/MouseSdk\346\226\207\346\241\243/MouseSdk\346\225\260\346\215\256\344\272\244\344\272\222\346\265\201\347\250\213.pdf" differ diff --git "a/Document/MouseSdk\346\226\207\346\241\243/\351\211\264\346\235\203\346\265\201\347\250\213.pdf" "b/Document/MouseSdk\346\226\207\346\241\243/\351\211\264\346\235\203\346\265\201\347\250\213.pdf" new file mode 100644 index 0000000..46404c3 Binary files /dev/null and "b/Document/MouseSdk\346\226\207\346\241\243/\351\211\264\346\235\203\346\265\201\347\250\213.pdf" differ diff --git "a/Document/MouseSdk\346\226\207\346\241\243/\351\243\236\351\270\237\351\241\277.jpg" "b/Document/MouseSdk\346\226\207\346\241\243/\351\243\236\351\270\237\351\241\277.jpg" new file mode 100644 index 0000000..06cc56b Binary files /dev/null and "b/Document/MouseSdk\346\226\207\346\241\243/\351\243\236\351\270\237\351\241\277.jpg" differ diff --git "a/Document/MouseSdk\346\226\207\346\241\243/\351\243\236\351\270\275\344\271\246.png" "b/Document/MouseSdk\346\226\207\346\241\243/\351\243\236\351\270\275\344\271\246.png" new file mode 100644 index 0000000..5e0afa4 Binary files /dev/null and "b/Document/MouseSdk\346\226\207\346\241\243/\351\243\236\351\270\275\344\271\246.png" differ diff --git "a/Document/\346\225\260\346\215\256\344\272\244\344\272\222\346\265\201\347\250\213.eddx" "b/Document/\346\225\260\346\215\256\344\272\244\344\272\222\346\265\201\347\250\213.eddx" index e90b6f1..61cbc39 100644 Binary files "a/Document/\346\225\260\346\215\256\344\272\244\344\272\222\346\265\201\347\250\213.eddx" and "b/Document/\346\225\260\346\215\256\344\272\244\344\272\222\346\265\201\347\250\213.eddx" differ diff --git "a/Document/\346\225\260\346\215\256\344\272\244\344\272\222\346\265\201\347\250\213.pdf" "b/Document/\346\225\260\346\215\256\344\272\244\344\272\222\346\265\201\347\250\213.pdf" deleted file mode 100644 index aa3618e..0000000 Binary files "a/Document/\346\225\260\346\215\256\344\272\244\344\272\222\346\265\201\347\250\213.pdf" and /dev/null differ diff --git "a/Document/\346\225\260\346\215\256\344\272\244\344\272\222\346\265\201\347\250\213.png" "b/Document/\346\225\260\346\215\256\344\272\244\344\272\222\346\265\201\347\250\213.png" deleted file mode 100644 index ba4b941..0000000 Binary files "a/Document/\346\225\260\346\215\256\344\272\244\344\272\222\346\265\201\347\250\213.png" and /dev/null differ diff --git "a/Document/\351\211\264\346\235\203\346\265\201\347\250\213.pdf" "b/Document/\351\211\264\346\235\203\346\265\201\347\250\213.pdf" new file mode 100644 index 0000000..46404c3 Binary files /dev/null and "b/Document/\351\211\264\346\235\203\346\265\201\347\250\213.pdf" differ diff --git "a/Document/\351\243\236\351\270\237\351\241\277.jpg" "b/Document/\351\243\236\351\270\237\351\241\277.jpg" new file mode 100644 index 0000000..06cc56b Binary files /dev/null and "b/Document/\351\243\236\351\270\237\351\241\277.jpg" differ diff --git "a/Document/\351\243\236\351\270\275\344\271\246.png" "b/Document/\351\243\236\351\270\275\344\271\246.png" new file mode 100644 index 0000000..5e0afa4 Binary files /dev/null and "b/Document/\351\243\236\351\270\275\344\271\246.png" differ diff --git a/MouseSdk/AiMouseSdk/AiMouse.m b/MouseSdk/AiMouseSdk/AiMouse.m index 4f5ef2a..486d715 100644 --- a/MouseSdk/AiMouseSdk/AiMouse.m +++ b/MouseSdk/AiMouseSdk/AiMouse.m @@ -248,7 +248,7 @@ NSMutableString *str1 = [NSMutableString stringWithString:str]; NSString *sendStr = [NSString stringWithFormat:@"-$$%@$$-\n",str1]; NSData *sendData = [sendStr dataUsingEncoding:NSUTF8StringEncoding]; - [self showLog:[NSString stringWithFormat:@"发送的鉴权数据 = %@",sendStr]]; +// [self showLog:[NSString stringWithFormat:@"发送的鉴权数据 = %@",sendStr]]; if (self.delegate) { [self.delegate aiMouseSendAuthData:sendData]; @@ -260,7 +260,7 @@ NSString *sendStr = [NSString stringWithFormat:@"-$$%@$$-",str]; NSData *sendData = [sendStr dataUsingEncoding:NSUTF8StringEncoding]; - [self showLog:[NSString stringWithFormat:@"发送的鉴权数据 = %@",sendStr]]; +// [self showLog:[NSString stringWithFormat:@"发送的鉴权数据 = %@",sendStr]]; NSInteger len = 39; for (NSInteger i = 0; i < sendData.length;i = i+len) { @@ -283,7 +283,7 @@ NSMutableString *str1 = [NSMutableString stringWithString:str]; NSString *sendStr = [NSString stringWithFormat:@"-$$%@$$-\n",str1]; NSData *sendData = [sendStr dataUsingEncoding:NSUTF8StringEncoding]; - [self showLog:[NSString stringWithFormat:@"发送的设备信息数据 = %@",sendStr]]; +// [self showLog:[NSString stringWithFormat:@"发送的设备信息数据 = %@",sendStr]]; if (self.delegate) { [self.delegate aiMouseSendDeviceInfoData:sendData]; } @@ -314,7 +314,7 @@ [self setAuthStateToDevice:isSuccess]; } - (void)showLog:(NSString *)log{ -// NSLog(@"[sdk]%@",log); + NSLog(@"[sdk]%@",log); } - (void)sendTestLP{ diff --git a/MouseSdk/MouseSdk.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate b/MouseSdk/MouseSdk.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate index 9e4b21d..7829273 100644 Binary files a/MouseSdk/MouseSdk.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate and b/MouseSdk/MouseSdk.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/MouseSdk/MouseSdk/HidManager.m b/MouseSdk/MouseSdk/HidManager.m index 0342627..d7dec15 100644 --- a/MouseSdk/MouseSdk/HidManager.m +++ b/MouseSdk/MouseSdk/HidManager.m @@ -205,7 +205,7 @@ static void hidReceiveData(void* context, IOReturn result, void* sender, IOHIDRe [self showLog:@"请先连上设备"]; return; } - [self showLog:[NSString stringWithFormat:@"开始发送[send] %@\n%@",[AiMouseTools dataToHexString:data],[AiMouseTools dataToUtf8String:data]]]; + [self showLog:[NSString stringWithFormat:@"开始发送[send] %@",[AiMouseTools dataToHexString:data]]]; IOReturn ret = IOHIDDeviceSetReport(device, kIOHIDReportTypeOutput, 0, data.bytes, data.length); if (ret != kIOReturnSuccess) { diff --git a/MouseSdk_Mac_20240407/MouseSdkDemo/MouseSdkDemo.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate b/MouseSdk_Mac_20240407/MouseSdkDemo/MouseSdkDemo.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate index eadf8fc..224b923 100644 Binary files a/MouseSdk_Mac_20240407/MouseSdkDemo/MouseSdkDemo.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate and b/MouseSdk_Mac_20240407/MouseSdkDemo/MouseSdkDemo.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate differ