In order for your app to connect to a Bluetooth LE device, it must find it. This process includes your app, as the central, scanning for devices advertising their services. Core Bluetooth allows for your app to create a central manager and scan for advertised devices’ services. And your app needs to handle what happens when these devices are discovered.
- [Narrator] Now that we've created our core bluetooth…centralManager object and set the delegate to the self,…we want to actually implement that delegate protocol.…The main function that we're going to be concerned with…is the one called centralManagerDidUpdateState.…This is how your app gets notified that the bluetooth…has powered on.…In that callback, we'll check that the power is on…and then we can start scanning for peripherals.…For any peripherals that are discovered, we'll get another…call back called didDiscoverPeripheral,…and we can manipulate that however we need.…
For now we'll just print out the name,…but later we'll use it to find our specific device…and connect to it.…So back in our project, we see that we have a problem…that we're not actually implementing this delegate.…But Xcode can help us fix that by providing the stub…of the code that we're interested in.…We're going to delete the code placeholder on line 14.…This is where we'll add our implementation for the…centralManagerDidUpdateState.…
- Bluetooth Low Energy (BLE) basics
- Core Bluetooth key classes
- Scanning for peripherals
- Discovering services and characteristics
- Writing to a characteristic
- Reconnecting to peripherals
- Apps as peripherals
Skill Level Intermediate
1. BLE Basics
2. Scanning, Connecting, and Discovering
3. Writing to a Characteristic
Adding additional features10m 43s
4. An App as a Peripheral
Next steps1m 7s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.