bluetooth le: user experience with ios

23
1

Upload: globallogic-ukraine

Post on 16-Apr-2017

534 views

Category:

Software


1 download

TRANSCRIPT

Page 1: Bluetooth LE: User Experience with iOS

1

Page 2: Bluetooth LE: User Experience with iOS

2

Bluetooth LE:User experience with iOS

Serhii SuprunGlobalLogic Lviv iOS TechTalk16.11.2016

Page 3: Bluetooth LE: User Experience with iOS

3

Confidential

Radio transmit technology based on 2.4 to 2.485 GHzProtocols Initiated in 1989 (1.1 in 2002 and 5.0 in june 2016)Dr. Nils Rydbeck CTO at Ericsson Mobile and Dr. Johan Ullman Runes

What is Bluetooth ?

Page 4: Bluetooth LE: User Experience with iOS

4

Confidential

Runes

ᚼ and ᛒScandinavian runes

Page 5: Bluetooth LE: User Experience with iOS

5

Confidential

LE == Low Energy ?

Up to 4-5 years of work on one battery

- 1 Mbit/s (radio)

- 270 Kbit/s (application limit)

- 26 kbit/s (iOS-iOS my tests)

Page 6: Bluetooth LE: User Experience with iOS

6

Confidential

CentralClient

Peripheral

Server

iOS?

Who is who?

Page 7: Bluetooth LE: User Experience with iOS

7

Confidential

Device to CBPeripheral magic

CoreBluetooth

Page 8: Bluetooth LE: User Experience with iOS

8

Confidential

Red pill

Page 9: Bluetooth LE: User Experience with iOS

9

Confidential

Identifiers

Everything is uuid

128 bit (289ed316-defc-48de-8a74-2c9e854e5ab3)

16 bit ( 0xFE8B)

Page 10: Bluetooth LE: User Experience with iOS

10

Confidential

Discovery UUID is everything

func scanForPeripherals(withServices serviceUUIDs: [CBUUID]?, options: [String : Any]? = nil)func stopScan()

optional func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber)

CBCentralManager

CBCentralManagerDelegate

Page 11: Bluetooth LE: User Experience with iOS

11

Confidential

Connect: 1 connect CBCentralManager

func connect(_ peripheral: CBPeripheral, options: [String : Any]? = nil)func cancelPeripheralConnection(_ peripheral: CBPeripheral)

optional func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral)

CBCentralManagerDelegate

Page 12: Bluetooth LE: User Experience with iOS

12

Confidential

Connect: 2 services

CBPeripheral

func discoverServices(_ serviceUUIDs: [CBUUID]?)

optional func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?)

CBPeripheralDelegate

Page 13: Bluetooth LE: User Experience with iOS

13

Confidential

Connect: 3 characteristic

CBPeripheral

func discoverCharacteristics(_ characteristicUUIDs: [CBUUID]?, for service: CBService)

optional func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?)

CBPeripheralDelegate

Page 14: Bluetooth LE: User Experience with iOS

14

Confidential

Connect: 3 characteristic

CBPeripheral

func discoverCharacteristics(_ characteristicUUIDs: [CBUUID]?, for service: CBService)

optional func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?)

CBPeripheralDelegate

Page 15: Bluetooth LE: User Experience with iOS

15

Confidential

Data transfer

CBPeripheral

func readValue(for characteristic: CBCharacteristic)func writeValue(_ data: Data, for characteristic: CBCharacteristic, type: CBCharacteristicWriteType)

optional func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?)

CBPeripheralDelegate

Page 16: Bluetooth LE: User Experience with iOS

16

Confidential

Transfer speedPacketsConnection Interval Min ≥ 20 ms

Default MTU: 23 bytes

23*50 = 1150 bytes per second9200 bit per second

Max MTU: 512 bytes512*50 = 25600 bytes per second204800 bit per seconds (200 kbit/s)

128 kbit - low quality audio stream

Page 17: Bluetooth LE: User Experience with iOS

17

Confidential

Under the hood

Page 18: Bluetooth LE: User Experience with iOS

18

Confidential

iphone 6 to iphone 5s

average

bytestime interval (second) bytes/sec

82939 25.147522 3298.09831882939 24.842042 3338.65468982939 24.637974 3366.30763682939 24.557985 3377.27219982939 24.590379 3372.823168 bytes/sec kbit/s kbyte/s82939 25.016174 3315.415059 3344.761845 26.75809476 3.266368989

iphone 5s to iphone 687771 27.235893 3222.622442

average87771 26.602149 3299.39509887771 26.506242 3311.33323287771 26.216806 3347.89066287771 26.595411 3300.231006 bytes/sec kbit/s kbyte/s87771 26.41587 3322.661718 3300.689026 26.40551221 3.223329127

Experiments

Page 19: Bluetooth LE: User Experience with iOS

19

Confidential

Time between chunks

Page 20: Bluetooth LE: User Experience with iOS

20

Confidential

Problemaz - Pairing - Rename- Speed?

New in iOS 10?

Page 21: Bluetooth LE: User Experience with iOS

21

Confidential

Linkshttps://en.wikipedia.org/wiki/Bluetoothhttps://developer.apple.com/videos/play/wwdc2013/703/https://developer.apple.com/videos/play/wwdc2012/703/https://developer.apple.com/videos/play/wwdc2012/705/https://developer.apple.com/hardwaredrivers/BluetoothDesignGuidelines.pdfhttps://www.google.com

Page 22: Bluetooth LE: User Experience with iOS

22

Confidential

Questions please

Thanks

Page 23: Bluetooth LE: User Experience with iOS

23

Thank you