Commit da3600927aaec9da4c7898cf456912a77e491952
1 parent
fc9dfaed
feat:mac in didConnect
Showing
3 changed files
with
4 additions
and
4 deletions
HDFwear/Home/HomeViewController.swift
... | ... | @@ -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 | 499 | if GCDTimer.shared.isExistTimer(WithTimerName: "Reconnect") { |
500 | 500 | GCDTimer.shared.cancleTimer(WithTimerName: "Reconnect") |
501 | 501 | } | ... | ... |
HDFwear/Setting/SettingViewController.swift
... | ... | @@ -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 | 545 | print("已经连接") |
546 | 546 | switch CurDevice.platform { |
547 | 547 | default: | ... | ... |
HDFwear/Tools/BluetoothManager.swift
... | ... | @@ -16,7 +16,7 @@ import Alamofire |
16 | 16 | |
17 | 17 | protocol BluetoothManagerDelegate: NSObjectProtocol { |
18 | 18 | func didDiscover(devices: [ScanDevice]) |
19 | - func didConnect(_ peripheral: CBPeripheral) | |
19 | + func didConnect(_ peripheral: CBPeripheral, _ mac: String) | |
20 | 20 | func centralManagerDidUpdateState(_ state: Int) |
21 | 21 | func didDisconnected() |
22 | 22 | } |
... | ... | @@ -1408,7 +1408,7 @@ extension BluetoothManager: ClientProfileDelegate { |
1408 | 1408 | DeviceIsConnected = true |
1409 | 1409 | // MusicManager.shared.controlMusic() |
1410 | 1410 | for delegate in delegateList { |
1411 | - delegate.didConnect(peripheral) | |
1411 | + delegate.didConnect(peripheral, CurDevice.mac) | |
1412 | 1412 | } |
1413 | 1413 | |
1414 | 1414 | // GCDTimer.shared.scheduledDispatchTimerNotNow(WithTimerName: "FirstSync", timeInterval: 5+delayTime, queue: .main, repeats: false) { | ... | ... |