From: liangzhenying <867174124@qq.com> Date: Fri, 8 Mar 2024 02:43:04 +0000 (+0800) Subject: 蓝牙管理类添加注释 X-Git-Tag: 阿里鉴权~27 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=b692967dbe1c48420659f5826cd9aaa304b34aff;p=mirrors%2FMouseSdk-MacOS.git 蓝牙管理类添加注释 --- diff --git a/MouseSdk/MouseSdk.xcodeproj/project.pbxproj b/MouseSdk/MouseSdk.xcodeproj/project.pbxproj index 8015d55..b139f62 100644 --- a/MouseSdk/MouseSdk.xcodeproj/project.pbxproj +++ b/MouseSdk/MouseSdk.xcodeproj/project.pbxproj @@ -24,7 +24,6 @@ 18BF1E8D2B8362D300B8D90F /* AiMouseSdk.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18BF1E872B8362D300B8D90F /* AiMouseSdk.framework */; }; 18BF1E8E2B8362D300B8D90F /* AiMouseSdk.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 18BF1E872B8362D300B8D90F /* AiMouseSdk.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 18F3235D2B8ED78300CABA2E /* ScanCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F3235C2B8ED78300CABA2E /* ScanCell.m */; }; - 18F323772B8F2DAD00CABA2E /* AliIotTools.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F323752B8F2DAC00CABA2E /* AliIotTools.m */; }; 18F3237F2B8F30B200CABA2E /* AliIotConnectKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18F3237D2B8F2EFC00CABA2E /* AliIotConnectKit.framework */; }; 18F323802B8F30B200CABA2E /* AliIotConnectKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 18F3237D2B8F2EFC00CABA2E /* AliIotConnectKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 18F323842B8F330100CABA2E /* AiAuthManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 18F323822B8F330100CABA2E /* AiAuthManager.h */; }; @@ -322,8 +321,6 @@ 18BF1E892B8362D300B8D90F /* AiMouseSdk.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AiMouseSdk.h; sourceTree = ""; }; 18F3235B2B8ED78300CABA2E /* ScanCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScanCell.h; sourceTree = ""; }; 18F3235C2B8ED78300CABA2E /* ScanCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ScanCell.m; sourceTree = ""; }; - 18F323752B8F2DAC00CABA2E /* AliIotTools.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliIotTools.m; sourceTree = ""; }; - 18F323762B8F2DAD00CABA2E /* AliIotTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliIotTools.h; sourceTree = ""; }; 18F323782B8F2EFB00CABA2E /* AliIotConnectKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = AliIotConnectKit.xcodeproj; path = AliIotConnectKitSDK/AliIotConnectKit.xcodeproj; sourceTree = ""; }; 18F323822B8F330100CABA2E /* AiAuthManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AiAuthManager.h; sourceTree = ""; }; 18F323832B8F330100CABA2E /* AiAuthManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AiAuthManager.m; sourceTree = ""; }; @@ -636,8 +633,6 @@ 18BF1E752B832D2E00B8D90F /* ScanVC.m */, 18F3235B2B8ED78300CABA2E /* ScanCell.h */, 18F3235C2B8ED78300CABA2E /* ScanCell.m */, - 18F323762B8F2DAD00CABA2E /* AliIotTools.h */, - 18F323752B8F2DAC00CABA2E /* AliIotTools.m */, 18F323882B8F4DBE00CABA2E /* PCMPlayer.h */, 18F323892B8F4DBE00CABA2E /* PCMPlayer.m */, 18F328D32B98569D00CABA2E /* Config.h */, @@ -1448,7 +1443,6 @@ 18BF1E052B81E18800B8D90F /* ConnectKitVC.swift in Sources */, 18F3235D2B8ED78300CABA2E /* ScanCell.m in Sources */, 18BF1DD22B81AB7C00B8D90F /* ViewController.m in Sources */, - 18F323772B8F2DAD00CABA2E /* AliIotTools.m in Sources */, 18BF1DD92B81AB7F00B8D90F /* main.m in Sources */, 18F328D52B98569D00CABA2E /* Config.m in Sources */, 18BF1E762B832D2E00B8D90F /* ScanVC.m in Sources */, diff --git a/MouseSdk/MouseSdk.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate b/MouseSdk/MouseSdk.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate index 74e66f9..0087ccd 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/AliIotTools.h b/MouseSdk/MouseSdk/AliIotTools.h deleted file mode 100644 index ef49873..0000000 --- a/MouseSdk/MouseSdk/AliIotTools.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// AliIotTools.h -// AliIotSdk -// -// Created by incar on 2024/2/3. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface AliIotTools : NSObject - -+ (NSArray *)stringToArray:(NSString *)jsonString; -+ (NSString *)arrayToString:(NSArray *)arr; - -+ (NSDictionary *)stringToDictionary:(NSString *)jsonString; -+ (NSString *)dictionaryToString:(NSDictionary *)dic; - -+ (NSDictionary *)dataToDictionary:(NSData *)jsonData; -+ (NSData *)dictionaryToData:(NSDictionary *)dicJson; - - -+ (NSString *)dataToHexString:(NSData *)data; - -+ (NSString *)dataToHexString_placeholder:(NSData *)data; - -+ (NSData *)hexStringToData:(NSString *)hexStr ; - - -@end - -NS_ASSUME_NONNULL_END diff --git a/MouseSdk/MouseSdk/AliIotTools.m b/MouseSdk/MouseSdk/AliIotTools.m deleted file mode 100644 index cf0f6dc..0000000 --- a/MouseSdk/MouseSdk/AliIotTools.m +++ /dev/null @@ -1,115 +0,0 @@ -// -// AliIotTools.m -// AliIotSdk -// -// Created by incar on 2024/2/3. -// - -#import "AliIotTools.h" - -@implementation AliIotTools -+ (NSArray *)stringToArray:(NSString *)jsonString{ - NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; - NSError *error; - NSArray *arr = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error]; - return arr; -} -+ (NSString *)arrayToString:(NSArray *)arr{ - NSError *error; - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:arr options:NSJSONWritingPrettyPrinted error:&error]; - NSString * string = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; - return string; -} -+ (NSDictionary *)stringToDictionary:(NSString *)jsonString{ - NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; - NSError *error; - NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error]; - return dict; -} -+ (NSString *)dictionaryToString:(NSDictionary *)dic{ - if ([dic isKindOfClass:[NSDictionary class]]) { - NSError *error; - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&error]; - NSString * string = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; - return string; - } - else{ - return @""; - } -} - -+ (NSDictionary *)dataToDictionary:(NSData *)jsonData{ - if (![jsonData isKindOfClass:[NSData class]] || jsonData.length < 1) { - return nil; - } - id jsonObj = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingAllowFragments error:nil]; - if (![jsonObj isKindOfClass:[NSDictionary class]]) { - return nil; - } - return [NSDictionary dictionaryWithDictionary:(NSDictionary *)jsonObj]; -} - - -+ (NSData *)dictionaryToData:(NSDictionary *)dicJson{ - if (![dicJson isKindOfClass:[NSDictionary class]]) { - return nil; - } - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dicJson options:0 error:nil]; - if (![jsonData isKindOfClass:[NSData class]]) { - return nil; - } - return jsonData; -} - -+ (NSString *)dataToHexString:(NSData *)data { - NSUInteger length = data.length; - NSMutableString *result = [NSMutableString stringWithCapacity:length * 2]; - const unsigned char *byte = data.bytes; - for (int i = 0; i < length; i++, byte++) { - [result appendFormat:@"%02X", *byte]; - } - return result; -} - -+ (NSString *)dataToHexString_placeholder:(NSData *)data { - NSUInteger length = data.length; - NSString *placeholder = @" "; - NSMutableString *result = [NSMutableString stringWithCapacity:length * 2]; - const unsigned char *byte = data.bytes; - for (int i = 0; i < length; i++, byte++) { - [result appendFormat:@"%02X%@", *byte, placeholder]; - } - return result; -} - -+ (NSData *)hexStringToData:(NSString *)hexStr { - hexStr = [hexStr stringByReplacingOccurrencesOfString:@" " withString:@""]; - hexStr = [hexStr lowercaseString]; - NSUInteger len = hexStr.length; - if (!len) return nil; - unichar *buf = malloc(sizeof(unichar) * len); - if (!buf) return nil; - [hexStr getCharacters:buf range:NSMakeRange(0, len)]; - - NSMutableData *result = [NSMutableData data]; - unsigned char bytes; - char str[3] = { '\0', '\0', '\0' }; - int i; - for (i = 0; i < len / 2; i++) { - str[0] = buf[i * 2]; - str[1] = buf[i * 2 + 1]; - bytes = strtol(str, NULL, 16); - [result appendBytes:&bytes length:1]; - } - free(buf); - return result; -} - -- (NSString *)dataToUtf8String:(NSData *)data { - if (data.length > 0) { - return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; - } - return @""; -} - -@end