sdk现场调试
authormemory <496663675@qq.com>
Fri, 28 Nov 2025 09:19:31 +0000 (17:19 +0800)
committermemory <496663675@qq.com>
Fri, 28 Nov 2025 09:19:31 +0000 (17:19 +0800)
14 files changed:
ShenYin/Podfile.lock
ShenYin/Pods/Kingfisher/PrivacyInfo.xcprivacy [deleted file]
ShenYin/Pods/MBProgressHUD/PrivacyInfo.xcprivacy [deleted file]
ShenYin/ShenYin.xcodeproj/project.pbxproj
document/DeepChordsSdk_iOS/DeepChordsSdk/Example/DeepChordsSdk/DCBleManager.swift
document/DeepChordsSdk_iOS/DeepChordsSdk/Example/DeepChordsSdk/DCDevice.swift
document/DeepChordsSdk_iOS/DeepChordsSdk/Example/DeepChordsSdk/Data.swift
document/DeepChordsSdk_iOS/DeepChordsSdk/Example/DeepChordsSdk/DeepChordsAiSdk.swift
document/DeepChordsSdk_iOS/DeepChordsSdk/Example/Example.xcodeproj/project.pbxproj
document/DeepChordsSdk_iOS/DeepChordsSdk/Example/Example/VC/BaseVC.swift
document/DeepChordsSdk_iOS/DeepChordsSdk/Example/Example/VC/HomeVC.swift
document/DeepChordsSdk_iOS/DeepChordsSdk/Example/Example/VC/LogVC.swift
document/DeepChordsSdk_iOS/DeepChordsSdk/Example/Example/VC/SdkLogVC.swift [new file with mode: 0644]
document/DeepChordsSdk_iOS/DeepChordsSdk/Example/Example/tools/BleManager.swift

index d2f4446..c3254a9 100644 (file)
@@ -161,7 +161,7 @@ SPEC CHECKSUMS:
   swiftScan: 0849e7d7c1c641384767a573ee8cb90b88d1ddd9
   TabPageViewController: 8bd4104909754416b35a98f3b72a5b674ab20dd5
   TZImagePickerController: 456f470b5dea97b37226ec7a694994a8663340b2
-  WechatOpenSDK-XCFramework: b072030c9eeee91dfff1856a7846f70f7b9a88ed
+  WechatOpenSDK-XCFramework: ff342ae616bb86df3d236aca38059dfd4bc4a949
   YYModel: 2a7fdd96aaa4b86a824e26d0c517de8928c04b30
   YYText: 5c461d709e24d55a182d1441c41dc639a18a4849
   ZipArchive: e25a4373192673e3229ac8d6e9f64a3e5713c966
diff --git a/ShenYin/Pods/Kingfisher/PrivacyInfo.xcprivacy b/ShenYin/Pods/Kingfisher/PrivacyInfo.xcprivacy
deleted file mode 100644 (file)
index 148b97e..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-       <key>NSPrivacyTracking</key>
-       <false/>
-       <key>NSPrivacyTrackingDomains</key>
-       <array/>
-       <key>NSPrivacyAccessedAPITypes</key>
-       <array>
-               <dict>
-                       <key>NSPrivacyAccessedAPIType</key>
-                       <string>NSPrivacyAccessedAPICategoryDiskSpace</string>
-                       <key>NSPrivacyAccessedAPITypeReasons</key>
-                       <array>
-                               <string>E174.1</string>
-                       </array>
-               </dict>
-       </array>
-       <key>NSPrivacyCollectedDataTypes</key>
-       <array/>
-</dict>
-</plist>
diff --git a/ShenYin/Pods/MBProgressHUD/PrivacyInfo.xcprivacy b/ShenYin/Pods/MBProgressHUD/PrivacyInfo.xcprivacy
deleted file mode 100644 (file)
index 148b97e..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-       <key>NSPrivacyTracking</key>
-       <false/>
-       <key>NSPrivacyTrackingDomains</key>
-       <array/>
-       <key>NSPrivacyAccessedAPITypes</key>
-       <array>
-               <dict>
-                       <key>NSPrivacyAccessedAPIType</key>
-                       <string>NSPrivacyAccessedAPICategoryDiskSpace</string>
-                       <key>NSPrivacyAccessedAPITypeReasons</key>
-                       <array>
-                               <string>E174.1</string>
-                       </array>
-               </dict>
-       </array>
-       <key>NSPrivacyCollectedDataTypes</key>
-       <array/>
-</dict>
-</plist>
index 4903484..4dbac3e 100644 (file)
                                CODE_SIGN_IDENTITY = "Apple Development";
                                CODE_SIGN_STYLE = Automatic;
                                CURRENT_PROJECT_VERSION = 1;
