Commit 737bea7235cf15755552a2e6e975a43bd9ea1b8b

Authored by jason
1 parent 96f707f2

feat:blood oxygen now & history data

HDFwear/20231111ReadMe.md
... ... @@ -24,7 +24,7 @@ BluetoothManager+Function
24 24 接收: [237, 126, 0, 1, 128, 22, 0, 1, 0, 5, 101, 73, 152, 158, 60, 178, 104]
25 25  
26 26 拉取血氧数据
27   - func getBloodOxygenHistoryData(closure: BloodOxygenClosure? = nil)
  27 + func getBloodOxygenData(closure: BloodOxygenClosure? = nil)
28 28 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 2, 176, 174]
29 29  
30 30 接收血氧数据
... ...
HDFwear/20240126ReadMe.md
... ... @@ -5,15 +5,26 @@ BluetoothManager+Function
5 5  
6 6 发送数据类
7 7 拉取睡眠数据
  8 + func getSleepData(option: SyncOption = .now, closure: SleepClosure? = nil)
8 9 当前
9 10 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 2, 6, 1, 140, 110]
10 11 接收: [237, 126, 0, 1, 128, 25, 0, 1, 0, 77, 3, 7, 9, 101, 158, 181, 160, 0, 0, 14, 16, 10, 101, 158, 195, 176, 0, 0, 14, 16, 8, 101, 158, 209, 192, 0, 0, 14, 16, 7, 101, 158, 223, 208, 0, 0, 14, 16, 9, 101, 158, 237, 224, 0, 0, 14, 16, 10, 101, 158, 251, 240, 0, 0, 14, 16, 9, 101, 159, 10, 0, 0, 0, 14, 16, 101, 159, 94, 96, 101, 159, 108, 112, 0, 0, 14, 16, 249, 253]
11 12 接收: [237, 126, 0, 1, 128, 25, 0, 1, 0, 1, 255, 79, 201]
12   -
13 13 历史
14 14 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 2, 6, 2, 188, 13]
15 15 接收: [237, 126, 0, 1, 128, 25, 0, 2, 0, 77, 3, 7, 9, 101, 158, 181, 160, 0, 0, 14, 16, 10, 101, 158, 195, 176, 0, 0, 14, 16, 8, 101, 158, 209, 192, 0, 0, 14, 16, 7, 101, 158, 223, 208, 0, 0, 14, 16, 9, 101, 158, 237, 224, 0, 0, 14, 16, 10, 101, 158, 251, 240, 0, 0, 14, 16, 9, 101, 159, 10, 0, 0, 0, 14, 16, 101, 159, 94, 96, 101, 159, 108, 112, 0, 0, 14, 16, 24, 164]
16 16 接收: [237, 126, 0, 1, 128, 25, 0, 2, 0, 1, 255, 212, 21]
17   -
18 17  
  18 +拉取血氧数据
  19 + func getBloodOxygenData(option: SyncOption = .now, closure: BloodOxygenClosure? = nil)
  20 + 当前
  21 + 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 2, 2, 1, 64, 170]
  22 + 接收: [237, 126, 0, 1, 128, 23, 0, 1, 0, 25, 101, 157, 250, 32, 98, 101, 158, 1, 40, 99, 101, 158, 8, 48, 98, 101, 158, 15, 56, 99, 101, 158, 22, 64, 100, 142, 226]
  23 + 接收: [237, 126, 0, 1, 128, 23, 0, 1, 0, 1, 255, 207, 106]
  24 + 历史
  25 + 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 2, 2, 2, 112, 201]
  26 + 接收: [237, 126, 0, 1, 128, 23, 0, 2, 0, 25, 101, 156, 126, 112, 98, 101, 156, 133, 120, 99, 101, 156, 140, 128, 98, 101, 156, 147, 136, 99, 101, 156, 154, 144, 100, 144, 4]
  27 + 接收: [237, 126, 0, 1, 128, 23, 0, 2, 0, 1, 255, 84, 182]
  28 +
  29 +
