Commit 5caab7342aa429a5392c375b7bc57d47b795d3fe
1 parent
1e5d4268
feat:message remind
Showing
5 changed files
with
39 additions
and
1 deletions
HDFwear/20240110ReadMe.md
... | ... | @@ -76,6 +76,11 @@ BluetoothManager+Function |
76 | 76 | func newSetBloodOxygenLowRemind(minBo: UInt8, completion: ((_ error: Int?) -> ())? = nil) |
77 | 77 | 发送: [237, 126, 0, 1, 0, 52, 0, 1, 0, 1, 80, 219, 126] |
78 | 78 | 接收: [237, 126, 0, 1, 128, 1, 0, 1, 0, 5, 0, 1, 0, 52, 0, 63, 34] |
79 | + | |
80 | +设置消息提醒 | |
81 | + func newSetMessageRemind(enable: Bool, system: Bool, wechat: Bool, qq: Bool, completion: ((_ error: Int?) -> ())? = nil) | |
82 | + 发送: [237, 126, 0, 1, 0, 53, 0, 1, 0, 1, 3, 244, 72] | |
83 | + 接收: [237, 126, 0, 1, 128, 1, 0, 1, 0, 5, 0, 1, 0, 53, 0, 12, 19] | |
79 | 84 | |
80 | 85 | 接受数据类 |
81 | 86 | 遥控拍照 | ... | ... |
HDFwear/Mine/MineViewController.swift
... | ... | @@ -388,6 +388,15 @@ extension MineViewController: UITableViewDataSource, UITableViewDelegate { |
388 | 388 | } |
389 | 389 | } |
390 | 390 | |
391 | + let archiveAction27 = UIAlertAction(title: "newSetMessageRemind", style: .default) { action in | |
392 | + BluetoothManager.shared.newSetMessageRemind(enable: true, system: true, wechat: false, qq: false) { error in | |
393 | + if error != nil { | |
394 | + print("newSetMessageRemind" + (error?.description ?? "")) | |
395 | + }else { | |
396 | + print("newSetMessageRemind success") | |
397 | + } | |
398 | + } | |
399 | + } | |
391 | 400 | |
392 | 401 | alert.addAction(archiveAction0) |
393 | 402 | alert.addAction(archiveAction1) |
... | ... | @@ -412,6 +421,7 @@ extension MineViewController: UITableViewDataSource, UITableViewDelegate { |
412 | 421 | alert.addAction(archiveAction24) |
413 | 422 | alert.addAction(archiveAction25) |
414 | 423 | alert.addAction(archiveAction26) |
424 | + alert.addAction(archiveAction27) | |
415 | 425 | |
416 | 426 | alert.addAction(UIAlertAction(title: "取消", style: .destructive, handler: nil)) |
417 | 427 | present(alert, animated: true, completion: nil) | ... | ... |
HDFwear/Tools/BleMessage+Function.swift
... | ... | @@ -222,4 +222,18 @@ extension BleMessage { |
222 | 222 | let bytes: [UInt8] = [minHr] |
223 | 223 | return createDataPacket(key: .setBloodOxygenLowRemind, bytes: bytes) |
224 | 224 | } |
225 | + | |
226 | + func getMessageRemindCmd(enable: Bool, system: Bool, wechat: Bool, qq: Bool) -> Data { | |
227 | + var byte: UInt8 = 0 | |
228 | + // 设置最低位 | |
229 | + byte |= enable ? 1 : 0 | |
230 | + // 设置第二位 | |
231 | + byte |= system ? (1 << 1) : 0 | |
232 | + // 设置第三位 | |
233 | + byte |= wechat ? (1 << 2) : 0 | |
234 | + // 设置最高位 | |
235 | + byte |= qq ? (1 << 3) : 0 | |
236 | + let bytes: [UInt8] = [byte] | |
237 | + return createDataPacket(key: .setMessageRemind, bytes: bytes) | |
238 | + } | |
225 | 239 | } | ... | ... |
HDFwear/Tools/Bluetooth+Types.swift
HDFwear/Tools/BluetoothManager+Function.swift
... | ... | @@ -210,6 +210,15 @@ extension BluetoothManager { |
210 | 210 | sendData(data) |
211 | 211 | } |
212 | 212 | |
213 | + // 设置消息提醒 | |
214 | + // 0表示关闭 1表示开启 | |
215 | + // enable 总开关 system 系统消息 wechat 微信消息 qq qq消息 | |
216 | + func newSetMessageRemind(enable: Bool, system: Bool, wechat: Bool, qq: Bool, completion: ((_ error: Int?) -> ())? = nil) { | |
217 | + let data = BleMessage.shared.getMessageRemindCmd(enable: enable, system: system, wechat: wechat, qq: qq) | |
218 | + self.setCmdClosure = completion | |
219 | + sendData(data) | |
220 | + } | |
221 | + | |
213 | 222 | //MARK: - 同步健康数据 |
214 | 223 | //拉取数据 |
215 | 224 | func newGetData(type:SyncType, option: SyncOption = .now, completion: ((_ error: Int?) -> ())? = nil) { | ... | ... |