-                               DEVELOPMENT_TEAM = G23X75CJ67;
+                               DEVELOPMENT_TEAM = XPSJ44T3ZW;
                                FRAMEWORK_SEARCH_PATHS = (
                                        "$(inherited)",
                                        "$(PROJECT_DIR)",
                                CODE_SIGN_IDENTITY = "Apple Development";
                                CODE_SIGN_STYLE = Automatic;
                                CURRENT_PROJECT_VERSION = 1;
-                               DEVELOPMENT_TEAM = G23X75CJ67;
+                               DEVELOPMENT_TEAM = XPSJ44T3ZW;
                                FRAMEWORK_SEARCH_PATHS = (
                                        "$(inherited)",
                                        "$(PROJECT_DIR)",
index d771e89..6ae01d7 100644 (file)
@@ -17,15 +17,16 @@ public class DCBleManager{
 
     func send(_ sender:BleSender){
         if let connectPeripheral = connectPeripheral, let writeCha = writeCha {
-            Logger.debug("发送数据 = ",writeCha.uuid.uuidString,sender.data.joined())
+            Logger.debug("发",writeCha.uuid.uuidString,sender.data.joined())
             connectPeripheral.writeValue(sender.data, for: writeCha, type:.withoutResponse)
         }
     }
     func sendToStarburst(_ data:Data){
         var full = Data.dataWithHexString("BA0D")
         full.append(data)
+        full.addCrc()
         if let connectPeripheral = connectPeripheral, let writeCha = writeCha {
-            Logger.debug("发送数据 = ",writeCha.uuid.uuidString,full.joined())
+            Logger.debug("发",writeCha.uuid.uuidString,full.joined())
             connectPeripheral.writeValue(full, for: writeCha, type:.withoutResponse)
         }
     }
@@ -67,7 +68,7 @@ public extension DCBleManager{
     }
     
     func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
-        Logger.debug("收到数据 ===UUID",characteristic.uuid,characteristic.value?.joined() ?? "")
+        Logger.debug("收 ",characteristic.uuid,characteristic.value?.joined() ?? "")
         guard let data = characteristic.value else { return  }
         
         if let sender = BleSender.answer(data) {
@@ -77,9 +78,9 @@ public extension DCBleManager{
             return
         }
         else if data[1] == 0x0D{
-            let subData = data.subdata(in: 2..<data.count)
-            Logger.debug("字节数据",subData.joined())
-            StarburstSdk.shared().receiveBleData(data)
+            let subData = data.subdata(in: 2..<data.count - 2)
+//            Logger.debug("传给字节sdk",subData.joined())
+            StarburstSdk.shared().receiveBleData(subData)
         }
     }
 }
index 7b32f46..20cc65d 100644 (file)
@@ -11,7 +11,7 @@ public class DCDevice{
     public static let shared = DCDevice()
 
     public func getBatery(finished:@escaping ((Int,Int)?)->Void){
-        var data = Data.dataWithHexString("BA090000")
+        var data = Data.dataWithHexString("BA0900")
         data.addCrc()
 
         let sender = BleSender()
@@ -31,7 +31,7 @@ public class DCDevice{
         DCBleManager.shared.send(sender)
     }
     public func getSoftVersion(finished:@escaping (String?)->Void){
-        var data = Data.dataWithHexString("BA0A0001")
+        var data = Data.dataWithHexString("BA0A00")
         data.addCrc()
         
         let sender = BleSender()
@@ -51,7 +51,7 @@ public class DCDevice{
         DCBleManager.shared.send(sender)
     }
     public func getHardVersion(finished:@escaping (String?)->Void){
-        var data = Data.dataWithHexString("BA0A0101")
+        var data = Data.dataWithHexString("BA0A01")
         data.addCrc()
         
         let sender = BleSender()
index 4ae786e..89b4197 100644 (file)
@@ -47,6 +47,8 @@ extension Data {
     }
     
     mutating func addCrc(){
+        var len = UInt8(self.count - 2)
+        self.append(&len, count: 1)
         var crc = Data.crc8(self)
         self.append(&crc, count: 1)
     }
index 1250d12..611771c 100644 (file)
@@ -9,6 +9,9 @@ import StarburstSdk
 public class DeepChordsAiSdk{
     public static let shared = DeepChordsAiSdk()
     public var authCallback: ((Int,String) -> Void)?
+    public var sdkLog:String{
+        return StarburstConfig.shared().logPath
+    }
     
     
     public func initSDK(){
@@ -23,7 +26,9 @@ public class DeepChordsAiSdk{
         
         StarburstConfig.shared().switch(to: .ble)
         //设置appid
-        StarburstConfig.shared().appId = "app_ro4n4nwljr20kwqo"
+//        StarburstConfig.shared().appId = "app_ro4n4nwljr20kwqo"
+        StarburstConfig.shared().appId = "prjzVn0EpKL1N"
+
         //debug模式会打印日志
         StarburstConfig.shared().isDebug = true
         // sdk缓存路径
index 2cfb8a5..5055fcd 100644 (file)
                                CODE_SIGN_STYLE = Automatic;
                                CURRENT_PROJECT_VERSION = 1;
                                DEAD_CODE_STRIPPING = NO;
-                               DEVELOPMENT_TEAM = G23X75CJ67;
+                               DEVELOPMENT_TEAM = 5AR46VFCJA;
                                DYLIB_COMPATIBILITY_VERSION = 1;
                                DYLIB_CURRENT_VERSION = 1;
                                DYLIB_INSTALL_NAME_BASE = "@rpath";
                                CODE_SIGN_STYLE = Automatic;
                                CURRENT_PROJECT_VERSION = 1;
                                DEAD_CODE_STRIPPING = NO;
-                               DEVELOPMENT_TEAM = G23X75CJ67;
+                               DEVELOPMENT_TEAM = 5AR46VFCJA;
                                DYLIB_COMPATIBILITY_VERSION = 1;
                                DYLIB_CURRENT_VERSION = 1;
                                DYLIB_INSTALL_NAME_BASE = "@rpath";
index 05ad6d2..ec48eee 100644 (file)
@@ -8,6 +8,7 @@
 import UIKit
 class BaseVC: UIViewController {
     let logBtn = UIButton(type: .custom)
+    let sdklogBtn = UIButton(type: .custom)
     deinit {
         print("\(Self.self) 销毁")
     }
@@ -20,14 +21,24 @@ class BaseVC: UIViewController {
         logBtn.backgroundColor = .blue
         logBtn.layer.cornerRadius = 30
         logBtn.layer.masksToBounds = true
-        logBtn.setTitle("log", for: .normal)
+        logBtn.setTitle("log1", for: .normal)
         logBtn.addTarget(self, action: #selector(logAction), for: .touchUpInside)
         self.view.addSubview(logBtn)
+        
+        sdklogBtn.frame = CGRect(x:  UIScreen.main.bounds.size.width - 80, y: 300, width:60, height: 60)
+        sdklogBtn.backgroundColor = .blue
+        sdklogBtn.layer.cornerRadius = 30
+        sdklogBtn.layer.masksToBounds = true
+        sdklogBtn.setTitle("log sdk", for: .normal)
+        sdklogBtn.addTarget(self, action: #selector(sdkAction), for: .touchUpInside)
+        self.view.addSubview(sdklogBtn)
     }
+
     
     override func viewWillAppear(_ animated: Bool) {
         super.viewWillAppear(animated)
         self.view.bringSubviewToFront(logBtn)
+        self.view.bringSubviewToFront(sdklogBtn)
     }
     
     @objc func logAction(){
@@ -36,4 +47,8 @@ class BaseVC: UIViewController {
         let vc = LogVC()
         navigationController?.pushViewController(vc, animated: true)
     }
+    @objc func sdkAction(){
+        let vc = SdkLogVC()
+        navigationController?.pushViewController(vc, animated: true)
+    }
 }
index ebd1ad2..251189a 100644 (file)
@@ -89,7 +89,9 @@ extension HomeVC{
 extension HomeVC{
     func setupSdk(){
         DeepChordsAiSdk.shared.authCallback = { [weak self] (code,string) in
+            Logger.debug("鉴权结果",code,string)
             if code == 200{
+               
                 App.shared.window?.makeToast("鉴权成功")
             }
             else{
index dcd6df8..2bc62a7 100644 (file)
@@ -33,7 +33,13 @@ class LogVC: UIViewController {
         formatter.dateFormat = "yyyyMMddHHmmss"
         let name = formatter.string(from: Date())
         
-        let filePath = "\(NSHomeDirectory())/Documents/DeepChordsSdk_\(name).txt"
+        guard let cacheDirectory = FileManager.default.urls(for:.cachesDirectory, in:.userDomainMask).first else {
+            print("无法获取缓存目录")
+            return
+        }
+        // 构建压缩文件路径
+        let filePath = cacheDirectory.appendingPathComponent("DeepChordsSdk_\(name).txt").path
+        
         let url = URL(fileURLWithPath: filePath)
         let data = self.textView.text.data(using:.utf8)
         do {
@@ -46,15 +52,15 @@ class LogVC: UIViewController {
     }
     
     func saveFile(withFilePath filePath: String) {
-        let fUrl = URL(fileURLWithPath: filePath)
-        let vc = UIDocumentPickerViewController(url: fUrl, in:.exportToService)
-        vc.delegate = self
-        vc.modalPresentationStyle = .overFullScreen
-        self.present(vc, animated: true, completion: nil)
-        
-//        let vc = UIActivityViewController(activityItems: [URL(fileURLWithPath: filePath)], applicationActivities: nil)
+//        let fUrl = URL(fileURLWithPath: filePath)
+//        let vc = UIDocumentPickerViewController(url: fUrl, in:.exportToService)
+//        vc.delegate = self
 //        vc.modalPresentationStyle = .overFullScreen
-//        App.shared.topVC().present(vc, animated: true)
+//        self.present(vc, animated: true, completion: nil)
+        
+        let vc = UIActivityViewController(activityItems: [URL(fileURLWithPath: filePath)], applicationActivities: nil)
+        vc.modalPresentationStyle = .overFullScreen
+        App.shared.topVC().present(vc, animated: true)
     }
 }
 
diff --git a/document/DeepChordsSdk_iOS/DeepChordsSdk/Example/Example/VC/SdkLogVC.swift b/document/DeepChordsSdk_iOS/DeepChordsSdk/Example/Example/VC/SdkLogVC.swift
new file mode 100644 (file)
index 0000000..da29f19
--- /dev/null
@@ -0,0 +1,65 @@
+//
+//  SdkLogVC.swift
+//  Example
+//
+//  Created by lianzi on 2025/11/28.
+//
+
+import UIKit
+import DeepChordsSdk
+class SdkLogVC: UIViewController {
+    
+    var textView =  UITextView()
+    
+    override func viewDidLoad() {
+        title = "log"
+        view.backgroundColor = .white
+        self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "save", style: .done, target: self, action: #selector(shareAction))
+        textView.isEditable = false
+        view.addSubview(textView)
+        textView.frame = CGRectMake(0, 100, view.bounds.size.width, view.bounds.size.height - 100)
+    }
+    
+    override func viewDidAppear(_ animated: Bool) {
+        super.viewDidAppear(animated)
+        
+        textView.text = try! String(contentsOfFile: DeepChordsAiSdk.shared.sdkLog, encoding: .utf8)
+        let range = NSMakeRange(textView.text.count - 1, 1)
+        textView.scrollRangeToVisible(range)
+    }
+    
+    @objc func shareAction() {
+        let formatter = DateFormatter()
+        formatter.dateFormat = "yyyyMMddHHmmss"
+        let name = formatter.string(from: Date())
+        
+        let filePath = "\(NSHomeDirectory())/Documents/DeepChordsSdk_\(name).txt"
+        let url = URL(fileURLWithPath: filePath)
+        let data = self.textView.text.data(using:.utf8)
+        do {
+            try data?.write(to: url, options:.atomic)
+            print(filePath)
+            self.saveFile(withFilePath: filePath)
+        } catch {
+            print(error)
+        }
+    }
+    
+    func saveFile(withFilePath filePath: String) {
+        let fUrl = URL(fileURLWithPath: filePath)
+        let vc = UIDocumentPickerViewController(url: fUrl, in:.exportToService)
+        vc.delegate = self
+        vc.modalPresentationStyle = .overFullScreen
+        self.present(vc, animated: true, completion: nil)
+        
+//        let vc = UIActivityViewController(activityItems: [URL(fileURLWithPath: filePath)], applicationActivities: nil)
+//        vc.modalPresentationStyle = .overFullScreen
+//        App.shared.topVC().present(vc, animated: true)
+    }
+}
+
+extension SdkLogVC:UIDocumentPickerDelegate{
+    func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
+        controller.dismiss(animated: true, completion: nil)
+    }
+}
index 2374055..e87237e 100644 (file)
@@ -120,7 +120,7 @@ extension BleManager: CBPeripheralDelegate {
     }
     
     func peripheral(_ peripheral: CBPeripheral, didUpdateNotificationStateFor characteristic: CBCharacteristic, error: (any Error)?) {
-        Logger.debug("状态改变 ===uUId ",characteristic.uuid)
+        Logger.debug("状态改变 == UUId ",characteristic.uuid)
 //        if (characteristic.isNotifying == true && characteristic.service?.uuid.uuidString == kJoyGemAIServiceUUID && characteristic.uuid.uuidString == kJoyGemAICharacteristicNotifyUUID) {
 //            //MARK: 使能成功时需要
 //            Logger.debug("特征使能成功")