From 357b7f273b28ca2a9c93d4ea84d271af862fe78e Mon Sep 17 00:00:00 2001 From: daifengyi Date: Fri, 30 Jun 2023 15:25:11 +0800 Subject: [PATCH] feat:find phone --- HDFwear/Tools/BluetoothManager+Function.swift | 4 ++++ HDFwear/Tools/BluetoothManager.swift | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/HDFwear/Tools/BluetoothManager+Function.swift b/HDFwear/Tools/BluetoothManager+Function.swift index fe8a9b9..046530a 100644 --- a/HDFwear/Tools/BluetoothManager+Function.swift +++ b/HDFwear/Tools/BluetoothManager+Function.swift @@ -303,6 +303,10 @@ extension BluetoothManager { print("电话挂断") case 0x8015:// 找手机 print("找手机") + let ring = Int(bytes[10]) + for delegate in syncDelegateList { + delegate.didReceiveFindPhoneCommand(value: ring) + } case 0x8016:// 历史心率数据上报 print("历史心率数据上报") case 0x8017:// 历史血氧数据上报 diff --git a/HDFwear/Tools/BluetoothManager.swift b/HDFwear/Tools/BluetoothManager.swift index 226340a..e4126d3 100644 --- a/HDFwear/Tools/BluetoothManager.swift +++ b/HDFwear/Tools/BluetoothManager.swift @@ -29,7 +29,6 @@ protocol BluetoothManagerDelegate: NSObjectProtocol { protocol BluetoothSyncDelegate { func didReceiveFindCommand(status: Bool) func didReceiveCameraCommand(status: SetCmd) - func didReceiveFindPhoneCommand() func didReceiveHeartRate(value: Int) func didReceiveBloodOxygen() func didReceiveBloodPressure() @@ -39,11 +38,11 @@ protocol BluetoothSyncDelegate { func syncBug() // adapted func didReceiveBattery(value: Int) + func didReceiveFindPhoneCommand(value: Int) } extension BluetoothSyncDelegate { func didReceiveFindCommand(status: Bool) { } func didReceiveCameraCommand(status: SetCmd) { } - func didReceiveFindPhoneCommand() { } func didReceiveHeartRate(value: Int) { } func didReceiveBloodOxygen() { } func didReceiveBloodPressure() { } @@ -53,6 +52,7 @@ extension BluetoothSyncDelegate { func syncBug() {} // adapted func didReceiveBattery(value: Int) { } + func didReceiveFindPhoneCommand(value: Int) { } } @@ -1139,7 +1139,7 @@ class BluetoothManager: NSObject { AudioServicesDisposeSystemSoundID(kSystemSoundID_Vibrate) case .find_device: for delegate in syncDelegateList { - delegate.didReceiveFindPhoneCommand() + delegate.didReceiveFindPhoneCommand(value: 1) } case .sync: print("同步") -- libgit2 0.21.4