睡眠历史协议调整
authorliangzhenying <867174124@qq.com>
Mon, 15 Jul 2024 07:26:07 +0000 (15:26 +0800)
committerliangzhenying <867174124@qq.com>
Mon, 15 Jul 2024 07:26:07 +0000 (15:26 +0800)
IOTBluetooth/IOTBluetooth/Example/Datas.swift
IOTBluetooth/IOTBluetooth/IOTBluetooth.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate
IOTBluetooth/IOTBluetooth/IOTBluetooth.xcodeproj/xcuserdata/apple.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
IOTBluetooth/IOTBluetooth/IOTBluetooth/IBAbility.swift
IOTBluetooth/IOTBluetooth/IOTBluetooth/IBManager.swift
IOTBluetooth/IOTBluetooth/IOTBluetooth/Models/IBHeartRate.swift
IOTBluetooth/IOTBluetooth/IOTBluetooth/Models/IBHistorySleep.swift

index 9fc1c86..11cc8cb 100644 (file)
@@ -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())]),
index 907e8e1..c9c3895 100644 (file)
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
index 2e40ded..bf753d4 100644 (file)
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "BEED2541-8D39-4FD0-BAA2-0F13ED031C02"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "Example/AbilityViewController.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "75"
-            endingLineNumber = "75"
-            landmarkName = "tableView(_:didSelectRowAt:)"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
    </Breakpoints>
 </Bucket>
index ad76570..485bf65 100644 (file)
@@ -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回应内容
index 392dcd7..45cb27b 100644 (file)
@@ -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 }
index 554758d..eee15b4 100644 (file)
@@ -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  {
index 7f04ee0..27cba4e 100644 (file)
@@ -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() { }