Commit da3600927aaec9da4c7898cf456912a77e491952

Authored by jason
1 parent fc9dfaed

feat:mac in didConnect

HDFwear/Home/HomeViewController.swift
@@ -495,7 +495,7 @@ extension HomeViewController: BluetoothManagerDelegate { @@ -495,7 +495,7 @@ extension HomeViewController: BluetoothManagerDelegate {
495 } 495 }
496 } 496 }
497 497
498 - func didConnect(_ peripheral: CBPeripheral) { 498 + func didConnect(_ peripheral: CBPeripheral, _ mac: String) {
499 if GCDTimer.shared.isExistTimer(WithTimerName: "Reconnect") { 499 if GCDTimer.shared.isExistTimer(WithTimerName: "Reconnect") {
500 GCDTimer.shared.cancleTimer(WithTimerName: "Reconnect") 500 GCDTimer.shared.cancleTimer(WithTimerName: "Reconnect")
501 } 501 }
HDFwear/Setting/SettingViewController.swift
@@ -541,7 +541,7 @@ extension SettingViewController: BluetoothManagerDelegate { @@ -541,7 +541,7 @@ extension SettingViewController: BluetoothManagerDelegate {
541 541
542 } 542 }
543 543
544 - func didConnect(_ peripheral: CBPeripheral) { 544 + func didConnect(_ peripheral: CBPeripheral, _ mac: String) {
545 print("已经连接") 545 print("已经连接")
546 switch CurDevice.platform { 546 switch CurDevice.platform {
547 default: 547 default:
HDFwear/Tools/BluetoothManager.swift
@@ -16,7 +16,7 @@ import Alamofire @@ -16,7 +16,7 @@ import Alamofire
16 16
17 protocol BluetoothManagerDelegate: NSObjectProtocol { 17 protocol BluetoothManagerDelegate: NSObjectProtocol {
18 func didDiscover(devices: [ScanDevice]) 18 func didDiscover(devices: [ScanDevice])
19 - func didConnect(_ peripheral: CBPeripheral) 19 + func didConnect(_ peripheral: CBPeripheral, _ mac: String)
20 func centralManagerDidUpdateState(_ state: Int) 20 func centralManagerDidUpdateState(_ state: Int)
21 func didDisconnected() 21 func didDisconnected()
22 } 22 }
@@ -1408,7 +1408,7 @@ extension BluetoothManager: ClientProfileDelegate { @@ -1408,7 +1408,7 @@ extension BluetoothManager: ClientProfileDelegate {
1408 DeviceIsConnected = true 1408 DeviceIsConnected = true
1409 // MusicManager.shared.controlMusic() 1409 // MusicManager.shared.controlMusic()
1410 for delegate in delegateList { 1410 for delegate in delegateList {
1411 - delegate.didConnect(peripheral) 1411 + delegate.didConnect(peripheral, CurDevice.mac)
1412 } 1412 }
1413 1413
1414 // GCDTimer.shared.scheduledDispatchTimerNotNow(WithTimerName: "FirstSync", timeInterval: 5+delayTime, queue: .main, repeats: false) { 1414 // GCDTimer.shared.scheduledDispatchTimerNotNow(WithTimerName: "FirstSync", timeInterval: 5+delayTime, queue: .main, repeats: false) {