From: liangzhenying <867174124@qq.com> Date: Mon, 15 Jul 2024 07:26:07 +0000 (+0800) Subject: 睡眠历史协议调整 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.js?a=commitdiff_plain;h=b1af480a8af8881d1cc3ec3dc7ecb698174ff6fd;p=mirrors%2FIOTBluetooth-iOS.git 睡眠历史协议调整 --- diff --git a/IOTBluetooth/IOTBluetooth/Example/Datas.swift b/IOTBluetooth/IOTBluetooth/Example/Datas.swift index 9fc1c86..11cc8cb 100644 --- a/IOTBluetooth/IOTBluetooth/Example/Datas.swift +++ b/IOTBluetooth/IOTBluetooth/Example/Datas.swift @@ -56,7 +56,7 @@ let datas: [(ability: IBAbility, label: String, parameters: [IBParameter])] = [ (.heartRateMode, "开启自动获取实时心率", [.action(1)]), (.heartRateMode, "关闭自动获取实时心率", [.action(0)]), - (.heartRateHigh, "设置最高心率提醒", [.value(240)]), + (.heartRateHigh, "设置最高心率提醒", [.value(180)]), (.heartRateHigh, "关闭最高心率提醒", [.value(0)]), (.fetchHeartRate, "获取手表心率参数", []), (.heartRate, "设置手表心率参数", [.heartRate(IBHeartRate())]), diff --git a/IOTBluetooth/IOTBluetooth/IOTBluetooth.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate b/IOTBluetooth/IOTBluetooth/IOTBluetooth.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate index 907e8e1..c9c3895 100644 Binary files a/IOTBluetooth/IOTBluetooth/IOTBluetooth.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate and b/IOTBluetooth/IOTBluetooth/IOTBluetooth.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/IOTBluetooth/IOTBluetooth/IOTBluetooth.xcodeproj/xcuserdata/apple.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/IOTBluetooth/IOTBluetooth/IOTBluetooth.xcodeproj/xcuserdata/apple.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 2e40ded..bf753d4 100644 --- a/IOTBluetooth/IOTBluetooth/IOTBluetooth.xcodeproj/xcuserdata/apple.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/IOTBluetooth/IOTBluetooth/IOTBluetooth.xcodeproj/xcuserdata/apple.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -36,21 +36,5 @@ landmarkType = "7"> - - - - diff --git a/IOTBluetooth/IOTBluetooth/IOTBluetooth/IBAbility.swift b/IOTBluetooth/IOTBluetooth/IOTBluetooth/IBAbility.swift index ad76570..485bf65 100644 --- a/IOTBluetooth/IOTBluetooth/IOTBluetooth/IBAbility.swift +++ b/IOTBluetooth/IOTBluetooth/IOTBluetooth/IBAbility.swift @@ -493,6 +493,8 @@ public extension IBAbility { internal static let aiReady = IBAbility.short.id(0x05).parser(IBGeneralParser.self).checker(IBValueChecker.self) /// 获取Ai录音文件 + /// - Parameter value:Data \ AI录音文件内容(pcm格式) + /// Read from ``IBResponse``.value internal static let fetchAiAudio = IBAbility.short.id(0x34).parser(IBfetchAiAudioParser.self) /// 发送Ai回应内容 diff --git a/IOTBluetooth/IOTBluetooth/IOTBluetooth/IBManager.swift b/IOTBluetooth/IOTBluetooth/IOTBluetooth/IBManager.swift index 392dcd7..45cb27b 100644 --- a/IOTBluetooth/IOTBluetooth/IOTBluetooth/IBManager.swift +++ b/IOTBluetooth/IOTBluetooth/IOTBluetooth/IBManager.swift @@ -31,7 +31,7 @@ public class IBManager { public extension IBManager { /// SDK 版本号 - static let version: String = "1.0.18" + static let version: String = "1.0.19" /// 默认为 false static var isDebug: Bool = false { didSet { Logger.isDebug = isDebug } diff --git a/IOTBluetooth/IOTBluetooth/IOTBluetooth/Models/IBHeartRate.swift b/IOTBluetooth/IOTBluetooth/IOTBluetooth/Models/IBHeartRate.swift index 554758d..eee15b4 100644 --- a/IOTBluetooth/IOTBluetooth/IOTBluetooth/Models/IBHeartRate.swift +++ b/IOTBluetooth/IOTBluetooth/IOTBluetooth/Models/IBHeartRate.swift @@ -9,7 +9,7 @@ import Foundation /// 心率设置模型 public class IBHeartRate { /// 监测频率 - public var rate: IBHeartRateFrequency = .none + public var rate: IBHeartRateFrequency = .min1 /// 心率提醒 0:关闭 1:开启。 为0时后面区间阈值无需设置。 public var state: Int = 1 /// 心率区间阈值 高于或低于 0:低于 1:高于 @@ -22,10 +22,8 @@ public class IBHeartRate { init(_ data: Data) { rate = IBHeartRateFrequency(rawValue:data[0].int) ?? .none state = data[1].int - if state == 1 { - higherOrLower = data[2].int - value = data[3].int - } + higherOrLower = data[2].int + value = data[3].int } var description: String { diff --git a/IOTBluetooth/IOTBluetooth/IOTBluetooth/Models/IBHistorySleep.swift b/IOTBluetooth/IOTBluetooth/IOTBluetooth/Models/IBHistorySleep.swift index 7f04ee0..27cba4e 100644 --- a/IOTBluetooth/IOTBluetooth/IOTBluetooth/Models/IBHistorySleep.swift +++ b/IOTBluetooth/IOTBluetooth/IOTBluetooth/Models/IBHistorySleep.swift @@ -35,15 +35,21 @@ import Foundation item.lightSleep = IBSleepTime(hour: itemData[14].int, minute: itemData[15].int) item.remSleep = IBSleepTime(hour: itemData[16].int, minute: itemData[17].int) item.awake = IBSleepTime(hour: itemData[18].int, minute: itemData[19].int) - item.states = IBSleepState(time: itemData[20...23].int, state: itemData[24].int) + + var subIndex = 20 + var list:[IBSleepState] = [] + while itemData.count >= subIndex + 5{ + var state = IBSleepState(time: itemData[subIndex...subIndex+3].int, state: itemData[subIndex+4].int) + list.append(state) + subIndex = subIndex + 5 + } + item.states = list } historyList.append(item) } index += 2 + len } - } - list = historyList } } @@ -69,7 +75,7 @@ public class IBHistorySleepItem { /// 清醒时长 public var awake: IBSleepTime? /// 睡眠状态 - public var states:IBSleepState? + public var states:[IBSleepState]? public init() { }