Commit e817a7d052a5161f0d509a42a16d8a1cf239528e

Authored by daifengyi
1 parent 2db3eb12

feat:low power reminder

HDFwear/Tools/BleMessage+Function.swift
... ... @@ -37,4 +37,8 @@ extension BleMessage {
37 37 return createDataPacket(key: .setWristSense, bytes: bytes)
38 38 }
39 39  
  40 + func getLowPowerRemind(_ bool: Bool) -> Data {
  41 + let bytes: [UInt8] = bool ? [0x01] : [0x00]
  42 + return createDataPacket(key: .setLowPowerRemind, bytes: bytes)
  43 + }
40 44 }
... ...
HDFwear/Tools/Bluetooth+Types.swift
... ... @@ -120,6 +120,7 @@ enum NewCmd: UInt8 {
120 120 case setTemperatureUnit = 0x11
121 121 case setDistanceUnit = 0x12
122 122 case setWristSense = 0x13
  123 + case setLowPowerRemind = 0x15
123 124  
124 125 }
125 126  
... ...
HDFwear/Tools/BluetoothManager+Function.swift
... ... @@ -44,5 +44,10 @@ extension BluetoothManager {
44 44 sendData(data)
45 45 }
46 46  
47   -
  47 + // 设置低电提醒
  48 + func newSetLowPowerRemind(bool: Bool, completion: ((_ error: Int?) -> ())? = nil) {
  49 + let data = BleMessage.shared.getLowPowerRemind(bool)
  50 + self.setCmdClosure = completion
  51 + sendData(data)
  52 + }
48 53 }
... ...
HDFwear/Tools/BluetoothManager.swift
... ... @@ -1231,7 +1231,7 @@ class BluetoothManager: NSObject {
1231 1231 }
1232 1232 let newcmd = NewCmd(rawValue: bytes[13])
1233 1233 switch newcmd {
1234   - case .setTime, .setTimeFormat, .setTemperatureUnit, .setDistanceUnit, .setWristSense:
  1234 + case .setTime, .setTimeFormat, .setTemperatureUnit, .setDistanceUnit, .setWristSense, .setLowPowerRemind:
1235 1235 if setCmdClosure != nil {
1236 1236 let success = bytes[14] == 0
1237 1237 if success {
... ...