Skip to content

Unable to get HRM data from mi band. #1

@akashsaggu96

Description

@akashsaggu96

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions