From da3600927aaec9da4c7898cf456912a77e491952 Mon Sep 17 00:00:00 2001 From: jason Date: Thu, 11 Jan 2024 11:39:03 +0800 Subject: [PATCH] feat:mac in didConnect --- HDFwear/Home/HomeViewController.swift | 2 +- HDFwear/Setting/SettingViewController.swift | 2 +- HDFwear/Tools/BluetoothManager.swift | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/HDFwear/Home/HomeViewController.swift b/HDFwear/Home/HomeViewController.swift index ea0186d..1f69acd 100644 --- a/HDFwear/Home/HomeViewController.swift +++ b/HDFwear/Home/HomeViewController.swift @@ -495,7 +495,7 @@ extension HomeViewController: BluetoothManagerDelegate { } } - func didConnect(_ peripheral: CBPeripheral) { + func didConnect(_ peripheral: CBPeripheral, _ mac: String) { if GCDTimer.shared.isExistTimer(WithTimerName: "Reconnect") { GCDTimer.shared.cancleTimer(WithTimerName: "Reconnect") } diff --git a/HDFwear/Setting/SettingViewController.swift b/HDFwear/Setting/SettingViewController.swift index 5472544..7a63d1b 100644 --- a/HDFwear/Setting/SettingViewController.swift +++ b/HDFwear/Setting/SettingViewController.swift @@ -541,7 +541,7 @@ extension SettingViewController: BluetoothManagerDelegate { } - func didConnect(_ peripheral: CBPeripheral) { + func didConnect(_ peripheral: CBPeripheral, _ mac: String) { print("已经连接") switch CurDevice.platform { default: diff --git a/HDFwear/Tools/BluetoothManager.swift b/HDFwear/Tools/BluetoothManager.swift index d739dc7..1ca6c86 100644 --- a/HDFwear/Tools/BluetoothManager.swift +++ b/HDFwear/Tools/BluetoothManager.swift @@ -16,7 +16,7 @@ import Alamofire protocol BluetoothManagerDelegate: NSObjectProtocol { func didDiscover(devices: [ScanDevice]) - func didConnect(_ peripheral: CBPeripheral) + func didConnect(_ peripheral: CBPeripheral, _ mac: String) func centralManagerDidUpdateState(_ state: Int) func didDisconnected() } @@ -1408,7 +1408,7 @@ extension BluetoothManager: ClientProfileDelegate { DeviceIsConnected = true // MusicManager.shared.controlMusic() for delegate in delegateList { - delegate.didConnect(peripheral) + delegate.didConnect(peripheral, CurDevice.mac) } // GCDTimer.shared.scheduledDispatchTimerNotNow(WithTimerName: "FirstSync", timeInterval: 5+delayTime, queue: .main, repeats: false) { -- libgit2 0.21.4