(.fetchWatchState, "获取当前手表状态", []),
(.fetchVibrateSound, "获取手表声音与震动参数", []),
- (.vibrateSound, "设置手表声音与震动参数", [.vibrateSound(IBVibrateSound())]),
+ (.vibrateSound, "设置手表声音与震动参数", [.vibrateSound(Config.setVibrateSound())]),
(.fetchAuxiliary, "获取手表辅助功能参数", []),
(.auxiliary, "设置手表辅助功能参数", [.auxiliary(.bloodOxygen)]),
(.unit, "设置手表公英制单位", [.value(1)]),
// model.type = 1
// model.duration = .minute
// model.wrist = 0
-
+ return model
+ }
+ static func setVibrateSound()->IBVibrateConfig{
+ let model = IBVibrateConfig()
+ model.type = 0
+ model.systemValue = 80
+
+// model.type = 1
+// model.ringsValue = 70
+//
+// model.type = 3
+// model.ringsState = 1
+// model.vibrateState = 1
return model
}
}
filePath = "IOTBluetooth/IBChecker.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "362"
- endingLineNumber = "362"
+ startingLineNumber = "386"
+ endingLineNumber = "386"
landmarkName = "unknown"
landmarkType = "0">
</BreakpointContent>
return data
}
}
+
+
+struct IBOtherTargetChecker: IBChecker {
+ static func check(_ parameters: [IBParameter]) -> [UInt8] {
+ guard case let .otherTarget(value) = parameters[.otherTarget] else { fatalError("缺少参数: otherTarget") }
+ Logger.log(value.description)
+ var data = value.calorie.byte2 + [value.mileage.byte] + [value.stand.byte] + [value.burning.byte] + [value.ringsState.byte] + [value.vibrateState.byte]
+ data = data + [value.noticeState.byte]
+ return data
+ }
+}
+
+struct IBVibrateSoundChecker: IBChecker {
+ static func check(_ parameters: [IBParameter]) -> [UInt8] {
+ guard case let .vibrateSound(value) = parameters[.vibrateSound] else { fatalError("缺少参数: IBVibrateConfig") }
+ Logger.log(value.description)
+ if value.type == 0{
+ if let systemValue = value.systemValue {
+ return [value.type.byte] + [systemValue.byte]
+ }
+ else{
+ fatalError("参数错误: IBScreenConfig")
+ }
+ }
+ else if value.type == 1{
+ if let ringsValue = value.ringsValue{
+ return [value.type.byte] + [ringsValue.byte]
+ }
+ else{
+ fatalError("参数错误: IBScreenConfig")
+ }
+ }
+ else if value.type == 3{
+ if let ringsState = value.ringsState,let vibrateState = value.vibrateState{
+ return [value.type.byte] + [ringsState.byte] + [vibrateState.byte]
+ }
+ else{
+ fatalError("参数错误: IBScreenConfig")
+ }
+ }
+ return []
+ }
+}
struct IBScreenChecker: IBChecker {
static func check(_ parameters: [IBParameter]) -> [UInt8] {
guard case let .screen(value) = parameters[.screen] else { fatalError("缺少参数: IBScreenConfig") }
}
}
}
-
-struct IBOtherTargetChecker: IBChecker {
- static func check(_ parameters: [IBParameter]) -> [UInt8] {
- guard case let .otherTarget(value) = parameters[.otherTarget] else { fatalError("缺少参数: otherTarget") }
- Logger.log(value.description)
- var data = value.calorie.byte2 + [value.mileage.byte] + [value.stand.byte] + [value.burning.byte] + [value.ringsState.byte] + [value.vibrateState.byte]
- data = data + [value.noticeState.byte]
- return data
- }
-}
-
-struct IBVibrateSoundChecker: IBChecker {
- static func check(_ parameters: [IBParameter]) -> [UInt8] {
- guard case let .vibrateSound(value) = parameters[.vibrateSound] else { fatalError("缺少参数: vibrateSound") }
- Logger.log(value.description)
- let data = [value.systemValue.byte] + [value.ringsValue.byte] + [value.mediaValue.byte] + [value.ringsState.byte] + [value.vibrateState.byte]
- return data
- }
-}
struct IBUserInfoChecker: IBChecker {
static func check(_ parameters: [IBParameter]) -> [UInt8] {
guard case let .userInfo(value) = parameters[.userInfo] else { fatalError("缺少参数: userInfo") }
/// 设置屏幕
case screen(IBScreenConfig)
/// 设置声音和震动
- case vibrateSound(IBVibrateSound)
+ case vibrateSound(IBVibrateConfig)
/// 设置目标设置
case otherTarget(IBOtherTarget)
/// 设置训练目标
var list:[Int] = []
for i in 0..<num {
- var value = dataPacket.data[2*i + 1...2*i + 2].int
+ let value = dataPacket.data[2*i + 1...2*i + 2].int
list.append(value)
}
return .response.code(.success).items(list)
//// Created by incar on 2024/5/9.
////
//
+
+/// 声音震动设置模型
+public class IBVibrateConfig {
+ /// 类型 0系统音量调节,1铃声音量调节,3铃声开关,震动开关
+ public var type: Int = 0
+ /// 系统音量调节0~100(type为0设置)
+ public var systemValue: Int?
+
+ /// 铃声音量调节0~100(type为1设置)
+ public var ringsValue: Int?
+
+ /// 静音开关0:关闭 1:开启(type为3设置)
+ public var ringsState: Int?
+
+ /// 震动设置 0:关闭 1:弱 2:中 3:强 (type为3设置)
+ public var vibrateState: Int?
+
+ public init() { }
+
+ var description: String {
+ return "IBVibrateConfig(type: \(type),systemValue: \(systemValue), ringsValue:\(ringsValue), ringsState:\(ringsState), vibrateState:\(vibrateState))"
+ }
+}
+
/// 声音震动模型
public class IBVibrateSound {
/// 系统音量调节0~100
/// 媒体音量调节0~100
public var mediaValue: Int = 0
- /// é\93\83声开关0:关闭 1:开启
+ /// é\9d\99é\9f³开关0:关闭 1:开启
public var ringsState: Int = 0
- /// 震动开关0:关闭 1:开启
+ /// 震动设置 0:关闭 1:弱 2:中 3:强
public var vibrateState: Int = 0
public init() { }