From f13858d1c5e313a26aee0df0a59a81553e8c54da Mon Sep 17 00:00:00 2001 From: daifengyi Date: Sat, 1 Jul 2023 17:40:53 +0800 Subject: [PATCH] feat:read me --- HDFwear.xcodeproj/project.pbxproj | 2 ++ HDFwear/Mine/MineViewController.swift | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- HDFwear/ReadMe | 160 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ HDFwear/Tools/BluetoothManager+Function.swift | 20 +++++++++++++++++--- HDFwear/Tools/BluetoothManager.swift | 4 ++-- 5 files changed, 237 insertions(+), 6 deletions(-) create mode 100644 HDFwear/ReadMe diff --git a/HDFwear.xcodeproj/project.pbxproj b/HDFwear.xcodeproj/project.pbxproj index a0b5810..e6e11b3 100644 --- a/HDFwear.xcodeproj/project.pbxproj +++ b/HDFwear.xcodeproj/project.pbxproj @@ -670,6 +670,7 @@ B279A3792A4AC2F800A7C7B6 /* BluetoothManager+Function.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BluetoothManager+Function.swift"; sourceTree = ""; }; B279A37B2A4AC5B000A7C7B6 /* BleMessage+Function.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BleMessage+Function.swift"; sourceTree = ""; }; B2AF58812A14C4BE0080B464 /* LaunchMyInfoSettingVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchMyInfoSettingVC.swift; sourceTree = ""; }; + B2BA609A2A501E6C00374A86 /* ReadMe */ = {isa = PBXFileReference; lastKnownFileType = text; path = ReadMe; sourceTree = ""; }; C621CFD20D2BD60CF4F959C3 /* Pods-HDFwear.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HDFwear.release.xcconfig"; path = "Target Support Files/Pods-HDFwear/Pods-HDFwear.release.xcconfig"; sourceTree = ""; }; E7F3880C37BC5F6DD15C709D /* Pods-HDFwear.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HDFwear.debug.xcconfig"; path = "Target Support Files/Pods-HDFwear/Pods-HDFwear.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -1067,6 +1068,7 @@ 6C6F40302743450A00F9473C /* Assets.xcassets */, 6C6F402D2743450600F9473C /* Main.storyboard */, 6C6F40322743450A00F9473C /* LaunchScreen.storyboard */, + B2BA609A2A501E6C00374A86 /* ReadMe */, ); path = HDFwear; sourceTree = ""; diff --git a/HDFwear/Mine/MineViewController.swift b/HDFwear/Mine/MineViewController.swift index 2a0c025..d50770b 100644 --- a/HDFwear/Mine/MineViewController.swift +++ b/HDFwear/Mine/MineViewController.swift @@ -277,7 +277,6 @@ extension MineViewController: UITableViewDataSource, UITableViewDelegate { print("getBloodOxygenHistoryData" + (error?.description ?? "")) }else { print("getBloodOxygenHistoryData success") - BloodOxygenModel.addArray(boArray) } } } @@ -302,6 +301,57 @@ extension MineViewController: UITableViewDataSource, UITableViewDelegate { } } + let archiveAction13 = UIAlertAction(title: "newSetFindWatch", style: .default) { action in + BluetoothManager.shared.newSetFindWatch(bool: true) { error in + if error != nil { + print("newSetFindWatch" + (error?.description ?? "")) + }else { + print("newSetFindWatch success") + } + } + } + + let archiveAction14 = UIAlertAction(title: "getHeartRateHistoryData", style: .default) { action in + BluetoothManager.shared.getHeartRateHistoryData(day: .today) { boArray, error in + if error != nil { + print("getHeartRateHistoryData" + (error?.description ?? "")) + }else { + print("getHeartRateHistoryData success") + } + } + } + + let archiveAction15 = UIAlertAction(title: "getStepHistoryData", style: .default) { action in + BluetoothManager.shared.getStepHistoryData(day: .today) { boArray, error in + if error != nil { + print("getStepHistoryData" + (error?.description ?? "")) + }else { + print("getStepHistoryData success") + } + } + } + + let archiveAction16 = UIAlertAction(title: "getTrainHistoryData", style: .default) { action in + BluetoothManager.shared.getTrainHistoryData(day: .today) { boArray, error in + if error != nil { + print("getTrainHistoryData" + (error?.description ?? "")) + }else { + print("getTrainHistoryData success") + } + } + } + + let archiveAction17 = UIAlertAction(title: "getPressureHistoryData", style: .default) { action in + BluetoothManager.shared.getPressureHistoryData(day: .today) { boArray, error in + if error != nil { + print("getPressureHistoryData" + (error?.description ?? "")) + }else { + print("getPressureHistoryData success") + } + } + } + + alert.addAction(archiveAction1) alert.addAction(archiveAction2) alert.addAction(archiveAction3) @@ -314,6 +364,11 @@ extension MineViewController: UITableViewDataSource, UITableViewDelegate { alert.addAction(archiveAction10) alert.addAction(archiveAction11) alert.addAction(archiveAction12) + alert.addAction(archiveAction13) + alert.addAction(archiveAction14) + alert.addAction(archiveAction15) + alert.addAction(archiveAction16) + alert.addAction(archiveAction17) present(alert, animated: true, completion: nil) case "我的数据": let vc = UIStoryboard.loadViewControllerIdentifier(storyboardName: "Mine", identifier: "HealthDataVC") diff --git a/HDFwear/ReadMe b/HDFwear/ReadMe new file mode 100644 index 0000000..be14758 --- /dev/null +++ b/HDFwear/ReadMe @@ -0,0 +1,160 @@ +接口说明: + +接口实现 +BluetoothManager+Function + +发送数据类 +1. 通用应答 + func response(frameNumber: [UInt8], messageId: [UInt8], success: Bool, completion: ((_ error: Int?) -> ())? = nil) + +2. 查询设备信息 + func queryDeviceInfo(queryItems: [UInt8], completion: ((_ error: Int?) -> ())? = nil) + 发送: [237, 126, 0, 1, 0, 16, 0, 1, 0, 3, 2, 2, 3, 169, 70] + 接收: [237, 126, 0, 1, 128, 1, 0, 37, 0, 5, 0, 1, 0, 16, 0, 129, 5] + +3. 设置时间 + func newSetTime(completion: ((_ error: Int?) -> ())? = nil) + 发送: [237, 126, 0, 1, 0, 9, 0, 1, 0, 6, 23, 7, 1, 17, 3, 38, 32, 36] + 接收: [237, 126, 0, 1, 128, 1, 0, 14, 0, 5, 0, 1, 0, 9, 0, 149, 41] + +4. 设置时间格式 + func newSetTimeFormat(format: TimeFormat, completion: ((_ error: Int?) -> ())? = nil) + 发送: [237, 126, 0, 1, 0, 16, 0, 1, 0, 1, 1, 162, 3] + 接收: [237, 126, 0, 1, 128, 1, 0, 29, 0, 5, 0, 1, 0, 16, 0, 217, 3] + +5. 设置温度单位 + func newSetTemperatureUnit(unit: TemperatureUnit, completion: ((_ error: Int?) -> ())? = nil) + 发送: [237, 126, 0, 1, 0, 17, 0, 1, 0, 1, 1, 231, 163] + 接收: [237, 126, 0, 1, 128, 1, 0, 31, 0, 5, 0, 1, 0, 17, 0, 101, 148] + +6. 设置公英制 + func newSetDistanceUnit(unit: DistanceUnit, completion: ((_ error: Int?) -> ())? = nil) + 发送: [237, 126, 0, 1, 0, 18, 0, 1, 0, 1, 1, 41, 67] + 接收: [237, 126, 0, 1, 128, 1, 0, 30, 0, 5, 0, 1, 0, 18, 0, 119, 20] + +7. 设置抬腕唤醒 + func newSetWristSense(bool: Bool, completion: ((_ error: Int?) -> ())? = nil) + 发送: [237, 126, 0, 1, 0, 19, 0, 1, 0, 1, 0, 124, 194] + 接收: [237, 126, 0, 1, 128, 1, 0, 32, 0, 5, 0, 1, 0, 19, 0, 156, 232] + +8. 设置触摸唤醒 + func newSetTouchSense(bool: Bool, completion: ((_ error: Int?) -> ())? = nil) + 发送: [237, 126, 0, 1, 0, 20, 0, 1, 0, 1, 1, 164, 162] + +9. 设置低电提醒 + func newSetLowPowerRemind(bool: Bool, completion: ((_ error: Int?) -> ())? = nil) + 发送: [237, 126, 0, 1, 0, 21, 0, 1, 0, 1, 1, 225, 2] + +10. 设置语言 + func newSetLanguage(lan: UInt8, completion: ((_ error: Int?) -> ())? = nil) + 发送: [237, 126, 0, 1, 0, 22, 0, 1, 0, 1, 0, 63, 195] + +11. 设置恢复出厂设置 + func newSetRestore(completion: ((_ error: Int?) -> ())? = nil) + 发送: [237, 126, 0, 1, 0, 23, 0, 1, 0, 0, 19, 107] + +12. 设置心率过高提醒 + func newSetHeartRateHighRemind(maxHr: UInt8, completion: ((_ error: Int?) -> ())? = nil) + 发送: [237, 126, 0, 1, 0, 24, 0, 1, 0, 1, 120, 64, 255] + 接收: [237, 126, 0, 1, 128, 1, 0, 33, 0, 5, 0, 1, 0, 24, 0, 7, 193] + +13. 设置心率过低提醒 + func newSetHeartRateLowRemind(minHr: UInt8, completion: ((_ error: Int?) -> ())? = nil) + 发送: [237, 126, 0, 1, 0, 25, 0, 1, 0, 1, 120, 5, 95] + +14. 设置查找手表 + func newSetFindWatch(bool: Bool, completion: ((_ error: Int?) -> ())? = nil) + 发送: [237, 126, 0, 1, 0, 32, 0, 1, 0, 1, 1, 141, 143] + 接收: [237, 126, 0, 1, 128, 1, 0, 38, 0, 5, 0, 1, 0, 32, 0, 76, 229] + +15. 设置压力自动检测 + func newSetPressureAutoDetect(bool: Bool, completion: ((_ error: Int?) -> ())? = nil) + 发送: [237, 126, 0, 1, 0, 36, 0, 1, 0, 1, 1, 139, 46] + 接收: [237, 126, 0, 1, 128, 1, 0, 34, 0, 5, 0, 1, 0, 36, 0, 143, 76] + +16. 设置血氧自动检测 + func newSetBloodOxygenAutoDetect(bool: Bool, completion: ((_ error: Int?) -> ())? = nil) + 发送: [237, 126, 0, 1, 0, 37, 0, 1, 0, 1, 1, 206, 142] + 接收: [237, 126, 0, 1, 128, 1, 0, 35, 0, 5, 0, 1, 0, 37, 0, 251, 174] + +17. 设置用户信息 + func newSetUserInfo(_ user: UserInfoModel, completion: ((_ error: Int?) -> ())? = nil) + 发送: [237, 126, 0, 1, 0, 38, 0, 1, 0, 5, 0, 65, 0, 175, 1, 41, 211] + +18. 设置勿扰模式 + 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(day: SyncDay = .today, closure: SleepClosure? = nil) + 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 6, 240, 42] + +20. 拉取血氧数据 + func getBloodOxygenHistoryData(day: SyncDay = .today, closure: BloodOxygenClosure? = nil) + 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 2, 176, 174] + +21. 拉取心跳数据 + func getHeartRateHistoryData(day: SyncDay = .today, closure: HeartRateClosure? = nil) + 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 1, 128, 205] + +22. 拉取计步数据 + func getStepHistoryData(day: SyncDay = .today, closure: StepClosure? = nil) + 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 3, 160, 143] + +23. 拉取训练数据 + func getTrainHistoryData(day: SyncDay = .today, closure: TrainClosure? = nil) + 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 7, 224, 11] + +24. 拉取压力数据 + func getPressureHistoryData(day: SyncDay = .today, closure: PressureClosure? = nil) + 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 5, 192, 73] + +接受数据类 +1. 通用返回数据 + private func parseDefaultResponseData(_ bytes: [UInt8]) + 接收: [237, 126, 0, 1, 128, 1, 0, 14, 0, 5, 0, 1, 0, 9, 0, 149, 41] + +2. 设备信息数据 + private func parseDeviceInfoData (_ content:[UInt8]) + +3. 心跳数据 + func parseHeartRateData (_ content: [UInt8]) + 接收: [237, 126, 0, 1, 128, 22, 0, 7, 0, 200, 100, 157, 163, 180, 112, 100, 157, 170, 188, 247, 100, 157, 177, 196, 6, 100, 157, 184, 204, 0, 100, 157, 191, 212, 22, 100, 157, 198, 220, 249, 100, 157, 205, 228, 6, 100, 157, 212, 236, 0, 100, 157, 219, 244, 0, 100, 157, 226, 252, 251, 100, 157, 234, 4, 6, 100, 157, 241, 12, 0, 100, 157, 248, 20, 229, 100, 157, 255, 28, 253, 100, 158, 6, 36, 6, 100, 158, 13, 44, 0, 100, 158, 20, 52, 197, 100, 158, 27, 60, 255, 100, 158, 34, 68, 6, 100, 158, 41, 76, 0, 100, 158, 48, 84, 180, 100, 158, 55, 92, 1, 100, 158, 62, 100, 7, 100, 158, 69, 108, 0, 100, 158, 76, 116, 158, 100, 158, 83, 124, 2, 100, 158, 90, 132, 7, 100, 158, 97, 140, 0, 100, 158, 104, 148, 131, 100, 158, 111, 156, 4, 100, 158, 118, 164, 7, 100, 158, 125, 172, 0, 100, 158, 132, 180, 114, 100, 158, 139, 188, 6, 100, 158, 146, 196, 7, 100, 158, 153, 204, 0, 100, 158, 160, 212, 87, 100, 158, 167, 220, 8, 100, 158, 174, 228, 7, 100, 158, 181, 236, 20, 23, 62] + +4. 血氧数据 + func parseBlooodOxygenData (_ content: [UInt8]) + +5. 体温数据 + func parseTemperaturData (_ content: [UInt8]) + +6. 压力数据 + func parsePressureData (_ content: [UInt8]) + +7. 计步数据 + func parseStepData (_ content: [UInt8]) + +8. 睡眠数据 + func parseSleepData (_ content: [UInt8]) + +9. 电量变化自动上报 + 0x8010 + +10. 电话挂断 + 0x8014 + +11. 找手机 + 0x8015 + +12. 遥控拍照 + 0x8022 + + + +底层指令组包 +BleMessage+Function +匹配上面的发送的数据与接受的数据 + + + + + diff --git a/HDFwear/Tools/BluetoothManager+Function.swift b/HDFwear/Tools/BluetoothManager+Function.swift index 3be2525..7ad60b6 100644 --- a/HDFwear/Tools/BluetoothManager+Function.swift +++ b/HDFwear/Tools/BluetoothManager+Function.swift @@ -148,6 +148,7 @@ extension BluetoothManager { } //MARK: - 同步健康数据 + // 拉取睡眠数据 func getSleepHistoryData(day: SyncDay = .today, closure: SleepClosure? = nil) { let data = BleMessage.shared.getSyncCmd(.sleep) newStartSyncHealthData(closure: closure, data: data, synType: .sleep) @@ -158,26 +159,31 @@ extension BluetoothManager { // newStartSyncHealthData(closure: closure, data: data, synType: .pressure) } + // 拉取血氧数据 func getBloodOxygenHistoryData(day: SyncDay = .today, closure: BloodOxygenClosure? = nil) { let data = BleMessage.shared.getSyncCmd(.bloodOxygen) newStartSyncHealthData(closure: closure, data: data, synType: .bloodOxygen) } + // 拉取心跳数据 func getHeartRateHistoryData(day: SyncDay = .today, closure: HeartRateClosure? = nil) { let data = BleMessage.shared.getSyncCmd(.heartRate) newStartSyncHealthData(closure: closure, data: data, synType: .heartRate) } + // 拉取计步数据 func getStepHistoryData(day: SyncDay = .today, closure: StepClosure? = nil) { let data = BleMessage.shared.getSyncCmd(.step) newStartSyncHealthData(closure: closure, data: data, synType: .step) } + // 拉取训练数据 func getTrainHistoryData(day: SyncDay = .today, closure: TrainClosure? = nil) { let data = BleMessage.shared.getSyncCmd(.train) newStartSyncHealthData(closure: closure, data: data, synType: .train) } + // 拉取压力数据 func getPressureHistoryData(day: SyncDay = .today, closure: PressureClosure? = nil) { let data = BleMessage.shared.getSyncCmd(.pressure) newStartSyncHealthData(closure: closure, data: data, synType: .pressure) @@ -299,10 +305,10 @@ extension BluetoothManager { } } } - //MARK: - 新解析数据 + //MARK: - 解析数据 func parseData(_ bytes: [UInt8]) { - // jtd! - let bytes: [UInt8] = [0xED, 0x7E, 0x00, 0x01, 0x80, 0x16, 0x00, 0x07, 0x00, 0xC8, 0x64, 0x9D, 0xA3, 0xB4, 0x70, 0x64, 0x9D, 0xAA, 0xBC, 0xF7, 0x64, 0x9D, 0xB1, 0xC4, 0x06, 0x64, 0x9D, 0xB8, 0xCC, 0x00, 0x64, 0x9D, 0xBF, 0xD4, 0x16, 0x64, 0x9D, 0xC6, 0xDC, 0xF9, 0x64, 0x9D, 0xCD, 0xE4, 0x06, 0x64, 0x9D, 0xD4, 0xEC, 0x00, 0x64, 0x9D, 0xDB, 0xF4, 0x00, 0x64, 0x9D, 0xE2, 0xFC, 0xFB, 0x64, 0x9D, 0xEA, 0x04, 0x06, 0x64, 0x9D, 0xF1, 0x0C, 0x00, 0x64, 0x9D, 0xF8, 0x14, 0xE5, 0x64, 0x9D, 0xFF, 0x1C, 0xFD, 0x64, 0x9E, 0x06, 0x24, 0x06, 0x64, 0x9E, 0x0D, 0x2C, 0x00, 0x64, 0x9E, 0x14, 0x34, 0xC5, 0x64, 0x9E, 0x1B, 0x3C, 0xFF, 0x64, 0x9E, 0x22, 0x44, 0x06, 0x64, 0x9E, 0x29, 0x4C, 0x00, 0x64, 0x9E, 0x30, 0x54, 0xB4, 0x64, 0x9E, 0x37, 0x5C, 0x01, 0x64, 0x9E, 0x3E, 0x64, 0x07, 0x64, 0x9E, 0x45, 0x6C, 0x00, 0x64, 0x9E, 0x4C, 0x74, 0x9E, 0x64, 0x9E, 0x53, 0x7C, 0x02, 0x64, 0x9E, 0x5A, 0x84, 0x07, 0x64, 0x9E, 0x61, 0x8C, 0x00, 0x64, 0x9E, 0x68, 0x94, 0x83, 0x64, 0x9E, 0x6F, 0x9C, 0x04, 0x64, 0x9E, 0x76, 0xA4, 0x07, 0x64, 0x9E, 0x7D, 0xAC, 0x00, 0x64, 0x9E, 0x84, 0xB4, 0x72, 0x64, 0x9E, 0x8B, 0xBC, 0x06, 0x64, 0x9E, 0x92, 0xC4, 0x07, 0x64, 0x9E, 0x99, 0xCC, 0x00, 0x64, 0x9E, 0xA0, 0xD4, 0x57, 0x64, 0x9E, 0xA7, 0xDC, 0x08, 0x64, 0x9E, 0xAE, 0xE4, 0x07, 0x64, 0x9E, 0xB5, 0xEC, 0x14, 0x17, 0x3E] + // debug +// let bytes: [UInt8] = [0xED, 0x7E, 0x00, 0x01, 0x80, 0x16, 0x00, 0x07, 0x00, 0xC8, 0x64, 0x9D, 0xA3, 0xB4, 0x70, 0x64, 0x9D, 0xAA, 0xBC, 0xF7, 0x64, 0x9D, 0xB1, 0xC4, 0x06, 0x64, 0x9D, 0xB8, 0xCC, 0x00, 0x64, 0x9D, 0xBF, 0xD4, 0x16, 0x64, 0x9D, 0xC6, 0xDC, 0xF9, 0x64, 0x9D, 0xCD, 0xE4, 0x06, 0x64, 0x9D, 0xD4, 0xEC, 0x00, 0x64, 0x9D, 0xDB, 0xF4, 0x00, 0x64, 0x9D, 0xE2, 0xFC, 0xFB, 0x64, 0x9D, 0xEA, 0x04, 0x06, 0x64, 0x9D, 0xF1, 0x0C, 0x00, 0x64, 0x9D, 0xF8, 0x14, 0xE5, 0x64, 0x9D, 0xFF, 0x1C, 0xFD, 0x64, 0x9E, 0x06, 0x24, 0x06, 0x64, 0x9E, 0x0D, 0x2C, 0x00, 0x64, 0x9E, 0x14, 0x34, 0xC5, 0x64, 0x9E, 0x1B, 0x3C, 0xFF, 0x64, 0x9E, 0x22, 0x44, 0x06, 0x64, 0x9E, 0x29, 0x4C, 0x00, 0x64, 0x9E, 0x30, 0x54, 0xB4, 0x64, 0x9E, 0x37, 0x5C, 0x01, 0x64, 0x9E, 0x3E, 0x64, 0x07, 0x64, 0x9E, 0x45, 0x6C, 0x00, 0x64, 0x9E, 0x4C, 0x74, 0x9E, 0x64, 0x9E, 0x53, 0x7C, 0x02, 0x64, 0x9E, 0x5A, 0x84, 0x07, 0x64, 0x9E, 0x61, 0x8C, 0x00, 0x64, 0x9E, 0x68, 0x94, 0x83, 0x64, 0x9E, 0x6F, 0x9C, 0x04, 0x64, 0x9E, 0x76, 0xA4, 0x07, 0x64, 0x9E, 0x7D, 0xAC, 0x00, 0x64, 0x9E, 0x84, 0xB4, 0x72, 0x64, 0x9E, 0x8B, 0xBC, 0x06, 0x64, 0x9E, 0x92, 0xC4, 0x07, 0x64, 0x9E, 0x99, 0xCC, 0x00, 0x64, 0x9E, 0xA0, 0xD4, 0x57, 0x64, 0x9E, 0xA7, 0xDC, 0x08, 0x64, 0x9E, 0xAE, 0xE4, 0x07, 0x64, 0x9E, 0xB5, 0xEC, 0x14, 0x17, 0x3E] totalLength = 0 mergeLength = 0 totalBytes = [] @@ -393,6 +399,7 @@ extension BluetoothManager { return content } + // 通用返回数据 private func parseDefaultResponseData(_ bytes: [UInt8]) { guard bytes.count == 17, bytes[9] == 5 else { return @@ -416,6 +423,7 @@ extension BluetoothManager { } } + // 设备信息数据 private func parseDeviceInfoData (_ content:[UInt8]) { guard content.count > 0 else { print("无有效的信息") @@ -453,6 +461,7 @@ extension BluetoothManager { } } + // 心跳数据 func parseHeartRateData (_ content: [UInt8]) { guard content.count > 0 else { print("无有效的信息") @@ -464,6 +473,7 @@ extension BluetoothManager { heartRateClosure?(hrArray, nil) } + // 血氧数据 func parseBlooodOxygenData (_ content: [UInt8]) { guard content.count > 0 else { print("无有效的信息") @@ -475,6 +485,7 @@ extension BluetoothManager { bloodOxygenClosure?(array, nil) } + // 体温数据 func parseTemperaturData (_ content: [UInt8]) { guard content.count > 0 else { print("无有效的信息") @@ -484,6 +495,7 @@ extension BluetoothManager { TemperatureModel.addArray(array)// 加入数据库 } + // 压力数据 func parsePressureData (_ content: [UInt8]) { guard content.count > 0 else { print("无有效的信息") @@ -495,6 +507,7 @@ extension BluetoothManager { pressureClosure?(array, nil) } + // 计步数据 func parseStepData (_ content: [UInt8]) { guard content.count > 0 else { print("无有效的信息") @@ -506,6 +519,7 @@ extension BluetoothManager { stepClosure?(array, nil) } + // 睡眠数据 func parseSleepData (_ content: [UInt8]) { guard content.count > 0 else { print("无有效的信息") diff --git a/HDFwear/Tools/BluetoothManager.swift b/HDFwear/Tools/BluetoothManager.swift index 8a42d34..bdaea0c 100644 --- a/HDFwear/Tools/BluetoothManager.swift +++ b/HDFwear/Tools/BluetoothManager.swift @@ -1454,7 +1454,7 @@ extension BluetoothManager: ClientProfileDelegate { } } case BLEConfig.ReadUUID: - print("?????????????\([UInt8](data))") + print("接收: \([UInt8](data))") mergeData(data) default: mergeData(data) @@ -1463,7 +1463,7 @@ extension BluetoothManager: ClientProfileDelegate { func mergeData(_ data: Data) { let bytes = [UInt8](data) - print(bytes) +// print(bytes) isSyncReceived = true if bytes[0] == 0xED && bytes[1] == 0x7E { // if bytes.count > 10, BleCmd(rawValue: bytes[8]) == .sync { -- libgit2 0.21.4