full.append(data)
full.addCrc()
if let connectPeripheral = connectPeripheral, let writeCha = writeCha {
-// DCLogger.debug("发",writeCha.uuid.uuidString,full.joined())
+ DCLogger.debug("发",writeCha.uuid.uuidString,full.joined())
connectPeripheral.writeValue(full, for: writeCha, type:.withoutResponse)
}
}
}
func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
-// DCLogger.debug("收 ",characteristic.uuid,characteristic.value?.joined() ?? "")
+ DCLogger.debug("收 ",characteristic.uuid,characteristic.value?.joined() ?? "")
guard let data = characteristic.value else { return }
if data.count > 4 && data[0] == 0xBA {
if let sender = BleSender.answer(data) {
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ LastUpgradeVersion = "1640"
+ version = "1.7">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES"
+ buildArchitectures = "Automatic">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "3F3F01E22ED451920038A1C8"
+ BuildableName = "Example.app"
+ BlueprintName = "Example"
+ ReferencedContainer = "container:Example.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ buildConfiguration = "Debug"
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ shouldAutocreateTestPlan = "YES">
+ </TestAction>
+ <LaunchAction
+ buildConfiguration = "Debug"
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ ignoresPersistentStateOnLaunch = "NO"
+ debugDocumentVersioning = "YES"
+ debugServiceExtension = "internal"
+ allowLocationSimulation = "YES">
+ <BuildableProductRunnable
+ runnableDebuggingMode = "0">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "3F3F01E22ED451920038A1C8"
+ BuildableName = "Example.app"
+ BlueprintName = "Example"
+ ReferencedContainer = "container:Example.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </LaunchAction>
+ <ProfileAction
+ buildConfiguration = "Release"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ debugDocumentVersioning = "YES">
+ <BuildableProductRunnable
+ runnableDebuggingMode = "0">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "3F3F01E22ED451920038A1C8"
+ BuildableName = "Example.app"
+ BlueprintName = "Example"
+ ReferencedContainer = "container:Example.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
CODE_SIGN_ENTITLEMENTS = ShenYin/ShenYin.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 1100;
+ CURRENT_PROJECT_VERSION = 1002;
DEVELOPMENT_TEAM = G23X75CJ67;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(inherited)",
"@executable_path/Frameworks",
);
- MARKETING_VERSION = 1.0.1;
+ MARKETING_VERSION = 1.0.2;
PRODUCT_BUNDLE_IDENTIFIER = com.deepchords.app;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
CODE_SIGN_ENTITLEMENTS = ShenYin/ShenYin.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 1100;
+ CURRENT_PROJECT_VERSION = 1002;
DEVELOPMENT_TEAM = G23X75CJ67;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(inherited)",
"@executable_path/Frameworks",
);
- MARKETING_VERSION = 1.0.1;
+ MARKETING_VERSION = 1.0.2;
PRODUCT_BUNDLE_IDENTIFIER = com.deepchords.app;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
-////
-//// JotBleManager.swift
-//// ShenYin
-////
-//// Created by liangshi on 2025/12/23.
-////
//
-//public class JoyBleManager {
-// public static let shared = JoyBleManager()
-// private var connectPeripheral: CBPeripheral?
-// private var writeCha: CBCharacteristic?
-//}
-//extension JoyBleManager{
-// static func getMac(_ dict:[String:Any])->String?{
-// if let advMsd = dict[CBAdvertisementDataManufacturerDataKey] as? Data {
-// if (advMsd.count >= 13) {
-// let mac = advMsd[7...12];
-// return mac.map { String($0, radix: 16).padLeft(toLength: 2, withPad: "0") }.joined(separator: ":").uppercased()
-// } else {
-// return nil
+// Untitled.swift
+// ShenYin
+//
+// Created by liangshi on 2025/8/28.
+//
+
+import UIKit
+import CoreBluetooth
+import AVFAudio
+
+class DCPeripheral{
+ var device:CBPeripheral!
+ var mac = ""
+ init(device: CBPeripheral!, mac: String = "") {
+ self.device = device
+ self.mac = mac
+ }
+}
+
+class JoyBleManager: NSObject {
+ var discoverDeviceCallback: (([DCPeripheral]) -> Void)?
+ var didConnectDeviceCallback: ((DCPeripheral) -> Void)?
+ var conetedFailureCallback: ((DCPeripheral) -> Void)?
+
+ private var centralManager: CBCentralManager!
+ var devices: [DCPeripheral] = []
+ var connectPeripheral: DCPeripheral?
+ static let shared = JoyBleManager()
+ var isConnetd:Bool = false
+
+ private override init() {
+ super.init()
+ centralManager = CBCentralManager(delegate: self, queue: nil)
+ }
+}
+extension JoyBleManager:CBCentralManagerDelegate{
+ func centralManagerDidUpdateState(_ central: CBCentralManager) {
+ Logger.debug("蓝牙状态",central.state.rawValue)
+ switch central.state {
+ case.unknown:
+ break
+ case.resetting:
+ break
+ case.unsupported:
+ break
+ case.unauthorized:
+ break
+ case.poweredOff:
+ self.isConnetd = false
+ NotificationManager.post(type: .deviceValidChange, objtect: nil)
+ break
+ case.poweredOn:
+// startScanDevice()
+ checkConectState()
+ break
+ @unknown default:
+ break
+ }
+ OtaMananger.shared.otaManager.centralManagerDidUpdateState(central)
+ }
+
+ func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
+ if devices.map({ $0.device }).contains(peripheral) {
+ return
+ }
+
+ // DB209A55-DD0E-5031-29FA-40D734C34971
+ // "edr:21140DE4C3D9"
+ // "ble:21140D2CC682"
+// if peripheral.identifier.uuidString != "DB209A55-DD0E-5031-29FA-40D734C34971" {
+// return
+// }
+ let mac = JoySdkManager.getMac(advertisementData) ?? ""
+ devices.append(DCPeripheral(device: peripheral,mac: mac))
+ Logger.debug(peripheral)
+ discoverDeviceCallback?(devices)
+ }
+
+ func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) {
+ stopScanDevice()
+ Logger.debug("蓝牙已连接 \(peripheral)")
+
+ peripheral.delegate = self
+ peripheral.discoverServices([CBUUID(string: JoySdkManager.serviceUUID),CBUUID(string: OtaMananger.otaServiceUUId)]);
+ }
+ func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?) {
+ Logger.debug("peripheral: %@ failed to connect", peripheral)
+ conetedFailureCallback?(connectPeripheral!)
+ }
+ func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) {
+ Logger.debug("蓝牙已断开 \(peripheral)")
+ self.isConnetd = false
+ NotificationManager.post(type: .deviceValidChange, objtect: nil)
+ OtaMananger.shared.otaManager.centralManager(central, didDisconnectPeripheral: peripheral, error: error)
+ checkConectState()
+ }
+}
+
+extension JoyBleManager: CBPeripheralDelegate {
+ func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {
+ Logger.debug("发现服务成功")
+ for service in peripheral.services! {
+ Logger.debug("peripheral service: %@", service)
+ peripheral.discoverCharacteristics(nil, for: service)
+ }
+
+ }
+
+ func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {
+ if (service.uuid.uuidString == JoySdkManager.serviceUUID) {
+ JoySdkManager.shared.peripheral(peripheral, didDiscoverCharacteristicsFor: service, error: error)
+ }
+ else if service.uuid.uuidString == OtaMananger.otaServiceUUId{
+ OtaMananger.shared.otaManager.peripheral(peripheral, didDiscoverCharacteristicsFor: service, error: error)
+ }
+ }
+
+ func peripheral(_ peripheral: CBPeripheral, didUpdateNotificationStateFor characteristic: CBCharacteristic, error: (any Error)?) {
+ if (characteristic.isNotifying == true && characteristic.service?.uuid.uuidString == JoySdkManager.serviceUUID && characteristic.uuid.uuidString == JoySdkManager.notifyUUID) {
+ Logger.debug("特征使能成功")
+ JoySdkManager.shared.bleConnected()
+ }
+ if OtaMananger.isOtadata(characteristic){
+ OtaMananger.shared.otaManager.peripheral(peripheral, didUpdateNotificationStateFor: characteristic, error: error)
+ }
+ }
+
+ func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
+// Logger.debug("收到数据 ===uUId ",characteristic.uuid)
+ if OtaMananger.isOtadata(characteristic){
+ if let _ = characteristic.value,error == nil {
+ OtaMananger.shared.otaManager.peripheral(peripheral, didUpdateValueFor: characteristic)
+ }
+ else{
+ Logger.debug("ota 收到数据 ===\(characteristic.uuid)","无数据")
+ }
+ }
+ else {
+ //MARK: 需要配置传入数据
+ JoySdkManager.shared.receiveValue(characteristic)
+ }
+ }
+
+ 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)?) {
+
+ }
+}
+
+extension JoyBleManager{
+ func startScanDevice() {
+// centralManager.stopScan()
+ Logger.debug("扫描中...")
+ Logger.debug("蓝牙状态",centralManager.state.rawValue)
+ devices = []
+// let list = centralManager.retrieveConnectedPeripherals(withServices: [CBUUID(string: kJoyGemAIServiceUUID)])
+// Logger.debug("已连接设备",list)
+// for item in list {
+// if let mac = DeviceCache.shared.getMac(item.identifier.uuidString){
+// devices.append(DCPeripheral(device: item,mac: mac))
// }
-// } else {
-// return nil
// }
-// }
-//}
-////public extension JoyBleManager{
-//// func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) {
-//// Logger.debug("蓝牙已连接 \(peripheral)")
-//// connectPeripheral = peripheral
-//// }
-//// func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?) {
-//// Logger.debug("peripheral: %@ failed to connect", peripheral)
-//// }
-//// func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) {
-//// Logger.debug("蓝牙已断开 \(peripheral)")
-//// }
-////
-////// func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {
-////// Logger.debug("发现服务成功")
-////// for service in peripheral.services! {
-////// Logger.debug("peripheral service: %@", service)
-////// peripheral.discoverCharacteristics(nil, for: service)
-////// }
-//////
-////// }
-////// func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {
-////// if let list = service.characteristics{
-////// Logger.debug("发现特征",list)
-////// for char in list{
-////// Logger.debug(char)
-////// peripheral.setNotifyValue(true, for: char)
-////// if char.uuid.uuidString == "AE03" {
-////// writeCha = char
-////// StarburstSdk.shared().bleConnected()
-////// }
-////// }
-////// }
-////// }
-//////
-////// func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
-////// // Logger.debug("收 ",characteristic.uuid,characteristic.value?.joined() ?? "")
-////// guard let data = characteristic.value else { return }
-////// if data.count > 4 && data[0] == 0xBA {
-////// if let sender = BleSender.answer(data) {
-////// sender.completion?(.response.code(.success).value(data))
-////// if data[1] == 0x10,data[2] == 0x01{
-////// //音乐列表分包,解析的时候处理
-////// }
-////// else{
-////// sender.deinitTimer()
-////// sender.remove()
-////// }
-////// return
-////// }
-////// else if data[1] == 0x0D{
-////// let subData = data.subdata(in: 2..<data.count - 3)
-////// //Logger.debug("传给字节sdk",subData.joined())
-////// StarburstSdk.shared().receiveBleData(subData)
-////// }else{
-////// receiveNoticeData(data)
-////// }
-////// }
-////// else{
-////// Logger.debug("收到异常数据!!!!!!!!!!!")
-////// }
-////// }
-////}
+ centralManager.scanForPeripherals(withServices: [CBUUID(string: JoySdkManager.serviceUUID)],options: [CBCentralManagerScanOptionAllowDuplicatesKey : false])
+ discoverDeviceCallback?(devices)
+ }
+
+ func stopScanDevice() {
+ centralManager.stopScan()
+ }
+
+ func connectPeripheral(_ peripheral: DCPeripheral) {
+ connectPeripheral = peripheral
+ Logger.debug("连接中...")
+ centralManager.connect(peripheral.device, options: [CBConnectPeripheralOptionEnableTransportBridgingKey:true])
+ }
+
+ func cancel() {
+ guard let peripheral = connectPeripheral else { return }
+ self.isConnetd = false
+ NotificationManager.post(type: .deviceValidChange, objtect: nil)
+ centralManager.cancelPeripheralConnection(peripheral.device)
+ connectPeripheral = nil
+ }
+ func unbind(_ peripheral: DCPeripheral){
+ if let mac = connectPeripheral?.mac ,peripheral.mac == mac{
+ cancel()
+ }
+ }
+}
+
+extension JoyBleManager{
+ func joySdkSend(_ data: Data, with characteristic: CBCharacteristic) {
+ if let connectPeripheral = connectPeripheral{
+ connectPeripheral.device.writeValue(data, for: characteristic, type:.withoutResponse)
+ }
+ }
+}
+
+extension JoyBleManager{
+ func isConected(mac:String)->Bool{
+ guard let device = connectPeripheral else { return false }
+ if device.mac == mac {
+ return isConnetd
+ }
+ else{
+ return false
+ }
+ }
+
+// #连接有问题,应当获取设置里面已连接的设备
+ func connect(mac:String, finished:@escaping ((Bool) -> Void)){
+ JoyBleManager.shared.cancel()
+ JoyBleManager.shared.discoverDeviceCallback = { list in
+ if list.count <= 0 {
+ return
+ }
+ for item in list {
+ if item.mac == mac {
+ JoyBleManager.shared.connectPeripheral(item)
+ break
+ }
+ }
+ }
+ JoyBleManager.shared.didConnectDeviceCallback = { device in
+ finished(true)
+ }
+ JoyBleManager.shared.conetedFailureCallback = { device in
+ finished(false)
+ }
+ JoyBleManager.shared.startScanDevice()
+ }
+
+ func checkSettingsConnected()->[CBPeripheral]{
+ let list = centralManager.retrieveConnectedPeripherals(withServices: [CBUUID(string: JoySdkManager.serviceUUID)])
+ Logger.debug("已连接设备",list)
+ return list
+ }
+}
+
+extension JoyBleManager{
+ func checkConectState(){
+ guard let mac = connectPeripheral?.mac else {
+ return
+ }
+ if isConnetd {
+ return
+ }
+ connect(mac: mac) {result in
+ }
+
+ DispatchQueue.main.asyncAfter(deadline:.now() + 10) {
+ self.checkConectState()
+ }
+ }
+}
Logger.debug(error)
}
- DeviceCache.saveLastConnected(mac: BleManager.shared.connectPeripheral!.mac)
- DeviceCache.shared.add(BleManager.shared.connectPeripheral!.device.identifier.uuidString, mac: BleManager.shared.connectPeripheral!.mac)
- BleManager.shared.isConnetd = true
- BleManager.shared.didConnectDeviceCallback?(BleManager.shared.connectPeripheral!)
+ DeviceCache.saveLastConnected(mac: JoyBleManager.shared.connectPeripheral!.mac)
+ DeviceCache.shared.add(JoyBleManager.shared.connectPeripheral!.device.identifier.uuidString, mac: JoyBleManager.shared.connectPeripheral!.mac)
+ JoyBleManager.shared.isConnetd = true
+ JoyBleManager.shared.didConnectDeviceCallback?(JoyBleManager.shared.connectPeripheral!)
NotificationManager.post(type: .deviceValidChange, objtect: nil)
DeviceVM.updateOtaVersion()
}
extension JoySdkManager : JoyGemAIManagerDataSource {
func joyGemSend(_ data: Data, with characteristic: CBCharacteristic) {
// print("发送",data.map { String($0) }.joined(separator: ""))
- BleManager.shared.joySdkSend(data, with: characteristic)
+ JoyBleManager.shared.joySdkSend(data, with: characteristic)
}
}
extension JoySdkManager{
static func getMac(_ dict:[String:Any])->String?{
+
if let advMsd = dict[CBAdvertisementDataManufacturerDataKey] as? Data {
if (advMsd.count >= 13) {
let mac = advMsd[7...12];
- return mac.map { String($0, radix: 16).padLeft(toLength: 2, withPad: "0") }.joined(separator: ":").uppercased()
+ let text = mac.map { String($0, radix: 16).padLeft(toLength: 2, withPad: "0") }.joined(separator: ":").uppercased()
+ Logger.debug(dict)
+ Logger.debug(advMsd)
+ Logger.debug(mac.joined())
+ Logger.debug(text)
+ return text
} else {
return nil
}
+++ /dev/null
-//
-// Untitled.swift
-// ShenYin
-//
-// Created by liangshi on 2025/8/28.
-//
-
-import UIKit
-import CoreBluetooth
-import AVFAudio
-
-class DCPeripheral{
- var device:CBPeripheral!
- var mac = ""
- init(device: CBPeripheral!, mac: String = "") {
- self.device = device
- self.mac = mac
- }
-}
-
-class BleManager: NSObject {
- var discoverDeviceCallback: (([DCPeripheral]) -> Void)?
- var didConnectDeviceCallback: ((DCPeripheral) -> Void)?
- var conetedFailureCallback: ((DCPeripheral) -> Void)?
-
- private var centralManager: CBCentralManager!
- var devices: [DCPeripheral] = []
- var connectPeripheral: DCPeripheral?
- static let shared = BleManager()
- var isConnetd:Bool = false
-
- private override init() {
- super.init()
- centralManager = CBCentralManager(delegate: self, queue: nil)
- }
-}
-extension BleManager:CBCentralManagerDelegate{
- func centralManagerDidUpdateState(_ central: CBCentralManager) {
- Logger.debug("蓝牙状态",central.state.rawValue)
- switch central.state {
- case.unknown:
- break
- case.resetting:
- break
- case.unsupported:
- break
- case.unauthorized:
- break
- case.poweredOff:
- self.isConnetd = false
- NotificationManager.post(type: .deviceValidChange, objtect: nil)
- break
- case.poweredOn:
-// startScanDevice()
- checkConectState()
- break
- @unknown default:
- break
- }
- OtaMananger.shared.otaManager.centralManagerDidUpdateState(central)
- }
-
- func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
- if devices.map({ $0.device }).contains(peripheral) {
- return
- }
-
- // DB209A55-DD0E-5031-29FA-40D734C34971
- // "edr:21140DE4C3D9"
- // "ble:21140D2CC682"
-// if peripheral.identifier.uuidString != "DB209A55-DD0E-5031-29FA-40D734C34971" {
-// return
-// }
- let mac = JoySdkManager.getMac(advertisementData) ?? ""
- devices.append(DCPeripheral(device: peripheral,mac: mac))
- Logger.debug(peripheral)
- discoverDeviceCallback?(devices)
- }
-
- func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) {
- stopScanDevice()
- Logger.debug("蓝牙已连接 \(peripheral)")
-
- peripheral.delegate = self
- peripheral.discoverServices([CBUUID(string: JoySdkManager.serviceUUID),CBUUID(string: OtaMananger.otaServiceUUId)]);
- }
- func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?) {
- Logger.debug("peripheral: %@ failed to connect", peripheral)
- conetedFailureCallback?(connectPeripheral!)
- }
- func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) {
- Logger.debug("蓝牙已断开 \(peripheral)")
- self.isConnetd = false
- NotificationManager.post(type: .deviceValidChange, objtect: nil)
- OtaMananger.shared.otaManager.centralManager(central, didDisconnectPeripheral: peripheral, error: error)
- checkConectState()
- }
-}
-
-extension BleManager: CBPeripheralDelegate {
- func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {
- Logger.debug("发现服务成功")
- for service in peripheral.services! {
- Logger.debug("peripheral service: %@", service)
- peripheral.discoverCharacteristics(nil, for: service)
- }
-
- }
-
- func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {
- if (service.uuid.uuidString == JoySdkManager.serviceUUID) {
- JoySdkManager.shared.peripheral(peripheral, didDiscoverCharacteristicsFor: service, error: error)
- }
- else if service.uuid.uuidString == OtaMananger.otaServiceUUId{
- OtaMananger.shared.otaManager.peripheral(peripheral, didDiscoverCharacteristicsFor: service, error: error)
- }
- }
-
- func peripheral(_ peripheral: CBPeripheral, didUpdateNotificationStateFor characteristic: CBCharacteristic, error: (any Error)?) {
- if (characteristic.isNotifying == true && characteristic.service?.uuid.uuidString == JoySdkManager.serviceUUID && characteristic.uuid.uuidString == JoySdkManager.notifyUUID) {
- Logger.debug("特征使能成功")
- JoySdkManager.shared.bleConnected()
- }
- if OtaMananger.isOtadata(characteristic){
- OtaMananger.shared.otaManager.peripheral(peripheral, didUpdateNotificationStateFor: characteristic, error: error)
- }
- }
-
- func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
-// Logger.debug("收到数据 ===uUId ",characteristic.uuid)
- if OtaMananger.isOtadata(characteristic){
- if let _ = characteristic.value,error == nil {
- OtaMananger.shared.otaManager.peripheral(peripheral, didUpdateValueFor: characteristic)
- }
- else{
- Logger.debug("ota 收到数据 ===\(characteristic.uuid)","无数据")
- }
- }
- else {
- //MARK: 需要配置传入数据
- JoySdkManager.shared.receiveValue(characteristic)
- }
- }
-
- 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)?) {
-
- }
-}
-
-extension BleManager{
- func startScanDevice() {
-// centralManager.stopScan()
- Logger.debug("扫描中...")
- Logger.debug("蓝牙状态",centralManager.state.rawValue)
- devices = []
-// let list = centralManager.retrieveConnectedPeripherals(withServices: [CBUUID(string: kJoyGemAIServiceUUID)])
-// Logger.debug("已连接设备",list)
-// for item in list {
-// if let mac = DeviceCache.shared.getMac(item.identifier.uuidString){
-// devices.append(DCPeripheral(device: item,mac: mac))
-// }
-// }
- centralManager.scanForPeripherals(withServices: [CBUUID(string: JoySdkManager.serviceUUID)],options: [CBCentralManagerScanOptionAllowDuplicatesKey : false])
- discoverDeviceCallback?(devices)
- }
-
- func stopScanDevice() {
- centralManager.stopScan()
- }
-
- func connectPeripheral(_ peripheral: DCPeripheral) {
- connectPeripheral = peripheral
- Logger.debug("连接中...")
- centralManager.connect(peripheral.device, options: [CBConnectPeripheralOptionEnableTransportBridgingKey:true])
- }
-
- func cancel() {
- guard let peripheral = connectPeripheral else { return }
- self.isConnetd = false
- NotificationManager.post(type: .deviceValidChange, objtect: nil)
- centralManager.cancelPeripheralConnection(peripheral.device)
- connectPeripheral = nil
- }
- func unbind(_ peripheral: DCPeripheral){
- if let mac = connectPeripheral?.mac ,peripheral.mac == mac{
- cancel()
- }
- }
-}
-
-extension BleManager{
- func joySdkSend(_ data: Data, with characteristic: CBCharacteristic) {
- if let connectPeripheral = connectPeripheral{
- connectPeripheral.device.writeValue(data, for: characteristic, type:.withoutResponse)
- }
- }
-}
-
-extension BleManager{
- func isConected(mac:String)->Bool{
- guard let device = connectPeripheral else { return false }
- if device.mac == mac {
- return isConnetd
- }
- else{
- return false
- }
- }
-
-// #连接有问题,应当获取设置里面已连接的设备
- func connect(mac:String, finished:@escaping ((Bool) -> Void)){
- BleManager.shared.cancel()
- BleManager.shared.discoverDeviceCallback = { list in
- if list.count <= 0 {
- return
- }
- for item in list {
- if item.mac == mac {
- BleManager.shared.connectPeripheral(item)
- break
- }
- }
- }
- BleManager.shared.didConnectDeviceCallback = { device in
- finished(true)
- }
- BleManager.shared.conetedFailureCallback = { device in
- finished(false)
- }
- BleManager.shared.startScanDevice()
- }
-
- func checkSettingsConnected()->[CBPeripheral]{
- let list = centralManager.retrieveConnectedPeripherals(withServices: [CBUUID(string: JoySdkManager.serviceUUID)])
- Logger.debug("已连接设备",list)
- return list
- }
-}
-
-extension BleManager{
- func checkConectState(){
- guard let mac = connectPeripheral?.mac else {
- return
- }
- if isConnetd {
- return
- }
- connect(mac: mac) {result in
- }
-
- DispatchQueue.main.asyncAfter(deadline:.now() + 10) {
- self.checkConectState()
- }
- }
-}
ProgressHUDHelper.shared.hide()
YLprogressHUD.showAutoHiden("升级成功".l10n)
Logger.debug("升级成功")
-// let mac = BleManager.shared.connectPeripheral?.mac ?? ""
-// BleManager.shared.cancel()
-// BleManager.shared.connect(mac: mac) { result in
+// let mac = JoyBleManager.shared.connectPeripheral?.mac ?? ""
+// JoyBleManager.shared.cancel()
+// JoyBleManager.shared.connect(mac: mac) { result in
//
// }
}
+++ /dev/null
-////
-//// Untitled.swift
-//// ShenYin
-////
-//// Created by liangshi on 2025/11/27.
-////
-//
-//import UIKit
-//import JoyGemAI
-//import AVFAudio
-//class Chinese2EnglishVC:BaseVC{
-// let toolBar = RecordBar()
-// let tableView = UITableView(frame: CGRectZero, style: .plain)
-// let bg = UIImageView()
-// var dataList:[(Chinese2EnglishCellModel,Int)] = []
-// var recordFilePath : String?
-// var startIndex = 0//记录开始录音的次数,用于区分返回的数据
-//
-// deinit {
-// PcmSound.sharedInstance().stopAudioUnit()
-// PcmSound.sharedInstance().cleanup()
-// }
-//
-// override func setupViews() {
-// navBar.title = "中英互译".l10n
-// navBar.rightView.isHidden = false
-// navBar.rightView.setImage(UIImage(named: "help_icon"), for: .normal)
-// view.addSubview(tableView)
-// view.addSubview(toolBar)
-// view.addSubview(bg)
-//
-// toolBar.delegate = self
-// toolBar.isChienseEnglish = true
-// toolBar.leftItem.valueLabel.text = "左耳".l10n
-// toolBar.rightItem.valueLabel.text = "右耳".l10n
-//
-// tableView.backgroundColor = .clear
-// tableView.delegate = self
-// tableView.dataSource = self
-// tableView.estimatedRowHeight = 60
-// tableView.separatorStyle = .none
-// tableView.register(Chinese2EnglishCell.self, forCellReuseIdentifier: Chinese2EnglishCell.reuseID)
-//
-// bg.image = UIImage(named: "translate_bg")
-//
-//
-// }
-// override func setupLayout() {
-// toolBar.snp.makeConstraints { make in
-// make.width.centerX.equalToSuperview()
-// make.height.equalTo(120)
-// make.bottom.equalToSuperview().inset(20)
-// }
-// tableView.snp.makeConstraints { make in
-// make.top.equalToSuperview().inset(80)
-// make.left.right.equalToSuperview()
-// make.bottom.equalTo(toolBar.snp.top)
-// }
-// bg.snp.makeConstraints { make in
-// make.size.equalTo(90)
-// make.center.equalTo(tableView)
-// }
-// }
-// override func setupData() {
-// JoyGemSIDeviceManager.shared().delegate = self
-//
-// PcmSound.sharedInstance().delegate = self;
-// PcmSound.sharedInstance().setup(16000, withchannels: 1)
-// // do {
-// // try AVAudioSession.sharedInstance().setActive(true)
-// // } catch {
-// // print(error)
-// // }
-//
-// if TipsCache.needShow(type: .chinese2english) {
-// RecordTipsView(type: .chinese2english).show()
-// }
-// }
-// override func viewDidAppear(_ animated: Bool) {
-// super.viewDidAppear(animated)
-// navigationController?.fd_fullscreenPopGestureRecognizer?.isEnabled = false
-// }
-// override func viewDidDisappear(_ animated: Bool) {
-// super.viewDidDisappear(animated)
-// navigationController?.fd_fullscreenPopGestureRecognizer?.isEnabled = true
-// }
-// override func navleftViewTapped() {
-// if toolBar.recordBtn.isSelected {
-// CustomAlert.showWith(title: "提示".l10n, messgage: "当前正在录音,确定放弃当前录音吗".l10n, cancelCallback: {}) {
-// JoyGemSIDeviceManager.shared().stop()
-// PcmSound.sharedInstance().stopAudioUnit()
-// PcmSound.sharedInstance().cleanup()
-// super.navleftViewTapped()
-// }
-// }
-// else{
-// super.navleftViewTapped()
-// }
-// }
-// override func navRightViewTapped() {
-// let tip = RecordTipsView(type: .chinese2english)
-// tip.show()
-// }
-// func refreshData(){
-// tableView.reloadData()
-// if dataList.count > 0 {
-// tableView.scrollToRow(at: IndexPath(row: dataList.count - 1, section: 0), at: .none, animated: true)
-// bg.isHidden = true
-// }
-// else{
-// bg.isHidden = false
-// }
-// }
-//}
-//extension Chinese2EnglishVC:RecordBarDelegate{
-// func recordBarLanguageChange(_ bar: RecordBar) {
-//
-// }
-//
-//
-// func recordBar(_ bar: RecordBar, stateChange state: RecordBarSate) {
-// if state == .start {
-// startIndex += 100000
-// JoyGemSIDeviceManager.shared().originalLanguage = bar.leftItem.language.value
-// JoyGemSIDeviceManager.shared().targetLanguage = bar.rightItem.language.value
-// JoyGemSIDeviceManager.shared().start()
-// // do {
-// // try AVAudioSession.sharedInstance().setCategory(.playAndRecord, options: [.defaultToSpeaker])
-// // try AVAudioSession.sharedInstance().overrideOutputAudioPort(.speaker)
-// // } catch {
-// // print(error)
-// // }
-// }
-// else if state == .stop{
-// JoyGemSIDeviceManager.shared().stop()
-// }
-// }
-//}
-//extension Chinese2EnglishVC:UITableViewDelegate,UITableViewDataSource {
-// func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
-// return dataList.count
-// }
-//
-// func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
-// let cell = Chinese2EnglishCell.cell(withTableView: tableView, indexPath: indexPath)
-// let (vallue,index) = dataList[indexPath.row]
-// cell.data = vallue
-// return cell
-// }
-// func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
-//
-// }
-//}
-//
-//extension Chinese2EnglishVC:JoyGemSIDeviceManagerDelegate{
-//
-//
-// func siDeviceManagerStopped(_ manager: JoyGemSIDeviceManager, reason code: JoyGemRecordStopCode) {
-// Logger.debug("停止",code.rawValue)
-// if code == .passively {
-// toolBar.recordBtn.isSelected = false
-// }
-// }
-//
-// func siDeviceManager(_ manager: JoyGemSIDeviceManager, didUpdateRaw model: JoyGemAsrModel) {
-// Logger.debug("text: \(model.text),index: \(model.index)")
-// let msg = dataList.firstIndex (where: { (str,idx) in
-// return idx == Int(model.index) + startIndex
-// })
-// if (msg == nil) {
-// dataList.append((Chinese2EnglishCellModel(send: model.text),Int(model.index) + startIndex))
-// } else {
-// let (item,_) = dataList[msg!]
-// item.send = model.text
-// }
-// //
-// // ///监听到一句话结束,自动结束当前录音
-// // if (model.definite == true) {
-// // stopEarRecord()
-// // }
-// refreshData()
-// }
-//
-// func siDeviceManager(_ manager: JoyGemSIDeviceManager, didUpdateTranslate model: JoyGemAsrModel) {
-// let msg = dataList.firstIndex (where: { (str,idx) in
-// return idx == Int(model.index) + startIndex
-// })
-// if (msg == nil) {
-// dataList.append((Chinese2EnglishCellModel(response: model.text),Int(model.index) + startIndex))
-// } else {
-// let (item,_) = dataList[msg!]
-// item.response = model.text
-// }
-// refreshData()
-// }
-// func siDeviceManager(_ manager: JoyGemSIDeviceManager, didUpdateAudioData data: Data, sampleRate: UInt) {
-// PcmSound.sharedInstance().feed(data)
-// }
-// // func siDeviceManager(_ manager: JoyGemSIDeviceManager, didUpdateAudioData data: Data) {
-// // pcmData.append(data)
-// // PcmSound.sharedInstance().feed(data)
-// // }
-//
-// func siDeviceManager(_ manager: JoyGemSIDeviceManager, update mode: JoyGemRecordMode) {
-//
-// }
-//
-// func siDeviceManager(_ manager: JoyGemSIDeviceManager, saveFile path: String) {
-// Logger.debug("path: \(path)")
-// recordFilePath = path
-// }
-//
-// func siDeviceManager(_ manager: JoyGemSIDeviceManager, stateChange code: JoyGemStateCode) {
-// Logger.debug("code: \(code)")
-// }
-//
-// func siDeviceManager(_ manager: JoyGemSIDeviceManager, onError code: JoyGemErrorCode) {
-//
-// }
-//}
-//extension Chinese2EnglishVC:PcmSoundDelegate{
-// func remaining(_ frames: UInt) {
-//
-// }
-//
-//
-//}
icon.kf.setImage(with: model.image.yc.asUrl)
- if BleManager.shared.isConected(mac: model.mac) {
+ if JoyBleManager.shared.isConected(mac: model.mac) {
valueLabel.text = "已连接".l10n
bgView.alpha = 1
}
func reloadData() {
DeviceVM.shared.refresh {[weak self] result in
self?.collectionView.reloadData()
- if BleManager.shared.isConnetd{
+ if JoyBleManager.shared.isConnetd{
return
}
var autoConnetced = false
override func navRightViewTapped() {
App.shared.goToPage(BleScanVC())
// App.shared.goToPage(CalendarPickerVC())
-// BleManager.shared.checkSettingsConnected()
+// JoyBleManager.shared.checkSettingsConnected()
// ChatCache.shared.LargeDateDemoSave()
}
@objc func editAction(){
guard let self = self else {return}
if model.isSuccess{
YLprogressHUD.hidden()
- if let mac0 = BleManager.shared.connectPeripheral?.mac,let mac1 = DeviceCache.getLastConnected(),mac0 == mac1{
+ if let mac0 = JoyBleManager.shared.connectPeripheral?.mac,let mac1 = DeviceCache.getLastConnected(),mac0 == mac1{
DeviceCache.remove()
}
DeviceVM.shared.dataList.removeAll(where: {$0.deviceId == deviceModel.deviceId})
collectionView.reloadData()
- BleManager.shared.cancel()
+ JoyBleManager.shared.cancel()
reloadData()
}
else{
}
}
func startConectBle(_ model:HomeDeviceModel){
- BleManager.shared.connect(mac: model.mac) { result in
+ JoyBleManager.shared.connect(mac: model.mac) { result in
}
}
@objc func deviceChange(_ noti:Notification){
}
}
override func setupData() {
-// dataList = [
-// DialogTranslateCellModel(send: "你好", response: "hello",isPhone: false),
-// DialogTranslateCellModel(send: "Nice to meet you", response: "很高兴认识你",isPhone: true),
-// DialogTranslateCellModel(send: "深圳今天下雨吗", response: "ShenZhen is raining today?",isPhone: false),
-// DialogTranslateCellModel(send: "YES", response: "是的",isPhone: true),
-// ]
-
JoyGemSIManager.shared().delegate = self
JoyGemSIDeviceManager.shared().delegate = self
dataList.append(model)
refreshData()
-// JoyGemSIManager.shared().originalLanguage = toolBar.languageView.leftItem.language.value
-// JoyGemSIManager.shared().targetLanguage = toolBar.languageView.rightItem.language.value
JoyGemSIDeviceManager.shared().originalLanguage = toolBar.languageView.leftItem.language.value
JoyGemSIDeviceManager.shared().targetLanguage = toolBar.languageView.rightItem.language.value
- Logger.debug("源语言",JoyGemSIManager.shared().originalLanguage)
- Logger.debug("目标语言",JoyGemSIManager.shared().targetLanguage)
JoyGemSIDeviceManager.shared().start()
otherPcm = Data()
do {
func siManager(_ manager: JoyGemSIManager, didUpdateAudioData data: Data, sampleRate: UInt) {
PcmSound.sharedInstance().feed(data)
}
-// func siManager(_ manager: JoyGemSIManager, didUpdateAudioData data: Data) {
-// PcmSound.sharedInstance().feed(data)
-// }
-
func siManager(_ manager: JoyGemSIManager, onError code: JoyGemErrorCode) {
}
func siDeviceManager(_ manager: JoyGemSIDeviceManager, didUpdateAudioData data: Data, sampleRate: UInt) {
PcmSound.sharedInstance().feed(data)
}
-// func siDeviceManager(_ manager: JoyGemSIDeviceManager, didUpdateAudioData data: Data) {
-// //otherPcm.append(data)
-// PcmSound.sharedInstance().feed(data)
-// }
-
func siDeviceManager(_ manager: JoyGemSIDeviceManager, update mode: JoyGemRecordMode) {
}
extension DialogTranslateVC : PcmSoundDelegate {
-
func remaining(_ frames: UInt) {
Logger.debug("[frame:\(frames)]");
}
override func navleftViewTapped() {
if toolBar.recordBtn.isSelected {
CustomAlert.showWith(title: "提示".l10n, messgage: "当前正在录音,确定放弃当前录音吗?".l10n, cancelCallback: {}) {
- JoyGemSIDeviceManager.shared().stop()
+ JoyGemSIManager.shared().stop()
PcmSound.sharedInstance().stopAudioUnit()
PcmSound.sharedInstance().cleanup()
super.navleftViewTapped()
if let device = DeviceVM.shared.currentDevice{
imageView.kf.setImage(with: device.image.yc.asUrl)
- if BleManager.shared.isConnetd {
+ if JoyBleManager.shared.isConnetd {
alpha = 1
}
else{
var y = 0.0
for (index, value) in list.enumerated() {
let view = HomeCell()
- view.enable = BleManager.shared.isConnetd
+ view.enable = JoyBleManager.shared.isConnetd
addSubview(view)
view.type = value
@objc func deviceChange(_ noti:Notification){
for item in self.subviews{
if let view = item as? HomeCell {
- view.enable = BleManager.shared.isConnetd
+ view.enable = JoyBleManager.shared.isConnetd
}
}
}
}
}
@objc func tapAction(){
- if !BleManager.shared.isConnetd {
+ if !JoyBleManager.shared.isConnetd {
return
}
switch type {
v.text = "AI" + "伙伴,随叫随到".l10n
}
arrowIcon.image = UIImage(named: "arrow_2")
- self.enable = BleManager.shared.isConnetd
+ self.enable = JoyBleManager.shared.isConnetd
NotificationManager.add(self, selector: #selector(deviceChange(_:)), forName: .deviceValidChange)
}
}
@objc func chatAction(){
- if BleManager.shared.isConnetd {
+ if JoyBleManager.shared.isConnetd {
App.shared.goToPage(ChatVC())
}
}
@objc func deviceChange(_ noti:Notification){
- self.enable = BleManager.shared.isConnetd
+ self.enable = JoyBleManager.shared.isConnetd
}
}
}
}
override func setupData() {
- BleManager.shared.discoverDeviceCallback = {[weak self] devices in
+ JoyBleManager.shared.discoverDeviceCallback = {[weak self] devices in
self?.list = devices
self?.tableView.reloadData()
if devices.count > 0 {
// Created by liangshi on 2025/10/20.
//
-//import JoyGemAI
class DeviceVM:BaseVM{
static let shared = DeviceVM()
var dataList = [HomeDeviceModel]()
var currentDevice:HomeDeviceModel?{
for item in dataList {
- if let device = BleManager.shared.connectPeripheral,device.mac == item.mac {
+ if let device = JoyBleManager.shared.connectPeripheral,device.mac == item.mac {
return item
}
}
extension DeviceVM{
static func startScan(){
- BleManager.shared.startScanDevice()
+ JoyBleManager.shared.startScanDevice()
- BleManager.shared.didConnectDeviceCallback = { device in
+ JoyBleManager.shared.didConnectDeviceCallback = { device in
self.getDeviceInfo(device)
}
- BleManager.shared.conetedFailureCallback = { device in
+ JoyBleManager.shared.conetedFailureCallback = { device in
self.showError()
}
}
static func stopScan(){
- BleManager.shared.stopScanDevice()
+ JoyBleManager.shared.stopScanDevice()
}
static func startConnecte(_ data:DCPeripheral){
guard let name = data.device.name else {
ConnectPopView.shared.titleLabel.text = name
ConnectPopView.shared.stateDidChange(.connecting)
}
- BleManager.shared.connectPeripheral(data)
+ JoyBleManager.shared.connectPeripheral(data)
}
}
static func getDeviceInfo(_ device:DCPeripheral){
guard let prodName = device.device.name,prodName.count > 0 else{
showError()
- BleManager.shared.cancel()
+ JoyBleManager.shared.cancel()
return
}
JoyDevice.getDN { dn in
guard let deviceName = dn else{
- BleManager.shared.cancel()
+ JoyBleManager.shared.cancel()
self.showError()
return
}
}
else{
self.showError()
- BleManager.shared.cancel()
+ JoyBleManager.shared.cancel()
}
}
}
}
static func settingsConnected(){
- let list = BleManager.shared.checkSettingsConnected()
+ let list = JoyBleManager.shared.checkSettingsConnected()
if list.count == 0{
CustomAlert.showWith(title: "提示", messgage: "请前往系统设置连接蓝牙") {
if model.isSuccess{
YLprogressHUD.hidden()
DeviceVM.shared.dataList.removeAll(where: {$0.deviceId == self.deviceModel.deviceId})
- BleManager.shared.cancel()
+ JoyBleManager.shared.cancel()
App.shared.popPage()
}
else{
}
}
@objc func tapAction(){
- if !BleManager.shared.isConnetd{
+ if !JoyBleManager.shared.isConnetd{
YLprogressHUD.showAutoHiden("请先连接设备".l10n)
return
}
v.value = "R"
}
titleLabel.do { v in
- v.text = BleManager.shared.connectPeripheral?.device.name ?? ""
+ v.text = JoyBleManager.shared.connectPeripheral?.device.name ?? ""
v.font = .regular(20)
v.textColor = .hexString("#121212")
updateState()
}
func updateState(){
- if BleManager.shared.isConnetd {
+ if JoyBleManager.shared.isConnetd {
alpha = 1
}
else{
}
@objc func tapAction(_ tap:UITapGestureRecognizer){
- if !BleManager.shared.isConnetd {
+ if !JoyBleManager.shared.isConnetd {
return
}
let view = tap.view as! ItemView
}
override func setupViews() {
- self.navBar.title = BleManager.shared.connectPeripheral?.device.name ?? ""
+ self.navBar.title = JoyBleManager.shared.connectPeripheral?.device.name ?? ""
navBar.backgroundColor = .clear
view.backgroundColor = .color(.bgColor)
updateState()
}
func updateState(){
- self.findView.alpha = BleManager.shared.isConnetd ? 1:0.3
+ self.findView.alpha = JoyBleManager.shared.isConnetd ? 1:0.3
}
func selectedModeAction(_ mode:ModeEffectsType){
- if !BleManager.shared.isConnetd {
+ if !JoyBleManager.shared.isConnetd {
return
}
JoyDevice.setEQMode(mode)
}
}
@objc func findAction(){
- if BleManager.shared.isConnetd {
+ if JoyBleManager.shared.isConnetd {
App.shared.goToPage(FindVC())
}
v.textColor = .rgb(0x121212)
v.font = .regular(20)
v.textAlignment = .center
- v.text = BleManager.shared.connectPeripheral?.device.name ?? ""
+ v.text = JoyBleManager.shared.connectPeripheral?.device.name ?? ""
}
desLabel.do { (v) in
v.textColor = .rgb(0x121212)