diff --git a/HDFwear/Tools/BleMessage+Function.swift b/HDFwear/Tools/BleMessage+Function.swift index 66efb48..601eee2 100644 --- a/HDFwear/Tools/BleMessage+Function.swift +++ b/HDFwear/Tools/BleMessage+Function.swift @@ -72,4 +72,13 @@ extension BleMessage { return createDataPacket(key: .setFindWatch, bytes: bytes) } + func getPressureAutoDetectCmd(_ bool: Bool) -> Data { + let bytes: [UInt8] = bool ? [0x01] : [0x00] + return createDataPacket(key: .setPressureAutoDetect, bytes: bytes) + } + + func getBloodOxygenAutoDetectCmd(_ bool: Bool) -> Data { + let bytes: [UInt8] = bool ? [0x01] : [0x00] + return createDataPacket(key: .setbloodOxygenAutoDetect, bytes: bytes) + } } diff --git a/HDFwear/Tools/Bluetooth+Types.swift b/HDFwear/Tools/Bluetooth+Types.swift index d3d610a..fa00ea4 100644 --- a/HDFwear/Tools/Bluetooth+Types.swift +++ b/HDFwear/Tools/Bluetooth+Types.swift @@ -127,12 +127,12 @@ enum NewCmd: UInt8 { case setHeartRateHighRemind = 0x18 case setHeartRateLowRemind = 0x19 case setFindWatch = 0x0020 - //todo - case setMessage = 0x0021 +// case setMessage = 0x0021 // case setPhoneCall = 0x0022 -// 0x0023 - case setPresureAutoDetect = 0x0024 +// 0x0023 + case setPressureAutoDetect = 0x0024 case setbloodOxygenAutoDetect = 0x0025 + //jtd! case setUserInfo = 0x0026 case setNoDisturb = 0x0027 case setFetchWatchData = 0x0028 diff --git a/HDFwear/Tools/BluetoothManager+Function.swift b/HDFwear/Tools/BluetoothManager+Function.swift index acac729..f5a61e9 100644 --- a/HDFwear/Tools/BluetoothManager+Function.swift +++ b/HDFwear/Tools/BluetoothManager+Function.swift @@ -96,4 +96,20 @@ extension BluetoothManager { self.setCmdClosure = completion sendData(data) } + + // 设置压力自动检测 + // bool 0表示关闭振动 1表示打开震动 + func newSetPressureAutoDetect(bool: Bool, completion: ((_ error: Int?) -> ())? = nil) { + let data = BleMessage.shared.getPressureAutoDetectCmd(bool) + self.setCmdClosure = completion + sendData(data) + } + + // 设置血压自动检测 + // bool 0表示关闭振动 1表示打开震动 + func newSetBloodOxygenAutoDetect(bool: Bool, completion: ((_ error: Int?) -> ())? = nil) { + let data = BleMessage.shared.getBloodOxygenAutoDetectCmd(bool) + self.setCmdClosure = completion + sendData(data) + } }