Commit 6535c9dfbe8448e33d35b7686c21fa17adf7ce18
1 parent
1b6b2401
feat:newGetBateryData
Showing
4 changed files
with
26 additions
and
0 deletions
HDFwear/20240110ReadMe.md
... | ... | @@ -19,3 +19,8 @@ BluetoothManager+Function |
19 | 19 | func newSetWristSense(bool: Bool, completion: ((_ error: Int?) -> ())? = nil) |
20 | 20 | 发送: [237, 126, 0, 1, 0, 19, 0, 1, 0, 1, 0, 124, 194] |
21 | 21 | 接收: [237, 126, 0, 1, 128, 1, 0, 32, 0, 5, 0, 1, 0, 19, 0, 156, 232] |
22 | + | |
23 | +拉取电量数据 | |
24 | + func newGetBateryData( completion: ((_ error: Int?) -> ())? = nil) { | |
25 | + 发送: [237, 126, 0, 1, 0, 40, 0, 1, 0, 1, 9, 1, 197] | |
26 | + 接收: [237, 126, 0, 1, 128, 1, 0, 1, 0, 5, 0, 1, 128, 16, 98, 130, 190] | ... | ... |
HDFwear/Mine/MineViewController.swift
... | ... | @@ -402,6 +402,16 @@ extension MineViewController: UITableViewDataSource, UITableViewDelegate { |
402 | 402 | } |
403 | 403 | } |
404 | 404 | |
405 | + let archiveAction22 = UIAlertAction(title: "newGetBateryData", style: .default) { action in | |
406 | + BluetoothManager.shared.newGetBateryData { error in | |
407 | + if error != nil { | |
408 | + print("newGetBateryData" + (error?.description ?? "")) | |
409 | + }else { | |
410 | + print("newGetBateryData success") | |
411 | + } | |
412 | + } | |
413 | + } | |
414 | + | |
405 | 415 | alert.addAction(archiveAction1) |
406 | 416 | alert.addAction(archiveAction2) |
407 | 417 | alert.addAction(archiveAction3) |
... | ... | @@ -423,6 +433,7 @@ extension MineViewController: UITableViewDataSource, UITableViewDelegate { |
423 | 433 | alert.addAction(archiveAction19) |
424 | 434 | alert.addAction(archiveAction20) |
425 | 435 | alert.addAction(archiveAction21) |
436 | + alert.addAction(archiveAction22) | |
426 | 437 | |
427 | 438 | present(alert, animated: true, completion: nil) |
428 | 439 | case "我的数据": | ... | ... |
HDFwear/Tools/Bluetooth+Types.swift
HDFwear/Tools/BluetoothManager+Function.swift
... | ... | @@ -176,6 +176,13 @@ extension BluetoothManager { |
176 | 176 | sendData(data) |
177 | 177 | } |
178 | 178 | |
179 | + // 拉取电量数据 | |
180 | + func newGetBateryData( completion: ((_ error: Int?) -> ())? = nil) { | |
181 | + let data = BleMessage.shared.getSyncCmd(.battery) | |
182 | + self.setCmdClosure = completion | |
183 | + sendData(data) | |
184 | + } | |
185 | + | |
179 | 186 | //MARK: - 同步健康数据 |
180 | 187 | // 拉取睡眠数据 |
181 | 188 | func getSleepHistoryData( closure: SleepClosure? = nil) { | ... | ... |