Centrals will at times want to write to a given peripheral’s characteristic. Core Bluetooth also allows for this. When the appropriate callback is called with the given request, the app can check the UUID as a match and store the request’s value internally. Once finished, the successful message can be returned.
- [Instructor] We're seen how to read manually…from our new peripheral.…Well now we're going to look at how to…apply to subscriptions to the update notifications.…So we have to add the notify property to our characteristic.…That allows it to be set up for subscriptions…for the updates.…We'll implement the…peripheralManager callback: didSubscribeTo…whenever the central sets the notify value to true.…You could store the central that's specifically…subscribing to your updates and only send the updates…to that central, or any other central subscribing.…
If you want to set it to all the centrals,…you can just pass in nil.…So then we're going to send the update using the…peripheralManager function updateValue.…We'll pass in the value, the characteristic,…and whatever centrals we want to send the update to.…So looking at our code, we have our characteristic,…and the properties are just read.…We need to be able to set notify on that as well.…So on line 20, we'll create a constant for our properties…called props, that's a type CBCharacteristic,…
- 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.