diff --git a/HDFwear/20240126ReadMe.md b/HDFwear/20240126ReadMe.md index db983b0..40ca701 100644 --- a/HDFwear/20240126ReadMe.md +++ b/HDFwear/20240126ReadMe.md @@ -4,6 +4,16 @@ BluetoothManager+Function 发送数据类 - +拉取睡眠数据 + 当前 + 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 2, 6, 1, 140, 110] + 接收: [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] + 接收: [237, 126, 0, 1, 128, 25, 0, 1, 0, 1, 255, 79, 201] + + 历史 + 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 2, 6, 2, 188, 13] + 接收: [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] + 接收: [237, 126, 0, 1, 128, 25, 0, 2, 0, 1, 255, 212, 21] + 接受数据类 diff --git a/HDFwear/Home/HomeViewController.swift b/HDFwear/Home/HomeViewController.swift index 1f69acd..83b0c58 100644 --- a/HDFwear/Home/HomeViewController.swift +++ b/HDFwear/Home/HomeViewController.swift @@ -768,7 +768,7 @@ extension HomeViewController: XMLParserDelegate { func syncSleep(_ day: SyncDay) { print("\(queryArray)---同步睡眠---\(day)") if queryArray.contains("Sleep"), let index = queryArray.firstIndex(of: "Sleep") { - BluetoothManager.shared.getSleepHistoryData() {[weak self] sleepArray, error in + BluetoothManager.shared.getSleepData() {[weak self] sleepArray, error in self?.queryArray.remove(at: index) // if error == nil { // SleepModel.addArray(sleepArray) diff --git a/HDFwear/Mine/MineViewController.swift b/HDFwear/Mine/MineViewController.swift index d2ce559..2bbaed9 100644 --- a/HDFwear/Mine/MineViewController.swift +++ b/HDFwear/Mine/MineViewController.swift @@ -443,13 +443,23 @@ extension MineViewController: UITableViewDataSource, UITableViewDelegate { func fetchDataAlert () { let alert = UIAlertController(title: "plz select fetch type", message: nil, preferredStyle: .actionSheet) - let archiveAction9 = UIAlertAction(title: "getSleepHistoryData", style: .default) {[weak self] action in - BluetoothManager.shared.getSleepHistoryData(option: .now) { sleepModel, error in + let archiveAction9a = UIAlertAction(title: "getSleepData now", style: .default) {[weak self] action in + BluetoothManager.shared.getSleepData(option: .now) { sleepModel, error in if error != nil { - print("getSleepHistoryData" + (error?.description ?? "")) + print("getSleepData" + (error?.description ?? "")) }else { self?.showDetailAlert(msg: sleepModel?.description) - print("getSleepHistoryData success") + print("getSleepData success") + } + } + } + let archiveAction9b = UIAlertAction(title: "getSleepData history", style: .default) {[weak self] action in + BluetoothManager.shared.getSleepData(option: .history) { sleepModel, error in + if error != nil { + print("getSleepData" + (error?.description ?? "")) + }else { + self?.showDetailAlert(msg: sleepModel?.description) + print("getSleepData success") } } } @@ -530,7 +540,8 @@ extension MineViewController: UITableViewDataSource, UITableViewDelegate { } - alert.addAction(archiveAction9) + alert.addAction(archiveAction9a) + alert.addAction(archiveAction9b) alert.addAction(archiveAction10) alert.addAction(archiveAction14) alert.addAction(archiveAction15) diff --git a/HDFwear/ReadMe.txt b/HDFwear/ReadMe.txt index 9657bf9..3166061 100644 --- a/HDFwear/ReadMe.txt +++ b/HDFwear/ReadMe.txt @@ -39,10 +39,6 @@ BluetoothManager+Function func newSetNotDisturb(remind: RemindModel, weekflag:[WeekFlag], isRepeat:Bool, completion: @escaping(_ error: Int?) -> ()) 发送: [237, 126, 0, 1, 0, 39, 0, 1, 0, 7, 0, 1, 33, 22, 0, 22, 0, 159, 5] -19. 拉取睡眠数据 - func getSleepHistoryData(closure: SleepClosure? = nil) - 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 6, 240, 42] - 20. 拉取血氧数据 func getBloodOxygenHistoryData(closure: BloodOxygenClosure? = nil) 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 2, 176, 174] diff --git a/HDFwear/Tools/BluetoothManager+Function.swift b/HDFwear/Tools/BluetoothManager+Function.swift index 6b47f84..9787c01 100644 --- a/HDFwear/Tools/BluetoothManager+Function.swift +++ b/HDFwear/Tools/BluetoothManager+Function.swift @@ -240,7 +240,7 @@ extension BluetoothManager { //MARK: - old code // 拉取睡眠数据 - func getSleepHistoryData(option: SyncOption = .now, closure: SleepClosure? = nil) { + func getSleepData(option: SyncOption = .now, closure: SleepClosure? = nil) { let data = BleMessage.shared.getSyncCmd(.sleep, option) newStartSyncHealthData(closure: closure, data: data, synType: .sleep) }