Skip to content

Latest commit

ย 

History

History
345 lines (213 loc) ยท 13.1 KB

Whats-New-in-Core-Bluetooth.md

File metadata and controls

345 lines (213 loc) ยท 13.1 KB

What's New in Core Bluetooth

๐Ÿ“… 2020.6.11 (THU)

๐Ÿ—‚ WWDC2019 | Session : 901 | Category : System Frameworks

๐Ÿ”— https://developer.apple.com/videos/play/wwdc2019/901/

๐Ÿ”– Learn how to adopt privacy-enhancing changes in Core Bluetooth. Discover new possibilities with LE 2Mbps, advertising extensions, BR/EDR, and dual-mode devices. Understand how to debug your Core Bluetooth communication with the improvements to PacketLogger.


/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled.png

์ด๋ฒˆ ํ•ด์— Core Bluetooth ๊ฐ€ BR/EDR ๋””๋ฐ”์ด์Šค๋ฅผ ์ง€์›ํ•˜๋„๋ก ์ถ”๊ฐ€ ๋˜์—ˆ๋‹ค.

Core Bluetooth ๊ฐ€ ์–ด๋–ค transport ์—์„œ ์ž‘๋™ ๋˜๋Š”์ง€์— ์ƒ๊ด€ ์—†์ด ๋ชจ๋“  Bluetooth ๋””๋ฐ”์ด์Šค์— ๋„๋‹ฌํ•˜๊ณ  ์ƒํ˜ธ์ž‘์šฉ ํ•  ์ˆ˜ ์žˆ๋‹ค๋Š” ๊ฒƒ์„ ์˜๋ฏธ ํ•œ๋‹ค.

๏ฃฟ Low Energy 2 Mbps ๏ฃฟ

๐Ÿ†• LE 2 Mbps

  • New feature in Bluetooth 5.0
  • Physical layer rate increased from 1 Mbps to 2Mpbs between compatible devices โ†’ Core Bluetooth ๊ฐ€ ๊ฐ™์€ airtime ์— ๋‘๋ฐฐ๋ฅผ ์ „์†ก ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜์—ˆ๋‹ค.
  • Faster and more power efficient connection
  • Transparent to the application
  • Accessories must support LE 2 Mbps
  • Available starting with iPhone 8, Apple TV 4K, Apple Watch Series 4

LE 2 Mbps Throughput

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%201.png

๏ฃฟ Advertising Extensions ๏ฃฟ

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%202.png

  • Bluetooth 5.0 feature
  • ์ž‘์€ payload๋ฅผ ์ „์†กํ•จ์œผ๋กœ์จ 3 ๊ฐœ์˜ advertising channel ์˜ ํ˜ผ์žก๋„๋ฅผ ์ค„์˜€๋‹ค.
  • ๋” ํฐ payload๋ฅผ ์ „์†กํ•˜๊ธฐ ์œ„ํ•ด ๋” ๋„“์€ data channel๋กœ ๋ณด๋‚ธ๋‹ค.
  • 31์—์„œ 255byte ๋กœ ์ƒ์Šนํ–ˆ๊ณ , LE์—์„œ ์ „์†ก ๋น„์œจ์ด 2 Mbps ์ด๋‹ค.

๐Ÿ†• Extended Scan

  • Scans for extended advertisements

  • Accessories must support extended advertisements with LE 2 Mbps

  • Support extended advertisement payload up to 124 bytes

  • 4 times that advertisement data that an accessory can send today

  • Transparent to application

  • New API to query for platform support

    class func supports(_ features: CGCentralManager.Feature) -> Bool 
    static var extendedScanAndConnect: CGCentralManager.Feature { get }
     
  • Supports connections to connectable extended advertisements

  • Improves existing connection exchange protocol

๐Ÿ†• Legacy Connections

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%203.png

  1. Advertiser ๋Š” ์—ฐ๊ฒฐ ๊ฐ€๋Šฅํ•œ advertisement ๋ฅผ ํ†ต์ง€
  2. Scanner ๊ฐ€ ์—ฐ๊ฒฐ์„ ์›ํ•œ๋‹ค๋ฉด connection identification ์ „์†ก
  3. ACK ๋Š” ์—†์Œ
  4. Scanner ๋Š” connection indication ์ด advertiser์—๊ฒŒ ๋„๋‹ฌํ–ˆ๋‹ค๊ณ  ๊ฐ€์ •
  5. host processor ์—๊ฒŒ ์ƒˆ๋กœ์šด connection์ด ์žˆ๋‹ค๊ณ  ์•Œ๋ ค์คŒ

