IMHeartRateMonitor 1.0.6

IMHeartRateMonitor 1.0.6

Igor Makara 维护。



  • Igor Makara

IMHeartRateMonitor

IMHeartRateMonitor 是一个基于 Core Bluetooth 的简易库,用于与 BLE 心率监测器交互

它可以让你从心率监测器中获取心率值。

  - Easy to connect
  - Everything is already parsed
  - Connect and get data

文档与支持

See some code bellow. Also, make sure you checkout the example app. It contains such as functionality: list, connect,                  disconnect, auto-connect to last device.

示例

Clone the project, and run pod install from the IMHeartRateMonitorExample directory first.

警告

-Specify a bundle identifier, Team and provisioning profiles to run.

-You will need an actual device to connect to HR monitors

要求

Swift 4.0

安装

IMHeartRateMonitor is available on CocoaPods. To install it, simply add the following line to your Podfile:
      pod 'IMHeartRateMonitor'

使用方法

导入

    import IMHeartRateMonitor

创建监控器

        let heartRateMonitor = IMHeartRateMonitor.shared

开始

        heartRateMonitor.didConnectCompletion = {
            //state changed
        }
        
        heartRateMonitor.didDiscoverPeripheralCompletion = { peripherial in
            //append discovered peripherals
        }
    
        heartRateMonitor.startScaning()
        

连接到外围设备

        heartRateMonitor.connectToPeripherial(peripheral, heartRateChangedCompletion: { heartRate in
            
        })

观察变更

        heartRateMonitor.didUpdateCharacteristicCompletion = { peripheral in
        
        }

        heartRateMonitor.didDisconnectCompletion = {

        }
        
        heartRateMonitor.connectionStateChangedCompletion = { state in

        }
    
        heartRateMonitor.heartRateChangedCompletion = { heartRate in
    
        }
        
        
        GET MANUFACTURE DEVICE NAME 
        
        func getPeripherialName() -> String?