19 30 接受数据类
... ...
HDFwear/Home/HomeViewController.swift
... ... @@ -736,7 +736,7 @@ extension HomeViewController: XMLParserDelegate {
736 736 func syncBloodOxygen(_ day: SyncDay) {
737 737 print("\(queryArray)---同步血氧---\(day)")
738 738 if queryArray.contains("BloodOxygen"), let index = queryArray.firstIndex(of: "BloodOxygen") {
739   - BluetoothManager.shared.getBloodOxygenHistoryData() {[weak self] boArray, error in
  739 + BluetoothManager.shared.getBloodOxygenData() {[weak self] boArray, error in
740 740 self?.queryArray.remove(at: index)
741 741 if error == nil {
742 742 BloodOxygenModel.addArray(boArray)
... ...
HDFwear/Mine/MineViewController.swift
... ... @@ -463,16 +463,27 @@ extension MineViewController: UITableViewDataSource, UITableViewDelegate {
463 463 }
464 464 }
465 465 }
466   - let archiveAction10 = UIAlertAction(title: "getBloodOxygenHistoryData", style: .default) {[weak self] action in
467   - BluetoothManager.shared.getBloodOxygenHistoryData() { boArray, error in
  466 + let archiveAction10a = UIAlertAction(title: "getBloodOxygenData now", style: .default) {[weak self] action in
  467 + BluetoothManager.shared.getBloodOxygenData(option: .now) { boArray, error in
468 468 if error != nil {
469   - print("getBloodOxygenHistoryData" + (error?.description ?? ""))
  469 + print("getBloodOxygenData" + (error?.description ?? ""))
470 470 }else {
471 471 self?.showDetailAlert(msg: boArray.description)
472   - print("getBloodOxygenHistoryData success")
  472 + print("getBloodOxygenData success")
473 473 }
474 474 }
475 475 }
  476 + let archiveAction10b = UIAlertAction(title: "getBloodOxygenData history", style: .default) {[weak self] action in
  477 + BluetoothManager.shared.getBloodOxygenData(option: .history) { boArray, error in
  478 + if error != nil {
  479 + print("getBloodOxygenData" + (error?.description ?? ""))
  480 + }else {
  481 + self?.showDetailAlert(msg: boArray.description)
  482 + print("getBloodOxygenData success")
  483 + }
  484 + }
  485 + }
  486 +
476 487  
477 488 let archiveAction14 = UIAlertAction(title: "getHeartRateHistoryData", style: .default) {[weak self] action in
478 489 BluetoothManager.shared.getHeartRateHistoryData() { hrArray, error in
... ... @@ -542,7 +553,8 @@ extension MineViewController: UITableViewDataSource, UITableViewDelegate {
542 553  
543 554 alert.addAction(archiveAction9a)
544 555 alert.addAction(archiveAction9b)
545   - alert.addAction(archiveAction10)
  556 + alert.addAction(archiveAction10a)
  557 + alert.addAction(archiveAction10b)
546 558 alert.addAction(archiveAction14)
547 559 alert.addAction(archiveAction15)
548 560 alert.addAction(archiveAction16)
... ...
HDFwear/ReadMe.txt
... ... @@ -39,10 +39,6 @@ BluetoothManager+Function
39 39 func newSetNotDisturb(remind: RemindModel, weekflag:[WeekFlag], isRepeat:Bool, completion: @escaping(_ error: Int?) -> ())
40 40 发送: [237, 126, 0, 1, 0, 39, 0, 1, 0, 7, 0, 1, 33, 22, 0, 22, 0, 159, 5]
41 41  
42   -20. 拉取血氧数据
43   - func getBloodOxygenHistoryData(closure: BloodOxygenClosure? = nil)
44   - 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 2, 176, 174]
45   -
46 42 21. 拉取心跳数据
47 43 func getHeartRateHistoryData(closure: HeartRateClosure? = nil)
48 44 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 1, 128, 205]
... ...
HDFwear/Tools/BluetoothManager+Function.swift
... ... @@ -246,7 +246,7 @@ extension BluetoothManager {
246 246 }
247 247  
248 248 // 拉取血氧数据
249   - func getBloodOxygenHistoryData(option: SyncOption = .now, closure: BloodOxygenClosure? = nil) {
  249 + func getBloodOxygenData(option: SyncOption = .now, closure: BloodOxygenClosure? = nil) {
250 250 let data = BleMessage.shared.getSyncCmd(.bloodOxygen, option)
251 251 newStartSyncHealthData(closure: closure, data: data, synType: .bloodOxygen)
252 252 }
... ... @@ -468,8 +468,8 @@ extension BluetoothManager {
468 468 }else {
469 469 parseHeartRateData(content)
470 470 }
471   - case 0x8017:// 历史血氧数据上报
472   - print("历史血氧数据上报")
  471 + case 0x8017:// 血氧数据上报
  472 + print("血氧数据上报")
473 473 let content = parseContentFromBytes(bytes)
474 474 if (content.count == 1 && content.first == 0xff) {
475 475 for delegate in syncDelegateList {
... ...