Commit 6535c9dfbe8448e33d35b7686c21fa17adf7ce18

Authored by jason
1 parent 1b6b2401

feat:newGetBateryData

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
... ... @@ -169,6 +169,9 @@ enum SyncType: UInt8 {
169 169 case pressure = 0x05
170 170 case sleep = 0x06
171 171 case train = 0x07
  172 +// case 0x08
  173 + case battery = 0x09
  174 +// case gps = 0x0A
172 175 case other = 0xff
173 176 }
174 177  
... ...
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) {
... ...