public func initSDK(){
-// StarburstConfig.shared().switch(to: .ble)
-// StarburstConfig.shared().appId = "app_ro4n4nwljr20kwqo"
- //MARK: 配置缓存路径
- StarburstConfig.shared().sdkFolder = NSTemporaryDirectory()
- StarburstConfig.shared().isDebug = true
- StarburstConfig.shared().enableTextSyncToDevice = true
- StarburstConfig.shared().enableEmotionSyncToDevice = true
- StarburstConfig.shared().enableEarbudsSwitchSync = true
-
+
StarburstConfig.shared().switch(to: .ble)
StarburstConfig.shared().appId = "prjzVnOEpKL1N"
-
-
- //debug模式会打印日志
- StarburstConfig.shared().isDebug = false
- // sdk缓存路径
- StarburstConfig.shared().sdkFolder = NSHomeDirectory() + "/Documents/DeepChordsSdk"
+ StarburstConfig.shared().isDebug = true
+ //MARK: 配置缓存路径
+ StarburstConfig.shared().sdkFolder = NSTemporaryDirectory()
+// StarburstConfig.shared().sdkFolder = NSHomeDirectory() + "/Documents/DeepChordsSdk"
// 日志路径
StarburstConfig.shared().logPath = logPath()
- // //是否下发文字到耳机仓
- // StarburstConfig.shared().enableTextSyncToDevice = true;
- // //主从耳机切换是否同步sdk信息到耳机
- // StarburstConfig.shared().enableEarbudsSwitchSync = true;
- // //耳机仓表情下发开关
- // StarburstConfig.shared().enableEmotionSyncToDevice = true;
+ //是否下发文字到耳机仓
+ StarburstConfig.shared().enableTextSyncToDevice = false
+ //主从耳机切换是否同步sdk信息到耳机
+ StarburstConfig.shared().enableEarbudsSwitchSync = true
+ //耳机仓表情下发开关
+ StarburstConfig.shared().enableEmotionSyncToDevice = false
//添加调试信息
// StarburstConfig.shared().debugInfo = [
// "x-use-ppe":"1",
--- /dev/null
+////
+//// BleManager.swift
+//// Example
+////
+//// Created by liangshi on 2025/11/24.
+////
+//
+////
+//// Untitled.swift
+//// ShenYin
+////
+//// Created by liangshi on 2025/8/28.
+////
+//
+//import UIKit
+//import CoreBluetooth
+//import DeepChordsSdk
+//
+//class BleManager: NSObject {
+// var discoverDeviceCallback: (([CBPeripheral]) -> Void)?
+// var didConnectDeviceCallback: ((CBPeripheral) -> Void)?
+// var disConnectDeviceCallback: ((CBPeripheral) -> Void)?
+// var conetedFailureCallback: ((CBPeripheral) -> Void)?
+//
+// private var centralManager: CBCentralManager!
+// var devices: [CBPeripheral] = []
+//
+// private override init() {
+// super.init()
+// centralManager = CBCentralManager(delegate: self, queue: nil)
+// }
+//
+// static let shared = BleManager()
+//
+// func stopScanDevice() {
+// centralManager.stopScan()
+// }
+// func startScanDevice() {
+// // centralManager.stopScan()
+// DCLogger.debug("扫描中...")
+// devices = []
+//
+// if let connectedPeripheral = centralManager.retrieveConnectedPeripherals(withServices: [CBUUID(string: "AE30")]).first{
+// devices = [connectedPeripheral]
+// }
+// discoverDeviceCallback?(devices)
+// centralManager.scanForPeripherals(withServices: nil,options: [CBCentralManagerScanOptionAllowDuplicatesKey : false])
+//
+// }
+// func connectPeripheral(_ peripheral: CBPeripheral) {
+// DCLogger.debug("正在连接...",peripheral)
+// centralManager.connect(peripheral, options: [CBConnectPeripheralOptionNotifyOnConnectionKey: true])
+// }
+// func cancel(){
+//
+// }
+// func autoConnect(){
+//// if let peripheral = centralManager.retrieveConnectedPeripherals(withServices: [CBUUID(string: "AE30")]).first{
+//// connectPeripheral(peripheral)
+//// }
+// }
+//}
+//extension BleManager:CBCentralManagerDelegate{
+// func centralManagerDidUpdateState(_ central: CBCentralManager) {
+// DCLogger.debug("蓝牙状态",central.state.rawValue)
+// switch central.state {
+// case.unknown:
+// break
+// case.resetting:
+// break
+// case.unsupported:
+// break
+// case.unauthorized:
+// break
+// case.poweredOff:
+//
+// break
+// case.poweredOn:
+// startScanDevice()
+// break
+// @unknown default:
+// break
+// }
+// }
+//
+// func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
+// if devices.contains(peripheral) {
+// return
+// }
+// if let name = peripheral.name,name.hasPrefix("AI") {
+// devices.append(peripheral)
+// DCLogger.debug(peripheral)
+// discoverDeviceCallback?(devices)
+// }
+// }
+//
+// func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) {
+// stopScanDevice()
+// DCLogger.debug("蓝牙已连接 \(peripheral)")
+//
+// peripheral.delegate = self
+// peripheral.discoverServices(nil);
+// DCBleManager.shared.centralManager(central, didConnect: peripheral)
+// self.didConnectDeviceCallback?(peripheral)
+// App.shared.window?.makeToast("蓝牙已连接")
+// }
+// func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?) {
+// DCBleManager.shared.centralManager(central, didFailToConnect: peripheral, error: error)
+// }
+// func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) {
+// disConnectDeviceCallback?(peripheral)
+// DCBleManager.shared.centralManager(central, didDisconnectPeripheral: peripheral, error: nil)
+// App.shared.window?.makeToast("蓝牙已断开连接")
+// App.shared.window?.rootViewController = UINavigationController(rootViewController: DeviceListVC())
+// }
+//}
+//
+//extension BleManager: CBPeripheralDelegate {
+// func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {
+// DCBleManager.shared.peripheral(peripheral, didDiscoverServices: error)
+// }
+//
+// func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {
+// DCBleManager.shared.peripheral(peripheral, didDiscoverCharacteristicsFor: service, error: error)
+// }
+//
+// func peripheral(_ peripheral: CBPeripheral, didUpdateNotificationStateFor characteristic: CBCharacteristic, error: (any Error)?) {
+// DCLogger.debug("状态改变 == UUID ",characteristic.uuid)
+// }
+//
+// func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
+// DCBleManager.shared.peripheral(peripheral, didUpdateValueFor: characteristic, error: error)
+//
+// }
+//
+// func peripheral(_ peripheral: CBPeripheral, didModifyServices invalidatedServices: [CBService]) {
+// // Accessory's GATT database has updated. Refresh your local cache (if any)
+// }
+//
+// func peripheral(_ peripheral: CBPeripheral, didWriteValueFor characteristic: CBCharacteristic, error: (any Error)?) {
+//
+// }
+//}