ํ•˜์ง€๋งŒ RF characteristic ์ด ์„œ๋กœ ๋‹ค๋ฅผ ์ˆ˜ ์žˆ๊ณ  RF environment ๊ฐ€ ๋งค์šฐ ๋™์ ์ด๊ธฐ ๋•Œ๋ฌธ์—connection indication ์ด advertiser ์—๊ฒŒ ๋„์ฐฉํ•˜์ง€ ๋ชปํ•  ์ˆ˜ ๋„ ์žˆ์Œ

โ†’ ์ด ๊ณผ์ •๋“ค์ด ๋ฒ ํ„ฐ๋ฆฌ๋ฅผ ๋” ๋งŽ์ด ์†Œ๋ชจํ•˜๊ฒŒ ํ•จ

๐Ÿ†• Extended Connections

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%204.png

  1. Advertiser ๋Š” ์—ฐ๊ฒฐ ๊ฐ€๋Šฅํ•œ extended advertisement ๋ฅผ ํ†ต์ง€
  2. Scanner ๋Š” connection request ๋ฅผ ์ „์†ก ๊ฐ€๋Šฅ
  3. Advertiser ๋Š” explicit connection response ๋ฅผ ์ „์†ก
  4. Scanner ๊ฐ€ connection response ๋ฅผ ๋ฐ›์•˜์„ ๋•Œ๋งŒ ์ƒˆ๋กœ์šด connection์ด ์žˆ๋‹ค๊ณ  host processor ๋ฅผ ๊นจ์›€
  5. connection ์ด link layer negotiation ๋“ค์„ ์ƒ๋žต ํ•˜๊ณ  LE 2 Mbps ๋กœ ์‹œ์ž‘ ํ•  ์ˆ˜ ์žˆ์Œ

๏ฃฟ Core Bluetooth for BR/EDR ๏ฃฟ

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%205.png

GATT

  • hierach-based ์ธ Bluetooth SIG ํ”„๋กœํ† ์ฝœ
  • service ์™€ characteristics ๋กœ ๊ตฌ์„ฑ
  • read, write, characteristics ์˜ ๋ณ€ํ™”์— ๋Œ€ํ•œ ๋…ธํ‹ฐ๊ฐ€ ๋งค์šฐ ์‰ฌ์›€

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%206.png

System profile ์ด๋‚˜ audio, A2DP, HFP remote-control profile ๋“ค์„ ์‹œ์Šคํ…œ์—์„œ ์ž‘๋™ ์‹œํ‚จ๋‹ค.

๋ฐ˜๋Œ€ ์ชฝ์—์„  Low Energy์˜ ๊ฒฝ์šฐ Core Bluetooth ๋ฅผ GATT ์œ„์—์„œ ๊ตฌ๋™ํ•˜๊ณ , ๊ทธ ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ accessories ์—์„œ interface๋กœ ์‚ฌ์šฉ ํ•œ๋‹ค.

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%207.png

๋‘ layer ๋ฅผ ํ•ฉ์ณค๊ณ , ์ด์ œ BR/EDR ๊ณผ Low Energy ๋ชจ๋‘ transparent access ๊ฐ€๋Šฅํ•˜๋‹ค.

API ์˜ ๋งŽ์€ ๋ณ€ํ™” ์—†์ด classic devices ์™€ low energy device ๋ชจ๋‘ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•ด์ง„ ๊ฒƒ์ด๋‹ค.

  • Use Core Bluetooth with BR/EDR Bluetooth devices
  • Bluetooth SIG GATT protocol running over BR/EDR
  • Same CBPeripheral APIs
  • New API in CBCentralManager
  • Available today with latest iOS, watchOS, tvOS
  • Add support to your accessory

๐Ÿ†• Registering for Connection Events

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%208.png

connection events ๋ฅผ ๋“ฑ๋ก ํ•˜๊ธฐ ์œ„ํ•œ API

Connection Event

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%209.png

Incoming Connection

Initialization

private var central: CBCentralManager!
central = CBCentralManager(delegate: self, queue: nil)

Registration

let matchingOptions = [CGConnectionEventMatchingOption.serviceUUIDs : [myServiceUUID]]

central.registerForConnectionEvents(options: matchingOptions)

Discover

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2010.png

Connect / Pair

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2011.png

Delegate Callback

