Академический Документы
Профессиональный Документы
Культура Документы
Session 712
© 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.
•
Introduction
•
Enhanced reliability
•
Platform support
•
L2CAP channels
•
Best practices
•
iBeacon
CBService CBService
CBCharacteristic CBCharacteristic
CBCharacteristic CBCharacteristic
CBCharacteristic CBCharacteristic
GATT Database
CBService CBService
CBCharacteristic CBCharacteristic
CBCharacteristic CBCharacteristic
CBCharacteristic CBCharacteristic
GATT Database
CBService CBService
CBCharacteristic CBCharacteristic
CBCharacteristic CBCharacteristic
CBCharacteristic CBCharacteristic
Reading Characteristics as a Central
/*
* @seealso CBCentralManagerRestoredStatePeripheralsKey;
* @seealso CBCentralManagerRestoredStateScanServicesKey;
* @seealso CBCentralManagerRestoredStateScanOptionsKey;
*
*/
optional public func centralManager(_ central: CBCentralManager, willRestoreState dict:
[String: Any])
CBPeripheralManager Restoration
/*
* @seealso CBPeripheralManagerRestoredStateServicesKey;
* @seealso CBPeripheralManagerRestoredStateAdvertisementDataKey;
*
*/
optional public func peripheralManager(_ peripheral: CBPeripheralManager,
willRestoreState dict: [String: Any])
State Preservation and Restoration NEW
State Preservation and Restoration NEW
New property will tell your app if more data can be sent
L2CAP Channels
•
L2CAP Connection Oriented Channels
CBService
CBCharacteristic
CBCentralManager
CBCharacteristic
CBCharacteristic
L2CAP Channels
CBL2CAPChannel CBL2CAPChannel
CBService
CBCharacteristic
CBCentralManager
CBCharacteristic
CBCharacteristic
Central Side L2CAP
/*!
* @const CBUUIDL2CAppSMCharacteristicString
* @discussion The PSM (a little endian uint16_t) of an L2CAP Channel associated with the
GATT service
* containing this characteristic. Servers can publish this characteristic with
the UUID
* ABDD3056-28FA-441D-A470-55A75A52553A
*/
public let CBUUIDL2CAppSMCharacteristicString: String
Peripheral Side L2CAP
MyService
MyData
CBCentralManager
Opening an L2CAP Channel
MyService
MyData
CBCentralManager
peripheral.publishL2CAPChannel(withEncryption: true)
Opening an L2CAP Channel
MyService
MyData
CBCentralManager
MyService
MyData
MyService
MyData
MyService
MyData
MyService
MyData
peripheral.openL2CAPChannel(PSM)
Opening an L2CAP Channel
CBL2CAPChannel CBL2CAPChannel
MyService
MyData
}
Stream Events
• Central close
• Peripheral unpublished
Lowest overhead
Best performance
Peripheral
Advertisement
Advertising
Central
Scanning
Time to Discover
Peripheral
Advertisement Advertisement Advertisement Advertisement
Advertising
Central
Scan Scan
Scanning
Connection Speed
central.connect(peripherals[0])
Service Discovery Speed
OtherData
MoreData
Software Version
PnP ID
CBService
CBCharacteristic
CBCharacteristic
CBCharacteristic
Service Discovery Speed
OtherData
MoreData
Software Version
PnP ID
CBService
CBCharacteristic
CBCharacteristic
CBCharacteristic
Service Discovery Speed
OtherData
MoreData
Software Version
PnP ID
Service Discovery Speed
PnP ID
OtherData
MoreData
Service Discovery Speed
PnP ID
OtherData
MoreData
Service Discovery Speed
PnP ID
OtherData
Use “Service Changed” MoreData
New Accessory Recommendations
GATT GATT
ATT ATT
L2CAP L2CAP
Controller Controller
Packet
Protocol Overhead
Application Application
GATT GATT
ATT ATT
L2CAP L2CAP
Controller Controller
Packet
Write With Response
Central
Peripheral
Interval
Interval
Interval
Write With Response
Central
Write
Peripheral
Response
Interval
Interval
Interval
Write With Response
Central
Peripheral
Interval
Interval
Interval
Write Without Response
Interval
Write Without Response
Interval
Write Without Response
Default MTU
37 kbps
Interval
Interval
Interval
Write Without Response
Default MTU
37 kbps
Interval
Interval
Interval
Write Without Response
Default MTU
37 kbps
Larger MTU
48 kbps
Interval
Interval
Interval
Fitting your data
Default MTU
37 kbps
Larger MTU
48 kbps
Interval
Interval
Interval
Write Without Response
Default MTU
37 kbps
Larger MTU
48 kbps
EDL
Interval
Interval
Interval
Write Without Response
Default MTU
37 kbps
Larger MTU
48 kbps
EDL
Interval
Interval
Interval
10x 10x 10x
135 kbps
Extended Data Length
Application Application
GATT GATT
ATT ATT
L2CAP L2CAP
Controller Controller
Packet
L2CAP Connection Oriented Channels
Application Application
L2CAP L2CAP
Controller Controller
197 kbps
Packet
Faster Connection Interval
L2CAP + EDL
Interval
Interval
Interval
Faster Connection Interval
L2CAP + EDL
394 kbps
Interval
Interval
Interval
Interval
Interval
Throughput (kbps)
Packed CE Length
Larger MTU
EDL
L2CAP + EDL
Packed CE Length
Larger MTU
EDL
L2CAP + EDL
Packed CE Length
Larger MTU
EDL
L2CAP + EDL
Packed CE Length 37
Larger MTU
EDL
L2CAP + EDL
Packed CE Length 37
Larger MTU 48
EDL
L2CAP + EDL
Packed CE Length 37
Larger MTU 48
EDL 135
L2CAP + EDL
Packed CE Length 37
Larger MTU 48
EDL 135
Packed CE Length 37
Larger MTU 48
EDL 135
Update your hardware (4.2 EDL, 5.0) for best performance and battery life
Wrap Up
•