整理SDK架构资料 阿里鉴权
authorliangzhenying <867174124@qq.com>
Tue, 16 Apr 2024 03:38:59 +0000 (11:38 +0800)
committerliangzhenying <867174124@qq.com>
Tue, 16 Apr 2024 03:38:59 +0000 (11:38 +0800)
18 files changed:
Document/AiMouseSDK数据交互流程.pdf [deleted file]
Document/MouseSdk数据交互流程.pdf [new file with mode: 0644]
Document/MouseSdk文档.zip [new file with mode: 0644]
Document/MouseSdk文档/AiMouse.h [new file with mode: 0644]
Document/MouseSdk文档/MouseSdk数据交互流程.pdf [new file with mode: 0644]
Document/MouseSdk文档/鉴权流程.pdf [new file with mode: 0644]
Document/MouseSdk文档/飞鸟顿.jpg [new file with mode: 0644]
Document/MouseSdk文档/飞鸽书.png [new file with mode: 0644]
Document/数据交互流程.eddx
Document/数据交互流程.pdf [deleted file]
Document/数据交互流程.png [deleted file]
Document/鉴权流程.pdf [new file with mode: 0644]
Document/飞鸟顿.jpg [new file with mode: 0644]
Document/飞鸽书.png [new file with mode: 0644]
MouseSdk/AiMouseSdk/AiMouse.m
MouseSdk/MouseSdk.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate
MouseSdk/MouseSdk/HidManager.m
MouseSdk_Mac_20240407/MouseSdkDemo/MouseSdkDemo.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate

diff --git a/Document/AiMouseSDK数据交互流程.pdf b/Document/AiMouseSDK数据交互流程.pdf
deleted file mode 100644 (file)
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数据交互流程.pdf b/Document/MouseSdk数据交互流程.pdf
new file mode 100644 (file)
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文档.zip b/Document/MouseSdk文档.zip
new file mode 100644 (file)
index 0000000..c2cf0fa
Binary files /dev/null and "b/Document/MouseSdk\346\226\207\346\241\243.zip" differ
diff --git a/Document/MouseSdk文档/AiMouse.h b/Document/MouseSdk文档/AiMouse.h
new file mode 100644 (file)
index 0000000..c8f174b
--- /dev/null
@@ -0,0 +1,85 @@
+//
+//  Ai.h
+//  AiMouse
+//
+//  Created by incar on 2024/2/28.
+//
+
+#import <Foundation/Foundation.h>
+#import <AiMouseSdk/AiMouseDeviceInfo.h>
+
+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 <NSObject>
+
+/// 鉴权数据回调,需要将此数据通过鉴权特征转发给蓝牙设备
+/// - 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<AiMouseDelegate> 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文档/MouseSdk数据交互流程.pdf b/Document/MouseSdk文档/MouseSdk数据交互流程.pdf
new file mode 100644 (file)
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文档/鉴权流程.pdf b/Document/MouseSdk文档/鉴权流程.pdf
new file mode 100644 (file)
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文档/飞鸟顿.jpg b/Document/MouseSdk文档/飞鸟顿.jpg
new file mode 100644 (file)
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文档/飞鸽书.png b/Document/MouseSdk文档/飞鸽书.png
new file mode 100644 (file)
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
index e90b6f1..61cbc39 100644 (file)
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/数据交互流程.pdf b/Document/数据交互流程.pdf
deleted file mode 100644 (file)
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/数据交互流程.png b/Document/数据交互流程.png
deleted file mode 100644 (file)
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/鉴权流程.pdf b/Document/鉴权流程.pdf
new file mode 100644 (file)
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/飞鸟顿.jpg b/Document/飞鸟顿.jpg
new file mode 100644 (file)
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/飞鸽书.png b/Document/飞鸽书.png
new file mode 100644 (file)
index 0000000..5e0afa4
Binary files /dev/null and "b/Document/\351\243\236\351\270\275\344\271\246.png" differ
index 4f5ef2a..486d715 100644 (file)
         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];
         
         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) {
     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];
     }
     [self setAuthStateToDevice:isSuccess];
 }
 - (void)showLog:(NSString *)log{
-//        NSLog(@"[sdk]%@",log);
+        NSLog(@"[sdk]%@",log);
 }
 
 - (void)sendTestLP{
index 9e4b21d..7829273 100644 (file)
Binary files a/MouseSdk/MouseSdk.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate and b/MouseSdk/MouseSdk.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate differ
index 0342627..d7dec15 100644 (file)
@@ -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) {
index eadf8fc..224b923 100644 (file)
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