Once a device is connected, its specific services can be discovered. A single Bluetooth LE device can have multiple services and the app in question may only be interested in a subset of them. Core Bluetooth allows for specific services to be discovered and its underlying characteristics discovered as well.
- [Instructor] So now that we've made a connection…to the peripheral, we want to continue the process…to discover the services that lead onto the characteristics.…So the first thing we'll do is we'll call…discoverServices in our didConnect callback…and from there, we'll get our peripheral…and set the delegate so that we can implement the callbacks…that we're going to receive through it,…the first one being didDiscoverServices.…And from there, we'll call discoverCharacteristics…and implement the didDiscoverCharacteristics.…From there we can check the UUID on the characteristic…to make sure it's the one we're interested in.…
We can also filter by the service UUID…in didDiscoverServices so that we're only…discovering the characteristics…of the services we're interested in.…So back in our code, we've connected to the peripheral.…And from here, we need to start discovering the services.…So we'll add a new line on line 36…and on the peripheral that we've discovered,…we'll call discoverServices.…So it's simply peripheral.discoverServices.…
- 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.