Commit b150ccd0aa5c792d275403f605c032a45715516b
1 parent
f13858d1
fix:fetch api param
Showing
5 changed files
with
31 additions
and
31 deletions
HDFwear/Home/HomeViewController.swift
... | ... | @@ -718,7 +718,7 @@ extension HomeViewController: XMLParserDelegate { |
718 | 718 | } |
719 | 719 | print("\(queryArray)---同步步数---\(day)") |
720 | 720 | if queryArray.contains("Step"), let index = queryArray.firstIndex(of: "Step") { |
721 | - BluetoothManager.shared.getStepHistoryData(day: day) {[weak self] stepArray, error in | |
721 | + BluetoothManager.shared.getStepHistoryData() {[weak self] stepArray, error in | |
722 | 722 | self?.queryArray.remove(at: index) |
723 | 723 | if error == nil { |
724 | 724 | |
... | ... | @@ -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(day: day) {[weak self] boArray, error in | |
739 | + BluetoothManager.shared.getBloodOxygenHistoryData() {[weak self] boArray, error in | |
740 | 740 | self?.queryArray.remove(at: index) |
741 | 741 | if error == nil { |
742 | 742 | BloodOxygenModel.addArray(boArray) |
... | ... | @@ -751,7 +751,7 @@ extension HomeViewController: XMLParserDelegate { |
751 | 751 | func syncBloodPressure(_ day: SyncDay) { |
752 | 752 | print("\(queryArray)---同步血压---\(day)") |
753 | 753 | if queryArray.contains("BloodPressure"), let index = queryArray.firstIndex(of: "BloodPressure") { |
754 | - BluetoothManager.shared.getBloodPressureHistoryData(day: day) {[weak self] bpArray, error in | |
754 | + BluetoothManager.shared.getBloodPressureHistoryData() {[weak self] bpArray, error in | |
755 | 755 | self?.queryArray.remove(at: index) |
756 | 756 | if error == nil { |
757 | 757 | BloodPressureModel.addArray(bpArray) |
... | ... | @@ -766,7 +766,7 @@ extension HomeViewController: XMLParserDelegate { |
766 | 766 | func syncHeartRate(_ day: SyncDay) { |
767 | 767 | print("\(queryArray)---同步心率---\(day)") |
768 | 768 | if queryArray.contains("HeartRate"), let index = queryArray.firstIndex(of: "HeartRate") { |
769 | - BluetoothManager.shared.getHeartRateHistoryData(day: day) {[weak self] hrArray, error in | |
769 | + BluetoothManager.shared.getHeartRateHistoryData() {[weak self] hrArray, error in | |
770 | 770 | self?.queryArray.remove(at: index) |
771 | 771 | if error == nil { |
772 | 772 | HeartRateModel.addArray(hrArray) |
... | ... | @@ -782,7 +782,7 @@ extension HomeViewController: XMLParserDelegate { |
782 | 782 | func syncSleep(_ day: SyncDay) { |
783 | 783 | print("\(queryArray)---同步睡眠---\(day)") |
784 | 784 | if queryArray.contains("Sleep"), let index = queryArray.firstIndex(of: "Sleep") { |
785 | - BluetoothManager.shared.getSleepHistoryData(day: day) {[weak self] sleepArray, error in | |
785 | + BluetoothManager.shared.getSleepHistoryData() {[weak self] sleepArray, error in | |
786 | 786 | self?.queryArray.remove(at: index) |
787 | 787 | if error == nil { |
788 | 788 | SleepModel.addArray(sleepArray) |
... | ... | @@ -797,7 +797,7 @@ extension HomeViewController: XMLParserDelegate { |
797 | 797 | func syncPressure(_ day: SyncDay) { |
798 | 798 | print("\(queryArray)---同步压力---\(day)") |
799 | 799 | if queryArray.contains("Pressure"), let index = queryArray.firstIndex(of: "Pressure") { |
800 | - BluetoothManager.shared.getPressureHistoryData(day: day) {[weak self] pressureArray, error in | |
800 | + BluetoothManager.shared.getPressureHistoryData() {[weak self] pressureArray, error in | |
801 | 801 | self?.queryArray.remove(at: index) |
802 | 802 | if error == nil { |
803 | 803 | PressureModel.addArray(pressureArray) |
... | ... | @@ -812,13 +812,13 @@ extension HomeViewController: XMLParserDelegate { |
812 | 812 | func syncTrain(_ day: SyncDay) { |
813 | 813 | print("\(queryArray)---同步训练---\(day)") |
814 | 814 | if queryArray.contains("Train"), let index = queryArray.firstIndex(of: "Train") { |
815 | - BluetoothManager.shared.getTrainHistoryData(day: day) {[weak self] train, error in | |
815 | + BluetoothManager.shared.getTrainHistoryData() {[weak self] train, error in | |
816 | 816 | if error == nil || error == 2000 || error == -1001 { |
817 | 817 | self?.queryArray.remove(at: index) |
818 | 818 | if day == .today { |
819 | 819 | self?.syncStep(.yesterday) |
820 | 820 | } else { |
821 | - self?.syncMett() | |
821 | + self?.getSettingData() | |
822 | 822 | |
823 | 823 | } |
824 | 824 | } |
... | ... | @@ -827,7 +827,7 @@ extension HomeViewController: XMLParserDelegate { |
827 | 827 | if day == .today { |
828 | 828 | syncStep(.yesterday) |
829 | 829 | } else { |
830 | - syncMett() | |
830 | + getSettingData() | |
831 | 831 | } |
832 | 832 | } |
833 | 833 | } |
... | ... | @@ -835,7 +835,7 @@ extension HomeViewController: XMLParserDelegate { |
835 | 835 | func syncMett() { |
836 | 836 | print("\(queryArray)---同步梅脱---") |
837 | 837 | if queryArray.contains("Mett"), let index = queryArray.firstIndex(of: "Mett") { |
838 | - BluetoothManager.shared.getMettHistoryData(day: .today) {[weak self] mettArray, error in | |
838 | + BluetoothManager.shared.getMettHistoryData() {[weak self] mettArray, error in | |
839 | 839 | self?.queryArray.remove(at: index) |
840 | 840 | if error == nil { |
841 | 841 | MettModel.addArray(mettArray) | ... | ... |
HDFwear/Home/TrainViewController.swift
... | ... | @@ -52,7 +52,7 @@ class TrainViewController: UIViewController, DateSegmentViewDelegate, RangeSlide |
52 | 52 | } |
53 | 53 | override func viewDidAppear(_ animated: Bool) { |
54 | 54 | super.viewDidAppear(animated) |
55 | - BluetoothManager.shared.getTrainHistoryData(day: .today) {[weak self] train, error in | |
55 | + BluetoothManager.shared.getTrainHistoryData() {[weak self] train, error in | |
56 | 56 | if error == 2000 || error == nil { |
57 | 57 | self?.updateTodayData() |
58 | 58 | // self?.didSelectedDate(date: DateInRegion((self?.selectedDate)!, region: .current), dateType: .day) | ... | ... |
HDFwear/Mine/MineViewController.swift
... | ... | @@ -262,7 +262,7 @@ extension MineViewController: UITableViewDataSource, UITableViewDelegate { |
262 | 262 | } |
263 | 263 | } |
264 | 264 | let archiveAction9 = UIAlertAction(title: "getSleepHistoryData", style: .default) { action in |
265 | - BluetoothManager.shared.getSleepHistoryData(day: .today) { sleepArray, error in | |
265 | + BluetoothManager.shared.getSleepHistoryData() { sleepArray, error in | |
266 | 266 | if error != nil { |
267 | 267 | print("getSleepHistoryData" + (error?.description ?? "")) |
268 | 268 | }else { |
... | ... | @@ -272,7 +272,7 @@ extension MineViewController: UITableViewDataSource, UITableViewDelegate { |
272 | 272 | } |
273 | 273 | } |
274 | 274 | let archiveAction10 = UIAlertAction(title: "getBloodOxygenHistoryData", style: .default) { action in |
275 | - BluetoothManager.shared.getBloodOxygenHistoryData(day: .today) { boArray, error in | |
275 | + BluetoothManager.shared.getBloodOxygenHistoryData() { boArray, error in | |
276 | 276 | if error != nil { |
277 | 277 | print("getBloodOxygenHistoryData" + (error?.description ?? "")) |
278 | 278 | }else { |
... | ... | @@ -312,7 +312,7 @@ extension MineViewController: UITableViewDataSource, UITableViewDelegate { |
312 | 312 | } |
313 | 313 | |
314 | 314 | let archiveAction14 = UIAlertAction(title: "getHeartRateHistoryData", style: .default) { action in |
315 | - BluetoothManager.shared.getHeartRateHistoryData(day: .today) { boArray, error in | |
315 | + BluetoothManager.shared.getHeartRateHistoryData() { boArray, error in | |
316 | 316 | if error != nil { |
317 | 317 | print("getHeartRateHistoryData" + (error?.description ?? "")) |
318 | 318 | }else { |
... | ... | @@ -322,7 +322,7 @@ extension MineViewController: UITableViewDataSource, UITableViewDelegate { |
322 | 322 | } |
323 | 323 | |
324 | 324 | let archiveAction15 = UIAlertAction(title: "getStepHistoryData", style: .default) { action in |
325 | - BluetoothManager.shared.getStepHistoryData(day: .today) { boArray, error in | |
325 | + BluetoothManager.shared.getStepHistoryData() { boArray, error in | |
326 | 326 | if error != nil { |
327 | 327 | print("getStepHistoryData" + (error?.description ?? "")) |
328 | 328 | }else { |
... | ... | @@ -332,7 +332,7 @@ extension MineViewController: UITableViewDataSource, UITableViewDelegate { |
332 | 332 | } |
333 | 333 | |
334 | 334 | let archiveAction16 = UIAlertAction(title: "getTrainHistoryData", style: .default) { action in |
335 | - BluetoothManager.shared.getTrainHistoryData(day: .today) { boArray, error in | |
335 | + BluetoothManager.shared.getTrainHistoryData() { boArray, error in | |
336 | 336 | if error != nil { |
337 | 337 | print("getTrainHistoryData" + (error?.description ?? "")) |
338 | 338 | }else { |
... | ... | @@ -342,7 +342,7 @@ extension MineViewController: UITableViewDataSource, UITableViewDelegate { |
342 | 342 | } |
343 | 343 | |
344 | 344 | let archiveAction17 = UIAlertAction(title: "getPressureHistoryData", style: .default) { action in |
345 | - BluetoothManager.shared.getPressureHistoryData(day: .today) { boArray, error in | |
345 | + BluetoothManager.shared.getPressureHistoryData() { boArray, error in | |
346 | 346 | if error != nil { |
347 | 347 | print("getPressureHistoryData" + (error?.description ?? "")) |
348 | 348 | }else { | ... | ... |
HDFwear/ReadMe renamed to HDFwear/ReadMe.txt
... | ... | @@ -86,27 +86,27 @@ BluetoothManager+Function |
86 | 86 | 发送: [237, 126, 0, 1, 0, 39, 0, 1, 0, 7, 0, 1, 33, 22, 0, 22, 0, 159, 5] |
87 | 87 | |
88 | 88 | 19. 拉取睡眠数据 |
89 | - func getSleepHistoryData(day: SyncDay = .today, closure: SleepClosure? = nil) | |
89 | + func getSleepHistoryData(closure: SleepClosure? = nil) | |
90 | 90 | 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 6, 240, 42] |
91 | 91 | |
92 | 92 | 20. 拉取血氧数据 |
93 | - func getBloodOxygenHistoryData(day: SyncDay = .today, closure: BloodOxygenClosure? = nil) | |
93 | + func getBloodOxygenHistoryData(closure: BloodOxygenClosure? = nil) | |
94 | 94 | 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 2, 176, 174] |
95 | 95 | |
96 | 96 | 21. 拉取心跳数据 |
97 | - func getHeartRateHistoryData(day: SyncDay = .today, closure: HeartRateClosure? = nil) | |
97 | + func getHeartRateHistoryData(closure: HeartRateClosure? = nil) | |
98 | 98 | 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 1, 128, 205] |
99 | 99 | |
100 | 100 | 22. 拉取计步数据 |
101 | - func getStepHistoryData(day: SyncDay = .today, closure: StepClosure? = nil) | |
101 | + func getStepHistoryData(closure: StepClosure? = nil) | |
102 | 102 | 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 3, 160, 143] |
103 | 103 | |
104 | 104 | 23. 拉取训练数据 |
105 | - func getTrainHistoryData(day: SyncDay = .today, closure: TrainClosure? = nil) | |
105 | + func getTrainHistoryData(closure: TrainClosure? = nil) | |
106 | 106 | 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 7, 224, 11] |
107 | 107 | |
108 | 108 | 24. 拉取压力数据 |
109 | - func getPressureHistoryData(day: SyncDay = .today, closure: PressureClosure? = nil) | |
109 | + func getPressureHistoryData(closure: PressureClosure? = nil) | |
110 | 110 | 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 5, 192, 73] |
111 | 111 | |
112 | 112 | 接受数据类 | ... | ... |
HDFwear/Tools/BluetoothManager+Function.swift
... | ... | @@ -149,47 +149,47 @@ extension BluetoothManager { |
149 | 149 | |
150 | 150 | //MARK: - 同步健康数据 |
151 | 151 | // 拉取睡眠数据 |
152 | - func getSleepHistoryData(day: SyncDay = .today, closure: SleepClosure? = nil) { | |
152 | + func getSleepHistoryData( closure: SleepClosure? = nil) { | |
153 | 153 | let data = BleMessage.shared.getSyncCmd(.sleep) |
154 | 154 | newStartSyncHealthData(closure: closure, data: data, synType: .sleep) |
155 | 155 | } |
156 | 156 | |
157 | - func getBloodPressureHistoryData(day: SyncDay = .today, closure: BloodPressureClosure? = nil) { | |
157 | + func getBloodPressureHistoryData( closure: BloodPressureClosure? = nil) { | |
158 | 158 | // let data = BleMessage.shared.getSyncCmd(.bloodOxygen) |
159 | 159 | // newStartSyncHealthData(closure: closure, data: data, synType: .pressure) |
160 | 160 | } |
161 | 161 | |
162 | 162 | // 拉取血氧数据 |
163 | - func getBloodOxygenHistoryData(day: SyncDay = .today, closure: BloodOxygenClosure? = nil) { | |
163 | + func getBloodOxygenHistoryData( closure: BloodOxygenClosure? = nil) { | |
164 | 164 | let data = BleMessage.shared.getSyncCmd(.bloodOxygen) |
165 | 165 | newStartSyncHealthData(closure: closure, data: data, synType: .bloodOxygen) |
166 | 166 | } |
167 | 167 | |
168 | 168 | // 拉取心跳数据 |
169 | - func getHeartRateHistoryData(day: SyncDay = .today, closure: HeartRateClosure? = nil) { | |
169 | + func getHeartRateHistoryData( closure: HeartRateClosure? = nil) { | |
170 | 170 | let data = BleMessage.shared.getSyncCmd(.heartRate) |
171 | 171 | newStartSyncHealthData(closure: closure, data: data, synType: .heartRate) |
172 | 172 | } |
173 | 173 | |
174 | 174 | // 拉取计步数据 |
175 | - func getStepHistoryData(day: SyncDay = .today, closure: StepClosure? = nil) { | |
175 | + func getStepHistoryData( closure: StepClosure? = nil) { | |
176 | 176 | let data = BleMessage.shared.getSyncCmd(.step) |
177 | 177 | newStartSyncHealthData(closure: closure, data: data, synType: .step) |
178 | 178 | } |
179 | 179 | |
180 | 180 | // 拉取训练数据 |
181 | - func getTrainHistoryData(day: SyncDay = .today, closure: TrainClosure? = nil) { | |
181 | + func getTrainHistoryData( closure: TrainClosure? = nil) { | |
182 | 182 | let data = BleMessage.shared.getSyncCmd(.train) |
183 | 183 | newStartSyncHealthData(closure: closure, data: data, synType: .train) |
184 | 184 | } |
185 | 185 | |
186 | 186 | // 拉取压力数据 |
187 | - func getPressureHistoryData(day: SyncDay = .today, closure: PressureClosure? = nil) { | |
187 | + func getPressureHistoryData( closure: PressureClosure? = nil) { | |
188 | 188 | let data = BleMessage.shared.getSyncCmd(.pressure) |
189 | 189 | newStartSyncHealthData(closure: closure, data: data, synType: .pressure) |
190 | 190 | } |
191 | 191 | |
192 | - func getMettHistoryData(day: SyncDay = .today, closure: MettClosure? = nil) { | |
192 | + func getMettHistoryData( closure: MettClosure? = nil) { | |
193 | 193 | // startSyncHealthData(closure: closure, data: BleMessage.shared.getSyncCmd(.mett, day: day), cmd: .mett) |
194 | 194 | } |
195 | 195 | ... | ... |