Bluetooth Low Energy Unveiled

Preview:

DESCRIPTION

Bluetooth Low energy silently appeared in all Apple hardware in the course of last two years, Android followed suit with API level 18. The session reviews the technology, the APIs and potential use cases.

Citation preview

Bluetooth Low EnergyUncovered

Gabe Gindele@barbazoo

Friday, October 18, 13

Tech Overview

• “A Better Bluetooth” - Power and Cost

• 4.0 - Single and Dual Mode

• 3 Advertising, 37 Data Channels

• Advertiser vs. Scanner

• Master vs. Slave

Friday, October 18, 13

Classic vs. Low Energy

• 100mW vs. 10mW power

• Connection Oriented vs. Connectionless

• Streaming Data vs. Small Data Bursts

• HCI API stays intact

Friday, October 18, 13

Tech Overview Cont.

Total Transaction Time: 3msFriday, October 18, 13

Apple and Bluetooth LE

• First to Introduce

• iPhone 4S, MBA, Mac Mini since 2011

• WWDC 2012 Sessions

• All Products Today - Apple TV

• Classic remains under MFA

• Opens new era of Sensors and IOT

Friday, October 18, 13

Devices Today

• Fitbit Flex

• Heart Rate monitors

• SmartWatches

• Proximity

• iBeacons

• Sensors

Friday, October 18, 13

GATT

• Service

• Characteristic

• Value

• Descriptors

• Notifications

• APIs are Asynchronous

Friday, October 18, 13

iOS: Discovery

central  =  [[CBCentralManagernager  alloc]  

initWithDelegate:self  queue:nil];

[central  scanForPeripheralsWithServices:nil  options:nil];

-­‐  (void)centralManager:(CBCentralManager  *)central

    didDiscoverPeripheral:(CBPeripheral  *)peripheral

  advertisementData:(NSDictionary  *)advertisementData

  RSSI:(NSNumber  *)RSSI  {}

[myCentralManager  stopScan];

Friday, October 18, 13

iOS: Connection

[myCentralManager  connectPeripheral:peripheral  options:nil];

-­‐  (void)centralManager:(CBCentralManager  *)central  didConnectPeripheral:(CBPeripheral  *)peripheral  {}

peripheral.delegate  =  self;

[peripheral  discoverServices:nil];[peripheral  discoverCharacteristics:nil    forService:...];

[peripheral  readValueForCharacteristic:...];[peripheral  setNotifyValue:YES  forCharacteristic:...;[peripheral  writeValue:...  type:CBCharacteristicWriteWithResponse]

Friday, October 18, 13

Android: BluetoothGatt

• Since 4.3 - API 18 - Most of new devices

• A new profile

• GATT Server is missing

Friday, October 18, 13

Android: Discovery

mBluetoothAdapter.startLeScan(mLeScanCallback);  

public  void  onLeScan(final  BluetoothDevice  device,  int  rssi,  byte[]  scanRecord)  {};

mBluetoothAdapter.stopLeScan(mLeScanCallback);

Friday, October 18, 13

Android: Connection

BluetoothGatt  mBtGatt  =  device.connectGatt(...  callback);

BluetoothGattCallback  callback  =  new  BluetoothGattCallback()  {

public  void  onConnectionStateChange(...)  {}public  void  onServicesDiscovered(...)  {}public  void  onCharacteristicRead(...)  {}public  void  onCharacteristicChanged(...)  {}

};

mBtGatt.setCharacteristicNotification(characteristic,  enabled);

onCharacteristicChanged(BluetoothGatt  gatt,    BluetoothGattCharacteristic)  {}

Friday, October 18, 13

iBeacon

• Best Kept Secret of iOS7

• Micro Locations Made Simple

• API extends CoreLocation - CLBeacon

• Broadcast only - UUID, Major, Minor

• Geofence, Passbook

Friday, October 18, 13

Development Tools

• TI CC2541 Sensor Tag

• BlueGiga BGScript and API

• Nordic nRF51922 with Cortex M0

• RadiusNetworks Android iBeacons SDK

Friday, October 18, 13

Questions?

Friday, October 18, 13

Recommended