Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Watch your Bluetooth! - Singapore iOS Dev Scout May 2018 Meetup

Watch your Bluetooth! - Singapore iOS Dev Scout May 2018 Meetup

This talk is definitely not about hacking Bluetooth. Core Bluetooth has arrived to Apple Watch. Just watch what your Watch can do!

https://engineers.sg/video/watch-your-bluetooth-ios-dev-scout--2640

Maciej Piotrowski

May 30, 2018
Tweet

More Decks by Maciej Piotrowski

Other Decks in Technology

Transcript

  1. Bluetooth Low Energy (BLE) • low energy consump0on • client

    - server architecture • services and characteris0cs
  2. Core Bluetooth class CBCentral {} class CBPeripheral {} class CBCentralManager

    {} class CBPeripheralManager {} class CBService {} class CBCharacteristic {} class CBUUID {}
  3. Bird Central & Bird Service • CBService - Bird •

    CBCharacteristic - name • CBCharacteristic - color • CBCharacteristic - alpha
  4. Bird Values • CBService - Bird • UTF-8 String •

    #hex as UTF-8 String • Int as UTF-8 String
  5. Bird Service UUIDs enum BirdService { static let uuid =

    CBUUID(string: "B7AC06DC-09FF-40ED-B03A-55D09B08EB4A") static let colorUUID = CBUUID(string: ! " #) static let nameUUID = CBUUID(string: ! " #) static let alphaUUID = CBUUID(string: ! " #) static let characteristics: [CBUUID] = [ colorUUID, nameUUID, alphaUUID ] }
  6. Bird Peripheral • ADVERTISE Bird Service • respond to READ

    requests • NOTIFY subscribers - value updates
  7. Bird Central • SCAN for BirdService • DISCOVER its characteris7cs

    • READ their values • SUBSCRIBE for updates of values
  8. Recap • watchOS 4 + CoreBluetooth (CBCentralManager) = • ✅

    unit tests - helped with design • BirdCentral - portable code • iOS # • watchOS ⌚ • macOS % • tvOS &
  9. Links • Watch your Bluetooth - demo source code on

    Github • Core Bluetooth - documenta8on changes • WWDC 2017 - 712 - What's New in Core Bluetooth • WWDC 2017 - 205 - What's New in watchOS • Apple - Bluetooth for Developers • swiIing.io - #Core Bluetooth • Bluetooth - official website
  10. Core Bluetooth on watchOS • central mode only • peripherals

    disconnected on app suspension • connect 2 peripherals simultaneously