Commit a9f41925e00b7b8328079c08d4c179e7582ab9c1
1 parent
03cac185
feat:blood oxygen low remind
Showing
5 changed files
with
34 additions
and
2 deletions
HDFwear/20240110ReadMe.md
... | ... | @@ -70,3 +70,8 @@ BluetoothManager+Function |
70 | 70 | func newSetHeartRateDetectInterval(bool: Bool, interval: UInt8, completion: @escaping(_ error: Int?) -> ()) |
71 | 71 | 发送: [237, 126, 0, 1, 0, 50, 0, 1, 0, 2, 1, 18, 243, 158] |
72 | 72 | 接收: [237, 126, 0, 1, 128, 1, 0, 1, 0, 5, 0, 1, 0, 50, 0, 149, 132] |
73 | + | |
74 | +设置血氧过低提醒 | |
75 | + func newSetBloodOxygenLowRemind(minBo: UInt8, completion: ((_ error: Int?) -> ())? = nil) | |
76 | + 发送: [237, 126, 0, 1, 0, 52, 0, 1, 0, 1, 80, 219, 126] | |
77 | + 接收: [237, 126, 0, 1, 128, 1, 0, 1, 0, 5, 0, 1, 0, 52, 0, 63, 34] | ... | ... |
HDFwear/Mine/MineViewController.swift
... | ... | @@ -442,6 +442,18 @@ extension MineViewController: UITableViewDataSource, UITableViewDelegate { |
442 | 442 | } |
443 | 443 | } |
444 | 444 | |
445 | + let archiveAction26 = UIAlertAction(title: "newSetBloodOxygenLowRemind", style: .default) { action in | |
446 | + BluetoothManager.shared.newSetBloodOxygenLowRemind(minBo: 80) { error in | |
447 | + if error != nil { | |
448 | + print("newSetBloodOxygenLowRemind" + (error?.description ?? "")) | |
449 | + }else { | |
450 | + print("newSetBloodOxygenLowRemind success") | |
451 | + } | |
452 | + } | |
453 | + } | |
454 | + | |
455 | + | |
456 | + | |
445 | 457 | alert.addAction(archiveAction1) |
446 | 458 | alert.addAction(archiveAction2) |
447 | 459 | alert.addAction(archiveAction3) |
... | ... | @@ -467,6 +479,7 @@ extension MineViewController: UITableViewDataSource, UITableViewDelegate { |
467 | 479 | alert.addAction(archiveAction23) |
468 | 480 | alert.addAction(archiveAction24) |
469 | 481 | alert.addAction(archiveAction25) |
482 | + alert.addAction(archiveAction26) | |
470 | 483 | |
471 | 484 | alert.addAction(UIAlertAction(title: "取消", style: .destructive, handler: nil)) |
472 | 485 | present(alert, animated: true, completion: nil) | ... | ... |
HDFwear/Tools/BleMessage+Function.swift
... | ... | @@ -103,7 +103,7 @@ extension BleMessage { |
103 | 103 | |
104 | 104 | func getBloodOxygenAutoDetectCmd(_ bool: Bool) -> Data { |
105 | 105 | let bytes: [UInt8] = bool ? [0x01] : [0x00] |
106 | - return createDataPacket(key: .setbloodOxygenAutoDetect, bytes: bytes) | |
106 | + return createDataPacket(key: .setBloodOxygenAutoDetect, bytes: bytes) | |
107 | 107 | } |
108 | 108 | |
109 | 109 | func getUserInfoCmd(_ user: UserInfoModel) -> Data { |
... | ... | @@ -217,4 +217,9 @@ extension BleMessage { |
217 | 217 | let bytes: [UInt8] = [(bool ? 0x01 : 0x00), interval] |
218 | 218 | return createDataPacket(key: .setHeartRateDetectInterval, bytes: bytes) |
219 | 219 | } |
220 | + | |
221 | + func getBloodOxygenLowRemindCmd(_ minHr: UInt8) -> Data { | |
222 | + let bytes: [UInt8] = [minHr] | |
223 | + return createDataPacket(key: .setBloodOxygenLowRemind, bytes: bytes) | |
224 | + } | |
220 | 225 | } | ... | ... |
HDFwear/Tools/Bluetooth+Types.swift
... | ... | @@ -136,7 +136,7 @@ enum NewCmd: UInt8 { |
136 | 136 | // case setPhoneCall = 0x0022 |
137 | 137 | // 0x0023 |
138 | 138 | case setPressureAutoDetect = 0x0024 |
139 | - case setbloodOxygenAutoDetect = 0x0025 | |
139 | + case setBloodOxygenAutoDetect = 0x0025 | |
140 | 140 | case setUserInfo = 0x0026 |
141 | 141 | case setNoDisturb = 0x0027 |
142 | 142 | case setSynWatch = 0x0028 |
... | ... | @@ -144,6 +144,7 @@ enum NewCmd: UInt8 { |
144 | 144 | case setBeiDouQuickAnswer = 0x0030 |
145 | 145 | case setWeather = 0x0031 |
146 | 146 | case setHeartRateDetectInterval = 0x0032 |
147 | + case setBloodOxygenLowRemind = 0x0034 | |
147 | 148 | |
148 | 149 | |
149 | 150 | } | ... | ... |
HDFwear/Tools/BluetoothManager+Function.swift
... | ... | @@ -209,6 +209,14 @@ extension BluetoothManager { |
209 | 209 | sendData(data) |
210 | 210 | } |
211 | 211 | |
212 | + // 设置血氧过低提醒 | |
213 | + // minBo 0表示关闭提醒 其他值表示最小值 | |
214 | + func newSetBloodOxygenLowRemind(minBo: UInt8, completion: ((_ error: Int?) -> ())? = nil) { | |
215 | + let data = BleMessage.shared.getBloodOxygenLowRemindCmd(minBo) | |
216 | + self.setCmdClosure = completion | |
217 | + sendData(data) | |
218 | + } | |
219 | + | |
212 | 220 | //MARK: - 同步健康数据 |
213 | 221 | // 拉取睡眠数据 |
214 | 222 | func getSleepHistoryData( closure: SleepClosure? = nil) { | ... | ... |