Commit 357b7f273b28ca2a9c93d4ea84d271af862fe78e

Authored by daifengyi
1 parent d1f02dfe

feat:find phone

HDFwear/Tools/BluetoothManager+Function.swift
@@ -303,6 +303,10 @@ extension BluetoothManager { @@ -303,6 +303,10 @@ extension BluetoothManager {
303 print("电话挂断") 303 print("电话挂断")
304 case 0x8015:// 找手机 304 case 0x8015:// 找手机
305 print("找手机") 305 print("找手机")
  306 + let ring = Int(bytes[10])
  307 + for delegate in syncDelegateList {
  308 + delegate.didReceiveFindPhoneCommand(value: ring)
  309 + }
306 case 0x8016:// 历史心率数据上报 310 case 0x8016:// 历史心率数据上报
307 print("历史心率数据上报") 311 print("历史心率数据上报")
308 case 0x8017:// 历史血氧数据上报 312 case 0x8017:// 历史血氧数据上报
HDFwear/Tools/BluetoothManager.swift
@@ -29,7 +29,6 @@ protocol BluetoothManagerDelegate: NSObjectProtocol { @@ -29,7 +29,6 @@ protocol BluetoothManagerDelegate: NSObjectProtocol {
29 protocol BluetoothSyncDelegate { 29 protocol BluetoothSyncDelegate {
30 func didReceiveFindCommand(status: Bool) 30 func didReceiveFindCommand(status: Bool)
31 func didReceiveCameraCommand(status: SetCmd) 31 func didReceiveCameraCommand(status: SetCmd)
32 - func didReceiveFindPhoneCommand()  
33 func didReceiveHeartRate(value: Int) 32 func didReceiveHeartRate(value: Int)
34 func didReceiveBloodOxygen() 33 func didReceiveBloodOxygen()
35 func didReceiveBloodPressure() 34 func didReceiveBloodPressure()
@@ -39,11 +38,11 @@ protocol BluetoothSyncDelegate { @@ -39,11 +38,11 @@ protocol BluetoothSyncDelegate {
39 func syncBug() 38 func syncBug()
40 // adapted 39 // adapted
41 func didReceiveBattery(value: Int) 40 func didReceiveBattery(value: Int)
  41 + func didReceiveFindPhoneCommand(value: Int)
42 } 42 }
43 extension BluetoothSyncDelegate { 43 extension BluetoothSyncDelegate {
44 func didReceiveFindCommand(status: Bool) { } 44 func didReceiveFindCommand(status: Bool) { }
45 func didReceiveCameraCommand(status: SetCmd) { } 45 func didReceiveCameraCommand(status: SetCmd) { }
46 - func didReceiveFindPhoneCommand() { }  
47 func didReceiveHeartRate(value: Int) { } 46 func didReceiveHeartRate(value: Int) { }
48 func didReceiveBloodOxygen() { } 47 func didReceiveBloodOxygen() { }
49 func didReceiveBloodPressure() { } 48 func didReceiveBloodPressure() { }
@@ -53,6 +52,7 @@ extension BluetoothSyncDelegate { @@ -53,6 +52,7 @@ extension BluetoothSyncDelegate {
53 func syncBug() {} 52 func syncBug() {}
54 // adapted 53 // adapted
55 func didReceiveBattery(value: Int) { } 54 func didReceiveBattery(value: Int) { }
  55 + func didReceiveFindPhoneCommand(value: Int) { }
56 } 56 }
57 57
58 58
@@ -1139,7 +1139,7 @@ class BluetoothManager: NSObject { @@ -1139,7 +1139,7 @@ class BluetoothManager: NSObject {
1139 AudioServicesDisposeSystemSoundID(kSystemSoundID_Vibrate) 1139 AudioServicesDisposeSystemSoundID(kSystemSoundID_Vibrate)
1140 case .find_device: 1140 case .find_device:
1141 for delegate in syncDelegateList { 1141 for delegate in syncDelegateList {
1142 - delegate.didReceiveFindPhoneCommand() 1142 + delegate.didReceiveFindPhoneCommand(value: 1)
1143 } 1143 }
1144 case .sync: 1144 case .sync:
1145 print("同步") 1145 print("同步")