// Connection Event
func centralManager(_ central: CBCentralManager,
										connectionEventDidOccur event: CGConnectionEvent,
										for peripheral: CBPeripheral_ {
	
	// Handle connection event

}

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2012.png

Outgoing Connection

Connection Out

private var central: CBCentralManager?
central = CBCentralManager(delegate: self, queue: nil)

central?.connect(myPeripheral, option: nil)

BR/EDR Page

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2013.png

Connected

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2014.png

๏ฃฟ Core Bluetooth for dual-mode ๏ฃฟ

Improving Dual-Mode Pairing

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2015.png

๐Ÿ†• Cross Transport Key Derivation

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2016.png

Instead of Inquiry

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2017.png

์œ ์ €๊ฐ€ ๋ธ”๋ฃจํˆฌ์Šค ๋ฐœ๊ฒฌ๊ณผ ํŽ˜์–ด๋ง ์ „์ฒด๋ฅผ ์ œ์–ด๋ฅผ ์›ํ•  ๋•Œ, ๋„ˆ์˜ ์•ฑ ๊ฒฝํ—˜์„ ๋ฐฉํ•ดํ•˜๋Š” ๋ธ”๋ฃจํˆฌ์Šค ์„ค์ •์— ๊ฐ€์„œ inquiry scan ์„ ํ•˜๋Š” ๋Œ€์‹ ์—, ์•ก์„ธ์„œ๋ฆฌ๋กœ ๋ถ€ํ„ฐ low energy scan ์„ ์ฐพ์„ ์ˆ˜ ์žˆ๋‹ค.

Low Energy Scan

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2018.png

CTKD - Pairing

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2019.png

๋งŒ์•ฝ ๋””๋ฐ”์ด์Šค๋ฅผ ์ฐพ์•˜๋‹ค๋ฉด, LE ๋ฅผ ํ†ตํ•ด ์—ฐ๊ฒฐ ํ•˜๊ณ  protective characteristic ์— ์ ‘๊ทผ ํ•  ์ˆ˜ ์žˆ๋‹ค.

Key Derivation

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2020.png

์ผ๋‹จ ํŽ˜์–ด๋ง์ด ๋˜๋ฉด, CTKD ๋กœ ์ธํ•ด LE key ๋ฅผ ๊ฐ–๊ฒŒ ๋˜๊ณ , BR/EDR key ๋˜ํ•œ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ๋‹ค.

CTKD - BR/EDR Connected

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2021.png

์ด๊ฒƒ์€ ์ด์ œ ๋„ˆ๊ฐ€ ์œ ์ €๋ฅผ ํ˜ผ๋ž€์Šค๋Ÿฝ๊ฒŒ ํ•˜๋Š” ํŽ˜์–ด๋ง์„ ํŠธ๋ฆฌ๊ฑฐ ํ•  ํ•„์š” ์—†์ด, ์•ฑ์—์„œ ์ „์ฒด ๊ฒฝํ—˜์„ ํ•  ์ˆ˜ ์žˆ๋„๋ก ๋จธ๋ฌผ๋ฉด์„œ BR/EDR ์—ฐ๊ฒฐ์„ ํ•  ์ˆ˜ ์žˆ๋‹ค๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•œ๋‹ค.

Improving Dual-Mode Connections

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2022.png

ํ™ˆ ์˜ค๋””์˜ค ๋””๋ฐ”์ด์Šค๋ฅผ ์ƒˆ๋กœ ์ถœ์‹œ ํ•œ๋‹ค๊ณ  ์ƒ๊ฐํ•ด๋ณด์ž. ๊ทธ๋ฆฌ๊ณ  ๋””๋ฐ”์ด์Šค๋Š” ๋ฎค์ง ์ด๋‚˜ ํŒŸ์บ์ŠคํŠธ ๊ฐ™์€ ๋ฏธ๋””์–ด๋ฅผ ์•ฑ์„ ํ†ตํ•ด ์—ฐ๊ฒฐ ํ•œ๋‹ค๋ฉด ์ข‹์„ ๊ฒƒ์ด๋‹ค.

iOS ๋Š” BR/EDR ์ด๋ผ๋Š” ์ฑ„๋„์„ ๋งŒ๋“ค์–ด ์ค„ ๊ฒƒ์ด๋‹ค.

๐Ÿ†• Bridging

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2023.png

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2024.png

BR/EDR Connection์„ ์ „๋‹ฌ ํ•˜๋ฉด, low energy ๋ฅผ ํ†ตํ•ด ๋””๋ฐ”์ด์Šค์™€ ์—ฐ๊ฒฐํ•˜๊ณ , ๋งŒ์•ฝ ๋ฐœ๊ฒฌํ•˜๋ฉด ์ฆ‰์‹œ BR/EDR ์„ ํ†ตํ•ด ๊ฐ€๋Šฅํ•œ ๋งŽ์€ profile ๊ณผ ์—ฐ๊ฒฐ ํ•  ๊ฒƒ์ด๋‹ค.

์œ ์ €๋Š” ๋Š๊น€ ์—†์ด ๋ชจ๋“  ๋ฉ€ํ‹ฐ๋ฏธ๋””์–ด profile ์„ ์‚ฌ์šฉ ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋œ๋‹ค.

๏ฃฟ Privacy Update ๏ฃฟ

Enhancements

  • User authorization
  • Accessory notifications

User Authorization

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2025.png

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2026.png

Adoption

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2027.png

  1. ์œ ์ €์—๊ฒŒ ๋„ˆ์˜ ์•ฑ์ด ์™œ ๋ธ”๋ฃจํˆฌ์Šค์— ์ ‘๊ทผ์ด ํ•„์š”ํ•œ์ง€ ์ „๋‹ฌํ•ด์•ผ ํ•œ๋‹ค.
  2. ๊ทธ๊ฒƒ์€ ์˜๋ฌด์ ์ธ String ์ด๊ณ  ์ ์šฉํ•˜์ง€ ์•Š๋Š”๋‹ค๋ฉด ์•ฑ์ด ์‹คํ–‰ ํ•  ๋•Œ ํฌ๋ž˜์‹œ๊ฐ€ ๋‚œ๋‹ค.
  3. ์•ฑ ๋ฆฌ๋ทฐ ํ”„๋กœ์„ธ์Šค์—์„œ ๋ชจ๋“  description ์ด ๋น„์–ด์žˆ์ง€ ์•Š๊ณ  ์˜๋ฏธ ์žˆ๋Š”์ง€ ํ™•์ธ ํ•œ๋‹ค.

New property

var authorization: CBManagerAuthorization { get }

enum CBManagerAuthorization: Int {
	init?(rawValue: Int)
	var rawValue: Int { get }
	case notDetermined
	case restricted
	case denied
	case allowedAlways
}

Flow

func centralManagerDidUpdateState(_ central: CBCentralManager)
func peripheralManagerDidUpdateState(_ peripheral: CBPeripheralManager)

open var state: CBManagerState { get }

// if ( state == CBManagerState.unauthoized)
open var authorization: CBManagerAuthorization { get }

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2028.png

Accessory Notifications

  • Apple Notification Center Service (ANCS)
  • GATT server servcie
  • Allows accessories to receive notifications from iOS

ANCS Privacy Update

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2029.png

New ANCS Privacy API

public let CBConnectPeripheralOptionRequiresANCS: String

optional func centralManager(_central: CGCentralManager, ddidUpdateANCSAuthorizationFor
														peripheral: CBPeripheral)

open var ancsAuthorized: Bool { get }

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2030.png

๏ฃฟ Core Bluetooth PacketLogger ๏ฃฟ

OverView

  • Bluetooth packet analysis application
  • Visualizer for packet logs inside sysdiagnose
  • Decode all protocols defined by Bluetooth SIG and Apple
  • Rich filtering options
  • Search by text or regex
  • Comment and flag packets
  • Export raw data for analysis

Top Level View

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2031.png

ACI, ATT ํ”„๋กœํ† ์ฝœ๋งŒ ํ•„ํ„ฐ๋ง ํ•  ์ˆ˜ ๋„ ์žˆ๊ณ , ๋ˆ„๋ฅด๋ฉด ๊ฐ๊ฐ์˜ ํŒจํ‚ท์— ๋Œ€ํ•ด ์ „์ฒด ํ”„๋กœํ† ์ฝœ ๊ณ„์ธต์„ ๋ณผ ์ˆ˜๋„ ์žˆ๋‹ค.

Hierarchical View

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2032.png

raw bytes ๊นŒ์ง€ ๊ฐ๊ฐ์˜ ํ”„๋กœํ† ์ฝœ์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค

๐Ÿ†• Live Capture

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2033.png

๋งฅ์— ์—ฐ๊ฒฐ ๋œ iOS ๋””๋ฐ”์ด์Šค์— login profile ์„ ์„ค์น˜ํ•˜๊ณ , PacketLogger ์„ ์‹คํ–‰ ํ•˜๋ฉด, iOS ๋””๋ฐ”์ด์Šค์—์„œ ์•ก์„ธ์„œ๋ฆฌ๋กœ live Bluetooth traffic ์„ capture ํ•  ์ˆ˜ ์žˆ๋‹ค. ๋˜ํ•œ ์—ฌ๋Ÿฌ๊ฐœ์˜ iOS ๋””๋ฐ”์ด์Šค๋ฅผ ์—ฐ๊ฒฐ ํ•  ์ˆ˜๋„ ์žˆ๋‹ค.

/WWDC2019/images/Whats-New-in-Core-Bluetooth/Untitled%2034.png