/* Begin PBXBuildFile section */
30B13DEF1AA0E4C54D873276 /* Pods_playboy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A4F1BB919D567C3B6B0EBAA7 /* Pods_playboy.framework */; };
+ 3F372ECC2F6BF69800E5C3B2 /* DeepChordsSdk.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0D54E0EF2F0A61E600A80EE7 /* DeepChordsSdk.framework */; };
3F8F58292EBCA2B800FFC00B /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 3F8F58282EBCA2B800FFC00B /* PrivacyInfo.xcprivacy */; };
3FD1DFED2F0E00BF00A62733 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 3F8F58282EBCA2B800FFC00B /* PrivacyInfo.xcprivacy */; };
3FFB77C12F179F3100EF9A60 /* DeepChordsSdk.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0D54E0EF2F0A61E600A80EE7 /* DeepChordsSdk.framework */; platformFilter = ios; };
644D1BB5EDD3EA1D77C57786 /* Pods_DeepChordsSdk.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 248D8B53B5A178ACA5867275 /* Pods_DeepChordsSdk.framework */; };
7666589AAA94A323B6090425 /* Pods_playboy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A4F1BB919D567C3B6B0EBAA7 /* Pods_playboy.framework */; };
7A6613B4B617D6E71D34944C /* Pods_ShenYin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 90FF0C8B0D4D6AE0933FA672 /* Pods_ShenYin.framework */; };
- 817510A595D00CAD05E3772C /* BuildFile in Frameworks */ = {isa = PBXBuildFile; };
- F2E449CAD5874BE652A69B50 /* BuildFile in Frameworks */ = {isa = PBXBuildFile; };
+ 817510A595D00CAD05E3772C /* (null) in Frameworks */ = {isa = PBXBuildFile; };
+ F2E449CAD5874BE652A69B50 /* (null) in Frameworks */ = {isa = PBXBuildFile; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
+ 3F372ECE2F6BF69800E5C3B2 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 3F887B942E38D8DC00C98658 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 0D54E0EE2F0A61E600A80EE7;
+ remoteInfo = DeepChordsSdk;
+ };
3FD1DFE52F0E00BF00A62733 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 3F887B942E38D8DC00C98658 /* Project object */;
/* End PBXFileReference section */
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
+ 3F372ED22F6BF6A100E5C3B2 /* Exceptions for "DeepChordsSdk" folder in "ShenYin" target */ = {
+ isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
+ membershipExceptions = (
+ StarburstSdkDirect.xcframework,
+ );
+ target = 3F887B9B2E38D8DC00C98658 /* ShenYin */;
+ };
3F887BAE2E38D8DD00C98658 /* Exceptions for "ShenYin" folder in "ShenYin" target */ = {
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
Channel/DeepChords/DeepChords.plist,
- Channel/PLAYBOY/DcSdk/tool/CCBleManager.swift,
- Channel/PLAYBOY/DcSdk/tool/CCConfig.swift,
- Channel/PLAYBOY/DcSdk/tool/CCDevice.swift,
- Channel/PLAYBOY/DcSdk/tool/CCPage.swift,
- Channel/PLAYBOY/DcSdk/tool/DcCall.swift,
- Channel/PLAYBOY/DcSdk/tool/DcChatManager.swift,
- Channel/PLAYBOY/DcSdk/tool/DcChinese2Enligsh.swift,
- Channel/PLAYBOY/DcSdk/tool/DcSdkManager.swift,
- Channel/PLAYBOY/DcSdk/tool/DcStereo.swift,
- Channel/PLAYBOY/DcSdk/tool/DcSubTitle.swift,
- Channel/PLAYBOY/DcSdk/tool/DcTcty.swift,
- Channel/PLAYBOY/DcSdk/tool/DcXcly.swift,
- Channel/PLAYBOY/DcSdk/tool/JLAudioUnitKit.xcframework,
- Channel/PLAYBOY/DcSdk/tool/OpusTools.swift,
- Channel/PLAYBOY/DcSdk/VC/PbAiFunctionVC.swift,
- Channel/PLAYBOY/DcSdk/VC/PbChatVC.swift,
- Channel/PLAYBOY/DcSdk/VC/PbChinese2EnglishVC.swift,
- Channel/PLAYBOY/DcSdk/VC/PbDialogTranslateVC.swift,
- Channel/PLAYBOY/DcSdk/VC/PbHomeVC.swift,
- Channel/PLAYBOY/DcSdk/VC/PbModeVC.swift,
- Channel/PLAYBOY/DcSdk/VC/PbStereoCallVC.swift,
- Channel/PLAYBOY/DcSdk/VC/PbSubTitleVC.swift,
- Channel/PLAYBOY/DcSdk/VC/PbTabBC.swift,
- Channel/PLAYBOY/DcSdk/VC/PbTctyVC.swift,
- Channel/PLAYBOY/DcSdk/VC/PbXclyVC.swift,
+ Channel/PLAYBOY/Channel/Config/CCBleManager.swift,
+ Channel/PLAYBOY/Channel/Config/CCConfig.swift,
+ Channel/PLAYBOY/Channel/Config/CCDevice.swift,
+ Channel/PLAYBOY/Channel/Config/CCPage.swift,
+ Channel/PLAYBOY/Channel/UI/PbModeVC.swift,
+ Channel/PLAYBOY/Channel/UI/PbTabBC.swift,
Channel/PLAYBOY/PLAYBOY.plist,
Channel/PLAYBOY/PLAYBOY.storyboard,
Channel/PLAYBOY/PLAYBOY.xcassets,
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
"/Localized: Channel/DeepChords/DeepChords.storyboard",
+ Channel/DeepChords/Channel/Config/CCBleManager.swift,
+ Channel/DeepChords/Channel/Config/CCConfig.swift,
+ Channel/DeepChords/Channel/Config/CCDevice.swift,
+ Channel/DeepChords/Channel/Config/CCPage.swift,
+ Channel/DeepChords/Channel/UI/JoyAiFunctionVC.swift,
+ Channel/DeepChords/Channel/UI/JoyCallingRecordVC.swift,
+ Channel/DeepChords/Channel/UI/JoyChatVC.swift,
+ Channel/DeepChords/Channel/UI/JoyChinese2EnglishVC.swift,
+ Channel/DeepChords/Channel/UI/JoyDialogTranslateVC.swift,
+ Channel/DeepChords/Channel/UI/JoyHomeVC.swift,
+ Channel/DeepChords/Channel/UI/JoyModeVC.swift,
+ Channel/DeepChords/Channel/UI/JoyStereoCallVC.swift,
+ Channel/DeepChords/Channel/UI/JoySubTitleVC.swift,
+ Channel/DeepChords/Channel/UI/JoyTabBC.swift,
+ Channel/DeepChords/Channel/UI/JoyTctyVC.swift,
+ Channel/DeepChords/Channel/UI/JoyXclyVC.swift,
Channel/DeepChords/DeepChords.plist,
Channel/DeepChords/DeepChords.xcassets,
- Channel/DeepChords/JoySdk/tool/CCBleManager.swift,
- Channel/DeepChords/JoySdk/tool/CCConfig.swift,
- Channel/DeepChords/JoySdk/tool/CCDevice.swift,
- Channel/DeepChords/JoySdk/tool/CCPage.swift,
- Channel/DeepChords/JoySdk/tool/JoyCallRecord.swift,
- Channel/DeepChords/JoySdk/tool/JoyChat.swift,
- Channel/DeepChords/JoySdk/tool/JoyChinse2English.swift,
- Channel/DeepChords/JoySdk/tool/JoyDialog.swift,
- Channel/DeepChords/JoySdk/tool/JoyGemAI.framework,
- Channel/DeepChords/JoySdk/tool/JoyRecord.swift,
- Channel/DeepChords/JoySdk/tool/JoySdkManager.swift,
- Channel/DeepChords/JoySdk/tool/JoyTcty.swift,
- Channel/DeepChords/JoySdk/VC/JoyAiFunctionVC.swift,
- Channel/DeepChords/JoySdk/VC/JoyCallingRecordVC.swift,
- Channel/DeepChords/JoySdk/VC/JoyChatVC.swift,
- Channel/DeepChords/JoySdk/VC/JoyChinese2EnglishVC.swift,
- Channel/DeepChords/JoySdk/VC/JoyDialogTranslateVC.swift,
- Channel/DeepChords/JoySdk/VC/JoyHomeVC.swift,
- Channel/DeepChords/JoySdk/VC/JoyModeVC.swift,
- Channel/DeepChords/JoySdk/VC/JoyStereoCallVC.swift,
- Channel/DeepChords/JoySdk/VC/JoySubTitleVC.swift,
- Channel/DeepChords/JoySdk/VC/JoyTabBC.swift,
- Channel/DeepChords/JoySdk/VC/JoyTctyVC.swift,
- Channel/DeepChords/JoySdk/VC/JoyXclyVC.swift,
+ Channel/DeepChords/Sdk/JoyCallRecord.swift,
+ Channel/DeepChords/Sdk/JoyChat.swift,
+ Channel/DeepChords/Sdk/JoyChinse2English.swift,
+ Channel/DeepChords/Sdk/JoyDialog.swift,
+ Channel/DeepChords/Sdk/JoyGemAI.framework,
+ Channel/DeepChords/Sdk/JoyRecord.swift,
+ Channel/DeepChords/Sdk/JoySdkManager.swift,
+ Channel/DeepChords/Sdk/JoyTcty.swift,
);
target = 3FD1DFE32F0E00BF00A62733 /* playboy */;
};
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
/* Begin PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet section */
- 3FCB298D2F6A7BBD007AB47F /* Exceptions for "ShenYin" folder in "Embed Frameworks" build phase */ = {
+ 3F372ED32F6BF6A100E5C3B2 /* Exceptions for "DeepChordsSdk" folder in "Embed Frameworks" phase from "ShenYin" target */ = {
+ isa = PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet;
+ attributesByRelativePath = {
+ StarburstSdkDirect.xcframework = (CodeSignOnCopy, RemoveHeadersOnCopy, );
+ };
+ buildPhase = 3FEFE9092F1B252000D82F17 /* Embed Frameworks */;
+ membershipExceptions = (
+ StarburstSdkDirect.xcframework,
+ );
+ };
+ 3F372EF42F6CE3CE00E5C3B2 /* Exceptions for "ShenYin" folder in "Embed Frameworks" phase from "ShenYin" target */ = {
isa = PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet;
+ attributesByRelativePath = {
+ Channel/DeepChords/Sdk/JoyGemAI.framework = (CodeSignOnCopy, RemoveHeadersOnCopy, );
+ Channel/PLAYBOY/Sdk/JLAudioUnitKit.xcframework = (CodeSignOnCopy, RemoveHeadersOnCopy, );
+ };
buildPhase = 3FEFE9092F1B252000D82F17 /* Embed Frameworks */;
membershipExceptions = (
- Channel/DeepChords/JoySdk/tool/JoyGemAI.framework,
+ Channel/DeepChords/Sdk/JoyGemAI.framework,
+ Channel/PLAYBOY/Sdk/JLAudioUnitKit.xcframework,
);
};
- 3FCB29902F6A7DAD007AB47F /* Exceptions for "ShenYin" folder in "Embed Frameworks" build phase */ = {
+ 3FCB29902F6A7DAD007AB47F /* Exceptions for "ShenYin" folder in "Embed Frameworks" phase from "playboy" target */ = {
isa = PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet;
+ attributesByRelativePath = {
+ Channel/PLAYBOY/Sdk/JLAudioUnitKit.xcframework = (CodeSignOnCopy, RemoveHeadersOnCopy, );
+ };
buildPhase = 3FD1DFEF2F0E00BF00A62733 /* Embed Frameworks */;
membershipExceptions = (
- Channel/PLAYBOY/DcSdk/tool/JLAudioUnitKit.xcframework,
+ Channel/PLAYBOY/Sdk/JLAudioUnitKit.xcframework,
);
};
- 3FCB2E832F6AAEC8007AB47F /* Exceptions for "DeepChordsSdk" folder in "Embed Frameworks" build phase */ = {
+ 3FCB2E832F6AAEC8007AB47F /* Exceptions for "DeepChordsSdk" folder in "Embed Frameworks" phase from "DeepChordsSdk" target */ = {
isa = PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet;
+ attributesByRelativePath = {
+ StarburstSdkDirect.xcframework = (CodeSignOnCopy, RemoveHeadersOnCopy, );
+ };
buildPhase = 3FFB77C52F17A11100EF9A60 /* Embed Frameworks */;
membershipExceptions = (
StarburstSdkDirect.xcframework,
);
};
- 3FCB2E862F6AAEEE007AB47F /* Exceptions for "DeepChordsSdk" folder in "Embed Frameworks" build phase */ = {
+ 3FCB2E862F6AAEEE007AB47F /* Exceptions for "DeepChordsSdk" folder in "Embed Frameworks" phase from "playboy" target */ = {
isa = PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet;
+ attributesByRelativePath = {
+ StarburstSdkDirect.xcframework = (CodeSignOnCopy, RemoveHeadersOnCopy, );
+ };
buildPhase = 3FD1DFEF2F0E00BF00A62733 /* Embed Frameworks */;
membershipExceptions = (
StarburstSdkDirect.xcframework,
0D54E0F02F0A61E600A80EE7 /* DeepChordsSdk */ = {
isa = PBXFileSystemSynchronizedRootGroup;
exceptions = (
- 3FCB2E832F6AAEC8007AB47F /* Exceptions for "DeepChordsSdk" folder in "Embed Frameworks" build phase */,
+ 3F372ED22F6BF6A100E5C3B2 /* Exceptions for "DeepChordsSdk" folder in "ShenYin" target */,
+ 3F372ED32F6BF6A100E5C3B2 /* Exceptions for "DeepChordsSdk" folder in "Embed Frameworks" phase from "ShenYin" target */,
+ 3FCB2E832F6AAEC8007AB47F /* Exceptions for "DeepChordsSdk" folder in "Embed Frameworks" phase from "DeepChordsSdk" target */,
3FCB2E7F2F6AAE8C007AB47F /* Exceptions for "DeepChordsSdk" folder in "playboy" target */,
- 3FCB2E862F6AAEEE007AB47F /* Exceptions for "DeepChordsSdk" folder in "Embed Frameworks" build phase */,
+ 3FCB2E862F6AAEEE007AB47F /* Exceptions for "DeepChordsSdk" folder in "Embed Frameworks" phase from "playboy" target */,
);
path = DeepChordsSdk;
sourceTree = "<group>";
isa = PBXFileSystemSynchronizedRootGroup;
exceptions = (
3F887BAE2E38D8DD00C98658 /* Exceptions for "ShenYin" folder in "ShenYin" target */,
- 3FCB298D2F6A7BBD007AB47F /* Exceptions for "ShenYin" folder in "Embed Frameworks" build phase */,
+ 3F372EF42F6CE3CE00E5C3B2 /* Exceptions for "ShenYin" folder in "Embed Frameworks" phase from "ShenYin" target */,
3FD1DFF52F0E00BF00A62733 /* Exceptions for "ShenYin" folder in "playboy" target */,
- 3FCB29902F6A7DAD007AB47F /* Exceptions for "ShenYin" folder in "Embed Frameworks" build phase */,
+ 3FCB29902F6A7DAD007AB47F /* Exceptions for "ShenYin" folder in "Embed Frameworks" phase from "playboy" target */,
);
path = ShenYin;
sourceTree = "<group>";
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- F2E449CAD5874BE652A69B50 /* BuildFile in Frameworks */,
+ F2E449CAD5874BE652A69B50 /* (null) in Frameworks */,
7A6613B4B617D6E71D34944C /* Pods_ShenYin.framework in Frameworks */,
+ 3F372ECC2F6BF69800E5C3B2 /* DeepChordsSdk.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
buildActionMask = 2147483647;
files = (
3FFB77C12F179F3100EF9A60 /* DeepChordsSdk.framework in Frameworks */,
- 817510A595D00CAD05E3772C /* BuildFile in Frameworks */,
+ 817510A595D00CAD05E3772C /* (null) in Frameworks */,
30B13DEF1AA0E4C54D873276 /* Pods_playboy.framework in Frameworks */,
7666589AAA94A323B6090425 /* Pods_playboy.framework in Frameworks */,
);
buildRules = (
);
dependencies = (
+ 3F372ECF2F6BF69800E5C3B2 /* PBXTargetDependency */,
);
fileSystemSynchronizedGroups = (
3F887B9E2E38D8DC00C98658 /* ShenYin */,
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-ShenYin/Pods-ShenYin-resources-${CONFIGURATION}-input-files.xcfilelist",
);
+ inputPaths = (
+ );
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-ShenYin/Pods-ShenYin-resources-${CONFIGURATION}-output-files.xcfilelist",
);
+ outputPaths = (
+ );
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ShenYin/Pods-ShenYin-resources.sh\"\n";
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-playboy/Pods-playboy-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
+ inputPaths = (
+ );
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-playboy/Pods-playboy-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
+ outputPaths = (
+ );
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-playboy/Pods-playboy-frameworks.sh\"\n";
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-ShenYin/Pods-ShenYin-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
+ inputPaths = (
+ );
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-ShenYin/Pods-ShenYin-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
+ outputPaths = (
+ );
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ShenYin/Pods-ShenYin-frameworks.sh\"\n";
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
+ 3F372ECF2F6BF69800E5C3B2 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 0D54E0EE2F0A61E600A80EE7 /* DeepChordsSdk */;
+ targetProxy = 3F372ECE2F6BF69800E5C3B2 /* PBXContainerItemProxy */;
+ };
3FD1DFE42F0E00BF00A62733 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
platformFilter = ios;
"$(PROJECT_DIR)/framework",
"$(PROJECT_DIR)/ShenYin/Sdk/JoySdk/tool",
"$(PROJECT_DIR)/ShenYin/Channel/DeepChords/JoySdk/tool",
+ "$(PROJECT_DIR)/ShenYin/Channel/DeepChords/Sdk",
);
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = ShenYin/Channel/DeepChords/DeepChords.plist;
"$(PROJECT_DIR)/framework",
"$(PROJECT_DIR)/ShenYin/Sdk/JoySdk/tool",
"$(PROJECT_DIR)/ShenYin/Channel/DeepChords/JoySdk/tool",
+ "$(PROJECT_DIR)/ShenYin/Channel/DeepChords/Sdk",
);
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = ShenYin/Channel/DeepChords/DeepChords.plist;
import UIKit
import CoreBluetooth
import AVFAudio
+import DeepChordsSdk
-//#if FEATURE_X
-//import DeepChordsSdk
-//#endif
-
-
-class DCPeripheral{
- var device:CBPeripheral!
- var mac = ""
- init(device: CBPeripheral!, mac: String = "") {
- self.device = device
- self.mac = mac
- }
-}
class CCBleManager: NSObject {
var discoverDeviceCallback: (([DCPeripheral]) -> Void)?
var devices: [DCPeripheral] = []
var connectPeripheral: DCPeripheral?
static let shared = CCBleManager()
- var isConnetd:Bool = false
+ var isConneted:Bool = false
private override init() {
super.init()
case.unauthorized:
break
case.poweredOff:
- self.isConnetd = false
+ self.isConneted = false
NotificationManager.post(type: .deviceValidChange, objtect: nil)
break
case.poweredOn:
if devices.map({ $0.device }).contains(peripheral) {
return
}
- Logger.debug(peripheral)
-
-// if let name = peripheral.name,name.hasPrefix("AI") {
-// let mac = DcSdkManager.getMac(advertisementData) ?? ""
-// devices.append(DCPeripheral(device: peripheral,mac: mac))
-// discoverDeviceCallback?(devices)
-// }
-// else{
-//// let mac = JoySdkManager.getMac(advertisementData) ?? ""
-//// devices.append(DCPeripheral(device: peripheral,mac: mac))
-//// discoverDeviceCallback?(devices)
-// }
- if CCConfig.sdkType == .joy{
- let mac = JoySdkManager.getMac(advertisementData) ?? ""
+ Logger.debug("发现设备 ",peripheral)
+
+ if let name = peripheral.name,name.lowercased().contains("deep"),let mac = JoySdkManager.getMac(advertisementData){
+ devices.append(DCPeripheral(device: peripheral,mac: mac))
+ discoverDeviceCallback?(devices)
+ }
+ else if let mac = DcSdkManager.getMac(advertisementData){
devices.append(DCPeripheral(device: peripheral,mac: mac))
discoverDeviceCallback?(devices)
}
-// else{
-// let mac = DcSdkManager.getMac(advertisementData) ?? ""
-// devices.append(DCPeripheral(device: peripheral,mac: mac))
-// discoverDeviceCallback?(devices)
-// }
}
func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) {
stopScanDevice()
- Logger.debug("蓝牙已连接 \(peripheral)")
+ Logger.debug("已连接 \(peripheral)")
peripheral.delegate = self
if CCConfig.sdkType == .joy{
peripheral.discoverServices([CBUUID(string: JoySdkManager.serviceUUID),CBUUID(string: OtaMananger.otaServiceUUId)]);
}
else{
-// DCBleManager.shared.centralManager(central, didConnect: peripheral)
-// peripheral.discoverServices([CBUUID(string: DCBleManager.serviceUUID),CBUUID(string: OtaMananger.otaServiceUUId)]);
+ DCBleManager.shared.centralManager(central, didConnect: peripheral)
+ peripheral.discoverServices([CBUUID(string: DCBleManager.serviceUUID),CBUUID(string: OtaMananger.otaServiceUUId)]);
}
}
func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?) {
- Logger.debug("peripheral: %@ failed to connect", peripheral,"error \(error)")
+ Logger.debug("连接失败\(peripheral)")
+ if let err = error {
+ Logger.debug("error \(err)")
+ }
conetedFailureCallback?(connectPeripheral!)
}
func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) {
- Logger.debug("蓝牙已断开 \(peripheral)","error \(error)")
+ Logger.debug("蓝牙已断开 \(peripheral)")
+ if let err = error {
+ Logger.debug("error \(err)")
+ }
YLprogressHUD.showAutoHiden("蓝牙已断开".l10n)
- self.isConnetd = false
+ self.isConneted = false
if CCConfig.sdkType == .joy{
JoySdkManager.shared.bleDisConnected()
}
else{
-// DCBleManager.shared.centralManager(central, didDisconnectPeripheral: peripheral, error: nil)
+ DCBleManager.shared.centralManager(central, didDisconnectPeripheral: peripheral, error: nil)
}
- NotificationManager.post(type: .deviceValidChange, objtect: nil)
OtaMananger.shared.otaManager.centralManager(central, didDisconnectPeripheral: peripheral, error: error)
+ NotificationManager.post(type: .deviceValidChange, objtect: nil)
checkConectState()
}
}
}
func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {
- if CCConfig.sdkType == .joy{
+ if service.uuid.uuidString == OtaMananger.otaServiceUUId{
+ OtaMananger.shared.otaManager.peripheral(peripheral, didDiscoverCharacteristicsFor: service, error: error)
+ }
+ else if CCConfig.sdkType == .joy{
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)
- }
}
else{
-// DCBleManager.shared.peripheral(peripheral, didDiscoverCharacteristicsFor: service, error: error)
+ DCBleManager.shared.peripheral(peripheral, didDiscoverCharacteristicsFor: service, error: error)
}
}
}
func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
- // Logger.debug("收到数据 ===uUId ",characteristic.uuid)
+ //Logger.debug("收到数据 ===uUId ",characteristic.uuid)
if CCConfig.sdkType == .joy{
if OtaMananger.isOtadata(characteristic){
if let _ = characteristic.value,error == nil {
}
}
else{
-// DCBleManager.shared.peripheral(peripheral, didUpdateValueFor: characteristic, 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)?) {
-
- }
}
extension CCBleManager{
func startScanDevice() {
- // centralManager.stopScan()
Logger.debug("扫描中...")
Logger.debug("蓝牙状态",centralManager.state.rawValue)
devices = []
// devices.append(DCPeripheral(device: item,mac: mac))
// }
// }
- if CCConfig.sdkType == .joy{
- centralManager.scanForPeripherals(withServices: [CBUUID(string: JoySdkManager.serviceUUID)],options: [CBCentralManagerScanOptionAllowDuplicatesKey : false])
- }
- else{
-// centralManager.scanForPeripherals(withServices: [CBUUID(string: DCBleManager.serviceUUID)],options: [CBCentralManagerScanOptionAllowDuplicatesKey : false])
- }
+ centralManager.scanForPeripherals(withServices: [CBUUID(string: JoySdkManager.serviceUUID),CBUUID(string: DCBleManager.serviceUUID)],options: [CBCentralManagerScanOptionAllowDuplicatesKey : false])
discoverDeviceCallback?(devices)
}
func connectPeripheral(_ peripheral: DCPeripheral) {
connectPeripheral = peripheral
-// if let name = peripheral.device.name,name.hasPrefix("AI") {
-// CCDevice.isJoy = false
-// }
-// else{
-// CCDevice.isJoy = true
-// }
+ if let name = peripheral.device.name,name.lowercased().contains("deep") {
+ CCConfig.sdkType = .joy
+ }
+ else{
+ CCConfig.sdkType = .lianJuXing
+ }
CCDevice.initSdk()
Logger.debug(peripheral.device.name ?? "","连接中...")
centralManager.connect(peripheral.device, options: [CBConnectPeripheralOptionEnableTransportBridgingKey:true])
func cancel() {
guard let peripheral = connectPeripheral else { return }
- if self.isConnetd {
- self.isConnetd = false
+ if self.isConneted {
+ self.isConneted = false
centralManager.cancelPeripheralConnection(peripheral.device)
}
func isConected(mac:String?)->Bool{
guard let mac = mac,let device = connectPeripheral else { return false }
if device.mac == mac {
- return isConnetd
+ return isConneted
}
else{
return false
}
CCBleManager.shared.startScanDevice()
}
-
- func checkSettingsConnected()->[CBPeripheral]{
- if CCConfig.sdkType == .joy {
- let list = centralManager.retrieveConnectedPeripherals(withServices: [CBUUID(string: JoySdkManager.serviceUUID)])
- Logger.debug("已连接设备",list)
- return list
-// return []
- }
- else{
-// let list = centralManager.retrieveConnectedPeripherals(withServices: [CBUUID(string: DCBleManager.serviceUUID)])
-// Logger.debug("已连接设备",list)
-// return list
- return []
- }
- }
}
extension CCBleManager{
guard let mac = connectPeripheral?.mac else {
return
}
- if isConnetd {
+ if isConneted {
return
}
connect(mac: mac) {result in
/// app类型
static let appType = CCAppType.deepchords
/// sdk类型
- static let sdkType = CCSdkType.joy
+ static var sdkType = CCSdkType.joy
/// 是否显示北科AI
static var showRaisoundChat = false
// Created by liangshi on 2025/12/25.
//
import JoyGemAI
+import DeepChordsSdk
+
class CCDevice{
static func initSdk(){
if CCConfig.sdkType == .joy {
JoySdkManager.shared.setupSdk()
}
else{
-// DcSdkManager.shared.initSdk()
+ DcSdkManager.shared.initSdk()
}
}
static func translate(text:String,from:String,to:String,finished:@escaping ((stream:String,finish:Bool)?)->Void){
}
}
else{
-// DCText.cancelTranslateByTextWithSplit()
-// DCText.translate(text: text, from: from, to: to) { result in
-// finished(result)
-// }
+ DCText.cancelTranslateByTextWithSplit()
+ DCText.translate(text: text, from: from, to: to) { result in
+ finished(result)
+ }
}
}
static func summary(text:String,finished:@escaping ((stream:String,finish:Bool)?)->Void){
}
}
else{
-// DCText.cancelSummaryByTextWithSplit()
-// DCText.sumary(text: text) { result in
-// finished(result)
-// }
+ DCText.cancelSummaryByTextWithSplit()
+ DCText.sumary(text: text) { result in
+ finished(result)
+ }
}
}
}
}
}
else{
-// let value:UInt8 = mode == .cancel ? 0:1
-// DCDevice.shared.findDevice(state: value) { result in
-// }
+ let value:UInt8 = mode == .cancel ? 0:1
+ DCDevice.shared.findDevice(state: value) { result in
+ }
}
}
static func getEQMode(finished:@escaping (ModeEffectsType?)->Void){
// 0x03(爵士)
// 0x04(摇滚)
// 0x05(自定义)
-// DCDevice.shared.getEQ { (arg0,result) in
-// guard let (type,list) = arg0 else{
-// finished(nil)
-// return
-// }
-// switch type{
-// case 0:
-// finished(.normal)
-// case 1:
-// finished(.pop)
-// case 2:
-// finished(.classic)
-// case 3:
-// finished(.jazz)
-// case 4:
-// finished(.rock)
-// case 5:
-// finished(.custom)
-// default:
-// finished(nil)
-// }
-// }
+ DCDevice.shared.getEQ { (arg0,result) in
+ guard let (type,list) = arg0 else{
+ finished(nil)
+ return
+ }
+ switch type{
+ case 0:
+ finished(.normal)
+ case 1:
+ finished(.pop)
+ case 2:
+ finished(.classic)
+ case 3:
+ finished(.jazz)
+ case 4:
+ finished(.rock)
+ case 5:
+ finished(.custom)
+ default:
+ finished(nil)
+ }
+ }
}
}
static func setEQMode(_ type:ModeEffectsType){
Logger.debug("setEQMode:\(err)");
}
}else{
-// let value:UInt8 = UInt8(type.rawValue)
-// DCDevice.shared.setEQ(type: value) { success in
-//
-// }
+ let value:UInt8 = UInt8(type.rawValue)
+ DCDevice.shared.setEQ(type: value) { success in
+
+ }
}
}
}
}
else{
-// DCDevice.shared.getEQ { (arg0,result) in
-// guard let (type,list) = arg0 else{
-// finished(nil)
-// return
-// }
-// if type == 5{
-// let nums = list.map { NSNumber(value: $0) }
-// finished(nums)
-// }
-// else{
-// finished(nil)
-// }
-// }
+ DCDevice.shared.getEQ { (arg0,result) in
+ guard let (type,list) = arg0 else{
+ finished(nil)
+ return
+ }
+ if type == 5{
+ let nums = list.map { NSNumber(value: $0) }
+ finished(nums)
+ }
+ else{
+ finished(nil)
+ }
+ }
}
}
static func resetCustomEQ(){
}
}
else{
-// let list = [
-// 0,0,0,0,0,0,0,0,0,0,0,0
-// ]
-// let dispatchGroup = DispatchGroup()
-// for (index,item) in list.enumerated() {
-// dispatchGroup.enter()
-// DCDevice.shared.setCustomEQ(index: UInt8(index), value: item) {result in
-// dispatchGroup.leave()
-// }
-// }
-// dispatchGroup.notify(queue:.main) {
-// DCDevice.shared.setEQ(type: 0x05) {result in
-// }
-// }
+ let list = [
+ 0,0,0,0,0,0,0,0,0,0,0,0
+ ]
+ let dispatchGroup = DispatchGroup()
+ for (index,item) in list.enumerated() {
+ dispatchGroup.enter()
+ DCDevice.shared.setCustomEQ(index: UInt8(index), value: item) {result in
+ dispatchGroup.leave()
+ }
+ }
+ dispatchGroup.notify(queue:.main) {
+ DCDevice.shared.setEQ(type: 0x05) {result in
+ }
+ }
}
}
static func setCustomEQ(index:Int,value:Int){
}
}
else{
-// DCDevice.shared.setCustomEQ(index: UInt8(index), value: value) {result in
-// }
+ DCDevice.shared.setCustomEQ(index: UInt8(index), value: value) {result in
+ }
}
}
}
extension CCDevice{
-// static func getMac(finished:@escaping ((_ mac:String?)->Void)) {
-// if CCDevice.isJoy {
-// JoyGemAIManager.shared().device.macAddress { edr, ble in
-// Logger.debug("edr:\(edr),ble:\(ble)");
-// finished(edr.uppercased())
-// } error: { error in
-// Logger.debug("\(error!.localizedDescription)")
-// finished(nil)
-// }
-// }
-// else{
-//// DCDevice.shared.getSoftVersion {result in
-//// finished(result)
-//// }
-// }
-// }
static func getDN(finished:@escaping ((_ mac:String?)->Void)) {
if CCConfig.sdkType == .joy {
JoyGemAIManager.shared().device.getDN { deviceName in
}
}
else{
-// let dn = DCText.getDeviceName()
-// finished(dn)
+ let dn = DCText.getDeviceName()
+ finished(dn)
}
}
static func getVersion(finished:@escaping ((_ version:String?)->Void)) {
}
}
else{
-// DCDevice.shared.getSoftVersion {result in
-// finished(result)
-// }
+ DCDevice.shared.getSoftVersion {result in
+ finished(result)
+ }
}
}
}
App.shared.goToPage(JoyChatVC())
}
else{
-// App.shared.goToPage(PbChatVC())
+ App.shared.goToPage(PbChatVC())
}
}
static func gotoFieldRecord(){
App.shared.goToPage(JoyXclyVC())
}
else{
-// App.shared.goToPage(PbXclyVC())
+ App.shared.goToPage(PbXclyVC())
}
}
static func gotoCallRecord(){
}
}
else{
-// App.shared.goToPage(PbStereoCallVC())
+ App.shared.goToPage(PbStereoCallVC())
}
}
static func gotoChinese2Enlgish(){
App.shared.goToPage(JoyChinese2EnglishVC())
}
else{
-// App.shared.goToPage(PbChinese2EnglishVC())
+ App.shared.goToPage(PbChinese2EnglishVC())
}
}
static func gotoTcty(){
App.shared.goToPage(JoyTctyVC())
}
else{
-// App.shared.goToPage(PbTctyVC())
+ App.shared.goToPage(PbTctyVC())
}
}
static func gotoDialogTranslate(){
App.shared.goToPage(JoyDialogTranslateVC())
}
else{
-// App.shared.goToPage(PbDialogTranslateVC())
+ App.shared.goToPage(PbDialogTranslateVC())
}
}
static func gotoSubTitle(){
}
@objc func chatAction(){
if CCBleManager.shared.isConected(mac: device.mac){
-// CCPage.gotoChat()
+ CCPage.gotoChat()
}
}
@objc func subTitleAction(){
func reloadData() {
DeviceVM.shared.refresh {[weak self] result in
self?.collectionView.reloadData()
- if CCBleManager.shared.isConnetd{
+ if CCBleManager.shared.isConneted{
return
}
var autoConnetced = false
override func navRightViewTapped() {
App.shared.goToPage(BleScanVC())
// App.shared.goToPage(CalendarPickerVC())
-// CCBleManager.shared.checkSettingsConnected()
// ChatCache.shared.LargeDateDemoSave()
}
@objc func editAction(){
updateState()
}
func updateState(){
- self.view.alpha = CCBleManager.shared.isConnetd ? 1:0.5
+ self.view.alpha = CCBleManager.shared.isConneted ? 1:0.5
}
func selectedModeAction(_ mode:ModeEffectsType){
- if !CCBleManager.shared.isConnetd {
+ if !CCBleManager.shared.isConneted {
return
}
CCDevice.setEQMode(mode)
}
}
@objc func findAction(){
- if CCBleManager.shared.isConnetd {
+ if CCBleManager.shared.isConneted {
App.shared.goToPage(FindVC())
}
func start(){
startIndex += 100000
-// JoyGemSIManager.shared().originalLanguage = kJoyGemAILocalizationAuto
-// JoyGemSIManager.shared().targetLanguage = kJoyGemAILocalizationAuto
+ JoyGemSIManager.shared().originalLanguage = kJoyGemAILocalizationAuto
+ JoyGemSIManager.shared().targetLanguage = kJoyGemAILocalizationAuto
JoyGemSIManager.shared().start()
// do {
// try AVAudioSession.sharedInstance().setCategory(.playAndRecord, options: [.defaultToSpeaker])
DeviceCache.saveLastConnected(mac: CCBleManager.shared.connectPeripheral!.mac)
DeviceCache.shared.add(CCBleManager.shared.connectPeripheral!.device.identifier.uuidString, mac: CCBleManager.shared.connectPeripheral!.mac)
- CCBleManager.shared.isConnetd = true
+ CCBleManager.shared.isConneted = true
CCBleManager.shared.didConnectDeviceCallback?(CCBleManager.shared.connectPeripheral!)
NotificationManager.post(type: .deviceValidChange, objtect: nil)
DeviceVM.updateOtaVersion()
//#endif
-class DCPeripheral{
- var device:CBPeripheral!
- var mac = ""
- init(device: CBPeripheral!, mac: String = "") {
- self.device = device
- self.mac = mac
- }
-}
-
class CCBleManager: NSObject {
var discoverDeviceCallback: (([DCPeripheral]) -> Void)?
var didConnectDeviceCallback: ((DCPeripheral) -> Void)?
var devices: [DCPeripheral] = []
var connectPeripheral: DCPeripheral?
static let shared = CCBleManager()
- var isConnetd:Bool = false
+ var isConneted:Bool = false
private override init() {
super.init()
case.unauthorized:
break
case.poweredOff:
- self.isConnetd = false
+ self.isConneted = false
NotificationManager.post(type: .deviceValidChange, objtect: nil)
break
case.poweredOn:
peripheral.discoverServices([CBUUID(string: DCBleManager.serviceUUID)]);
}
func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?) {
- Logger.debug("peripheral: %@ failed to connect", peripheral)
+ Logger.debug("连接失败\(peripheral)")
+ if let err = error {
+ Logger.debug("error \(err)")
+ }
conetedFailureCallback?(connectPeripheral!)
}
func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) {
- Logger.debug("蓝牙已断开 \(peripheral)",error?.localizedDescription ?? "",error.debugDescription)
+ Logger.debug("蓝牙已断开 \(peripheral)")
+ if let err = error {
+ Logger.debug("error \(err)")
+ }
YLprogressHUD.showAutoHiden("蓝牙已断开".l10n)
- self.isConnetd = false
+ self.isConneted = false
DCBleManager.shared.centralManager(central, didDisconnectPeripheral: peripheral, error: nil)
NotificationManager.post(type: .deviceValidChange, objtect: nil)
checkConectState()
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)?) {
- }
-
func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
- //Logger.debug("收到数据 ===uUId ",characteristic.uuid)
- 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)?) {
-
+ DCBleManager.shared.peripheral(peripheral, didUpdateValueFor: characteristic, error: error)
}
}
extension CCBleManager{
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: DCBleManager.serviceUUID)],options: [CBCentralManagerScanOptionAllowDuplicatesKey : false])
discoverDeviceCallback?(devices)
}
func cancel() {
guard let peripheral = connectPeripheral else { return }
- if self.isConnetd {
- self.isConnetd = false
+ if self.isConneted {
+ self.isConneted = false
centralManager.cancelPeripheralConnection(peripheral.device)
}
}
}
-extension CCBleManager{
- func joySdkSend(_ data: Data, with characteristic: CBCharacteristic) {
- if let connectPeripheral = connectPeripheral{
- connectPeripheral.device.writeValue(data, for: characteristic, type:.withoutResponse)
- }
- }
-}
-
extension CCBleManager{
func isConected(mac:String)->Bool{
guard let device = connectPeripheral else { return false }
if device.mac == mac {
- return isConnetd
+ return isConneted
}
else{
return false
}
}
- // #连接有问题,应当获取设置里面已连接的设备
+ //#连接有问题,应当获取设置里面已连接的设备
func connect(mac:String, finished:@escaping ((Bool) -> Void)){
CCBleManager.shared.cancel()
CCBleManager.shared.discoverDeviceCallback = { list in
}
CCBleManager.shared.startScanDevice()
}
-
- func checkSettingsConnected()->[CBPeripheral]{
- let list = centralManager.retrieveConnectedPeripherals(withServices: [CBUUID(string: DCBleManager.serviceUUID)])
- Logger.debug("已连接设备",list)
- return list
- }
}
extension CCBleManager{
guard let mac = connectPeripheral?.mac else {
return
}
- if isConnetd {
+ if isConneted {
return
}
connect(mac: mac) {result in
// ShenYin
//
// Created by liangshi on 2025/12/25.
-//
-//import JoyGemAI
+
import DeepChordsSdk
class CCDevice{
static func initSdk(){
}
}
static func setEQMode(_ type:ModeEffectsType){
- let value:UInt8 = UInt8(type.rawValue)
- DCDevice.shared.setEQ(type: value) { success in
-
- }
+ let value:UInt8 = UInt8(type.rawValue)
+ DCDevice.shared.setEQ(type: value) { success in
+
+ }
}
-
-
static func getCustomEQ(finished:@escaping ([NSNumber]?)->Void){
- DCDevice.shared.getEQ { (arg0,result) in
- guard let (type,list) = arg0 else{
- finished(nil)
- return
- }
- if type == 5{
- let nums = list.map { NSNumber(value: $0) }
- finished(nums)
- }
- else{
- finished(nil)
- }
+ DCDevice.shared.getEQ { (arg0,result) in
+ guard let (type,list) = arg0 else{
+ finished(nil)
+ return
+ }
+ if type == 5{
+ let nums = list.map { NSNumber(value: $0) }
+ finished(nums)
+ }
+ else{
+ finished(nil)
}
+ }
}
static func resetCustomEQ(){
- let list = [
- 0,0,0,0,0,0,0,0,0,0,0,0
- ]
- let dispatchGroup = DispatchGroup()
- for (index,item) in list.enumerated() {
- dispatchGroup.enter()
- DCDevice.shared.setCustomEQ(index: UInt8(index), value: item) {result in
- dispatchGroup.leave()
- }
+ let list = [
+ 0,0,0,0,0,0,0,0,0,0,0,0
+ ]
+ let dispatchGroup = DispatchGroup()
+ for (index,item) in list.enumerated() {
+ dispatchGroup.enter()
+ DCDevice.shared.setCustomEQ(index: UInt8(index), value: item) {result in
+ dispatchGroup.leave()
}
- dispatchGroup.notify(queue:.main) {
- DCDevice.shared.setEQ(type: 0x05) {result in
- }
+ }
+ dispatchGroup.notify(queue:.main) {
+ DCDevice.shared.setEQ(type: 0x05) {result in
}
+ }
}
static func setCustomEQ(index:Int,value:Int){
- DCDevice.shared.setCustomEQ(index: UInt8(index), value: value) {result in
- }
+ DCDevice.shared.setCustomEQ(index: UInt8(index), value: value) {result in
+ }
}
}
extension CCDevice{
static func getDN(finished:@escaping ((_ mac:String?)->Void)) {
- let dn = DCText.getDeviceName()
- finished(dn)
+ let dn = DCText.getDeviceName()
+ finished(dn)
}
static func getVersion(finished:@escaping ((_ version:String?)->Void)) {
- DCDevice.shared.getSoftVersion {result in
- finished(result)
- }
+ DCDevice.shared.getSoftVersion {result in
+ finished(result)
+ }
}
}
override func setupViews() {
navBar.title = device.productName
navBar.backgroundColor = .color(.bgColor)
- navBar.rightView.isHidden = false
+// navBar.rightView.isHidden = false
navBar.rightView.setTitle("字幕翻译", for: .normal)
view.backgroundColor = .color(.bgColor)
// navBar.rightView.setImage(UIImage(named: "add_icon"), for: .normal)
DeviceVM.shared.refresh {[weak self] result in
self?.collectionView.isHidden = false
self?.collectionView.reloadData()
- if CCBleManager.shared.isConnetd{
+ if CCBleManager.shared.isConneted{
return
}
var autoConnetced = false
updateState()
}
func updateState(){
- self.findView.alpha = CCBleManager.shared.isConnetd ? 1:0.5
+ self.findView.alpha = CCBleManager.shared.isConneted ? 1:0.5
self.navBar.title = CCBleManager.shared.connectPeripheral?.device.name ?? ""
- headerView.connetedView.isHidden = !CCBleManager.shared.isConnetd
+ headerView.connetedView.isHidden = !CCBleManager.shared.isConneted
}
func selectedModeAction(_ mode:ModeEffectsType){
- if !CCBleManager.shared.isConnetd {
+ if !CCBleManager.shared.isConneted {
return
}
CCDevice.setEQMode(mode)
}
}
@objc func findAction(){
- if CCBleManager.shared.isConnetd {
+ if CCBleManager.shared.isConneted {
if CCConfig.appType == .deepchords{
App.shared.goToPage(FindVC())
}
DeviceCache.saveLastConnected(mac: device.mac)
DeviceCache.shared.add(CCBleManager.shared.connectPeripheral!.device.identifier.uuidString, mac: CCBleManager.shared.connectPeripheral!.mac)
- CCBleManager.shared.isConnetd = true
+ CCBleManager.shared.isConneted = true
CCBleManager.shared.didConnectDeviceCallback?(CCBleManager.shared.connectPeripheral!)
NotificationManager.post(type: .deviceValidChange, objtect: nil)
DeviceVM.updateOtaVersion()
}
func translateAction(){
translateView.content = ""
- if !CCBleManager.shared.isConnetd{
+ if !CCBleManager.shared.isConneted{
YLprogressHUD.showAutoHiden("蓝牙已断开".l10n)
return
}
}
func summaryAction(){
summaryView.content = ""
- if !CCBleManager.shared.isConnetd{
+ if !CCBleManager.shared.isConneted{
YLprogressHUD.showAutoHiden("蓝牙已断开".l10n)
return
}
// Created by liangshi on 2025/10/20.
//
+class DCPeripheral{
+ var device:CBPeripheral!
+ var mac = ""
+ init(device: CBPeripheral!, mac: String = "") {
+ self.device = device
+ self.mac = mac
+ }
+}
+
class DeviceVM:BaseVM{
static let shared = DeviceVM()
var dataList = [HomeDeviceModel]()
let api = CommomApi.otaUpdateVersion(param:params )
HttpClient.request(api) { (model:ResponseBaseModel,res) in
}
- settingsConnected()
+// settingsConnected()
}
}
}
- static func settingsConnected(){
- let list = CCBleManager.shared.checkSettingsConnected()
- if list.count == 0{
- CustomAlert.showWith(title: "提示", messgage: "请前往系统设置连接蓝牙") {
-
- } okCallback: {
- if let url = URL(string: "prefs:root=Bluetooth") {
- // 检查URL是否可用,然后跳转
- if UIApplication.shared.canOpenURL(url) {
- UIApplication.shared.open(url) { (success) in
- // 提示用户是否成功打开了设置
- if success {
- Logger.debug("成功跳转到蓝牙设置")
- } else {
- Logger.debug("跳转到设置失败")
- }
- }
- } else {
- Logger.debug("链接不可用")
- }
- }
- }
- }
- }
+// static func settingsConnected(){
+// let list = CCBleManager.shared.checkSettingsConnected()
+// if list.count == 0{
+// CustomAlert.showWith(title: "提示", messgage: "请前往系统设置连接蓝牙") {
+//
+// } okCallback: {
+// if let url = URL(string: "prefs:root=Bluetooth") {
+// // 检查URL是否可用,然后跳转
+// if UIApplication.shared.canOpenURL(url) {
+// UIApplication.shared.open(url) { (success) in
+// // 提示用户是否成功打开了设置
+// if success {
+// Logger.debug("成功跳转到蓝牙设置")
+// } else {
+// Logger.debug("跳转到设置失败")
+// }
+// }
+// } else {
+// Logger.debug("链接不可用")
+// }
+// }
+// }
+// }
+// }
}
+
+
}
}
@objc func tapAction(){
- if !CCBleManager.shared.isConnetd{
+ if !CCBleManager.shared.isConneted{
YLprogressHUD.showAutoHiden("请先连接设备".l10n)
return
}
}
@objc func tapAction(_ tap:UITapGestureRecognizer){
- if !CCBleManager.shared.isConnetd {
+ if !CCBleManager.shared.isConneted {
return
}
let view = tap.view as! ItemView
updateState()
}
@objc func startBtnAction(){
- if !CCBleManager.shared.isConnetd {
+ if !CCBleManager.shared.isConneted {
return
}
startBtn.isHidden = true
updateState()
}
func updateState(){
- self.alpha = CCBleManager.shared.isConnetd ? 1:0.3
+ self.alpha = CCBleManager.shared.isConneted ? 1:0.3
}
}
+++ /dev/null
-我项目中接入StarburstSdk.framework,在oc_StarburstSdk和code两个不同的项目中,代码一样的,但是调用StarburstSdk.framework接口消耗的资源差别很大。code的消耗cpu长期保持在5%左右,而oc_StarburstSdk消耗cpu长期保持在75%以上。两个项目的代码是一样的。我猜测是项目buildSetting的哪些配置不一样引起的,你帮我对比分析看是哪个设置可能影响到
-
-code项目中有个StarburstSdk的target,该target生成StarburstSdk.framework,在code项目中运行的时候,消耗的cpu稳定在5%左右,但是将生成的framework嵌入到oc_StarburstSdk项目后,oc_StarburstSdk项目运行消耗的cpu稳定在75%,帮我分析code中的StarburstSdk的settings如何设置才能让生成的framework在其他项目中高效运行
-
-http://vjs.zencdn.net/v/oceans.mp4
\ No newline at end of file