As a central needs to know about a peripheral’s characteristics, a peripheral needs to have characteristics to house the values. Core Bluetooth provides the necessary classes to facilitate creating characteristics with the desired UUID, value and properties. Once created, the characteristics can be set on the similarly created service.
- [Instructor] So now that we've created…our service in our peripheral,…we need to add a characteristic to it.…Reading and writing data to and from a peripheral is…really the whole point of Bluetooth communication.…That's all done through the characteristics…as we've seen before using our central.…And this is where we'll create ours for our peripheral.…We'll create the characteristic in a way…that's similar to creating a service.…We'll use the class CBMutableCharacteristic…and we'll use a UUID to specify…the characteristic's identity.…
We have to set the permissions and properties…on the characteristic so we know…if it's readable, writeable, and notifiable.…Then we'll add it to the service…that's already being advertised.…So in our peripheral code, we'll add one more property…for the characteristic.…So on line 41, I'll type var, myChar for the characteristic,…and it's type CBMutableCharacteristic.…I'll make it an optional.…Then up in the code where I create the service…in the peripheral manager did update state.…
- 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.