Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get HRM data from mi band. #1

Open
akashsaggu96 opened this issue Oct 11, 2018 · 0 comments
Open

Unable to get HRM data from mi band. #1

akashsaggu96 opened this issue Oct 11, 2018 · 0 comments

Comments

@akashsaggu96
Copy link

i am using Mi band 3, after short interval it keep on disconnecting
i am unable to retrieve the heart rate from the band, it is notifying
<CBService: 0x1c467b340, isPrimary = YES, UUID = Heart Rate>
<CBCharacteristic: 0x1c42a2400, UUID = 2A37, properties = 0x10, value = (null), notifying = NO>

following method is not calling

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

    if characteristic.uuid == BLE_Heart_Rate_Measurement_Characteristic_CBUUID {
        
        // STEP 13: we generally have to decode BLE
        // data into human readable format
        let heartRate = deriveBeatsPerMinute(using: characteristic)
        
        DispatchQueue.main.async { () -> Void in
            
            UIView.animate(withDuration: 1.0, animations: {
                self.beatsPerMinuteLabel.alpha = 1.0
                self.beatsPerMinuteLabel.text = String(heartRate)
            }, completion: { (true) in
                self.beatsPerMinuteLabel.alpha = 0.0
            })
            
        } // END DispatchQueue.main.async...

    } // END if characteristic.uuid ==...
    
    if characteristic.uuid == BLE_Body_Sensor_Location_Characteristic_CBUUID {
        
        // STEP 14: we generally have to decode BLE
        // data into human readable format
        let sensorLocation = readSensorLocation(using: characteristic)

        DispatchQueue.main.async { () -> Void in
            self.sensorLocationTextField.text = sensorLocation
        }
    } // END if characteristic.uuid ==...
    
} // END func peripheral(... didUpdateValueFor charact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant