如何读取腕带的卡路里和距离?

时间:2019-05-10 08:22:24

标签: swift bluetooth-lowenergy

我尝试做自己的Mi Band应用程序,我可以找到电池电量的当前时间,但是找不到有关从腕带品牌读取距离和卡路里的信息。我该怎么做? 这是当前时间:

from __future__ import print_function
import unittest
import os.path
import win32com.client

class ExcelMacro(unittest.TestCase):
    def test_excel_macro(self):
        try:
            xlApp = win32com.client.DispatchEx('Excel.Application')
            xlsPath = os.path.expanduser('C:\\Users\\colm_mcsweeney\\Documents\\Attachments\\Dash.09.05.19.xlsm')
            wb = xlApp.Workbooks.Open(Filename=xlsPath)
            xlApp.Visible = True
            xlApp.Run("C:\\Users\\AppData\\Roaming\\Microsoft\\Excel\\XLSTART\\PERSONAL.XLSB!Pivots")
            wb.Save()
            xlApp.Quit()
            print("Macro ran successfully!")
        except:
            print("Error found while running the excel macro!")
            xlApp.Quit()
if __name__ == "__main__":
    unittest.main()

运行此命令我会得到

let currentTime = CBUUID(string: "2A2B")

class MainViewController: UIViewController, CBCentralManagerDelegate, CBPeripheralDelegate {

var manager: CBCentralManager?
var mainPeripheral: CBPeripheral?
var mainCharacteristic: CBCharacteristic?

 func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {
    self.deviceName.text = peripheral.name
    // https://www.bluetooth.com/specifications/gatt/services/
    for service in peripheral.services! {
       if (service.uuid.uuidString == "FEE0") {
            peripheral.discoverCharacteristics(nil, for: service)
            print(service)
        }
    }

    func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {
   if (service.uuid.uuidString == "FEE0") {
        print(service.uuid.uuidString)

        for characteristic in service.characteristics! {
            // 1811 nın taşıdığı servisler ve bunların kodu
            print(characteristic.uuid.uuidString)
            print(characteristic)

            if (characteristic.uuid.uuidString == "2A2B") {

                peripheral.readValue(for: characteristic)
                print("Found Device Name Characteristic")
            } }}

  func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
    print("*************")

 case currentTime:
        print("Current time : \(String(describing: characteristic))" )
        let value = [UInt8](characteristic.value!)

        print(value)
}

那么我该如何读取距离和卡路里。我搜寻了但找不到。问候!

0 个答案:

没有答案