Coder Social home page Coder Social logo

healthkit-and-bluetooth-hrm's Introduction

A Simple Core Bluetooth demo

Developed by Andrew Jaffee

As iOS developers, we’re very aware that humans love connectivity. Obviously, we love to communicate with each other using wireless devices. More recently, we’ve come expect that we can communicate with what once were considered standalone, ordinary devices. We’ve come to love, even expect, that some of those wireless devices can gather and analyze data about ourselves (usually “wearables”). So many devices have become intrinsic parts of our lives that we’ve coined a now commonly-used phrase, the “Internet of Things” or “IoT.” There are now billions of wireless, communicable devices on the planet. In this tutorial, we’re going to focus on just one segment of the IoT: Bluetooth®.

I’ll explain the essential concepts behind Bluetooth® technology, plus:

  • Show you how getting proficient in Bluetooth® software development presents you with a tremendous career opportunity
  • Remind you that you can’t distribute an app that uses Bluetooth® without determining if you need to go through “qualification”
  • Provide you with an overview of Apple’s Core Bluetooth framework (see also here)
  • Finally, walk you through the development of an iOS app in Swift 4 that monitors a person’s heart rate via Core Bluetooth via a Bluetooth® device.

For the full tutorial, please refer to:

https://www.appcoda.com/core-bluetooth

healthkit-and-bluetooth-hrm's People

Contributors

simonng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

healthkit-and-bluetooth-hrm's Issues

Unable to get HRM data from mi band.

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

I have an Query

Hello Team,

I am sorry this not an issue I'm posting but query I have.

Can the code be used for other devices as well?
If so, How to get human readable data?

Basically, I have a quite confusion in "didUpdateValueFor" delegate method?

Can you help me out in this regard?

Looking forward to hearing from you!

Thanks in anticipations!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.