ble boise codecamp

15
Starting Starting momentarily... momentarily...

Upload: chip-keyes

Post on 25-Jun-2015

598 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Ble boise codecamp

Starting momentarily...Starting momentarily...

Page 2: Ble boise codecamp

Nordic RegionNordic Region

Bluetooth 4.0 Low Bluetooth 4.0 Low Energy Device ScannerEnergy Device Scanner

An iOS Core Bluetooth An iOS Core Bluetooth ApplicationApplication

Discover, connect, and use Discover, connect, and use Bluetooth 4.0 devicesBluetooth 4.0 devices

Bluetooth Low Energy is Bluetooth Low Energy is also available on Samsung also available on Samsung Galaxy S III and the Galaxy S III and the Windows Surface Tablet.Windows Surface Tablet.

Bluetooth Low Energy is Bluetooth Low Energy is also available on Samsung also available on Samsung Galaxy S III and the Galaxy S III and the Windows Surface Tablet.Windows Surface Tablet.

King Harald King Harald BluetoothBluetooth GormssonGormssonKing Harald GormssonKing Harald Gormsson

Boise Code Camp Boise Code Camp 20132013

Presenter: Chip KeyesPresenter: Chip [email protected]

Page 3: Ble boise codecamp

Newer Bluetooth technology distinct from classic Newer Bluetooth technology distinct from classic BluetoothBluetooth

Designed for low cost, low power consumption, Designed for low cost, low power consumption, and extremely high deployment volumesand extremely high deployment volumes

Internet of Things, Personal Area NetworksInternet of Things, Personal Area Networks

Devices typically powered by button cell Devices typically powered by button cell batteriesbatteries

Low data rate Low data rate (<0.3Mbps) [Contrast with 54Mbps v3.0](<0.3Mbps) [Contrast with 54Mbps v3.0]

Operating ranges are “close proximity” Operating ranges are “close proximity” typically less than 40 meters (dependent typically less than 40 meters (dependent upon link budget)upon link budget)

Bluetooth Low EnergyBluetooth Low Energy

Page 4: Ble boise codecamp

BLE 4.0 Demo DevicesBLE 4.0 Demo Devices

TI CC2540 Key FobTI CC2540 Key Fob

60beat Bluetooth Heart Rate 60beat Bluetooth Heart Rate MonitorMonitor

???? New device type!New device type!

Page 5: Ble boise codecamp

Bluetooth ArchitectureBluetooth Architecture

AppsApps

HostHost

ControllerController

Direct TestDirect TestDirect TestDirect TestPhysical Layer Physical Layer (Radio)(Radio)Physical Layer Physical Layer (Radio)(Radio)

Link Layer Link Layer (advertising, scanning, connections)(advertising, scanning, connections)Link Layer Link Layer (advertising, scanning, connections)(advertising, scanning, connections)

Host Controller InterfaceHost Controller InterfaceHost Controller InterfaceHost Controller Interface

Logical Link Control & Adaptation ProtocolLogical Link Control & Adaptation ProtocolLogical Link Control & Adaptation ProtocolLogical Link Control & Adaptation Protocol

Attribute ProtocolAttribute ProtocolAttribute ProtocolAttribute Protocol SecuritySecuritySecuritySecurity

Generic Attribute ProtocolGeneric Attribute ProtocolGeneric Attribute ProtocolGeneric Attribute Protocol

Generic Access ProtocolGeneric Access ProtocolGeneric Access ProtocolGeneric Access Protocol

ApplicationsApplicationsApplicationsApplicationsTodayToday!!

TodayToday!!

Multiplexing Layers Multiplexing Layers &&

SecuritySecurity&&

ProtocolsProtocols

Software AbstractionSoftware Abstraction

Page 6: Ble boise codecamp

Bluetooth 4.0 Usage Bluetooth 4.0 Usage ModelModel

Functionality ProviderFunctionality ProviderFunctionality UserFunctionality User

DeviceDevice

PeripheralPeripheralServerServer

UserUserClientClient

CentralCentral

Sophisticated UISophisticated UI Little or No UI*Little or No UI*

AdvertiseAdvertise

DiscoverDiscover

InteractInteract

Manifested in codeManifested in code

MasterMaster SlaveSlave

Page 7: Ble boise codecamp

Servers Deliver Functionality via Servers Deliver Functionality via ServicesServices

PeripheralPeripheral

ServicesServices

CharacteristicCharacteristicss

DescriptoDescriptorsrs

NN

NN

NN

1 to N1 to N

1 to N1 to N

1 to N1 to N

Heart Rate ServiceHeart Rate Service

Device Information Device Information ServiceService

Heart Rate Heart Rate MeasurementMeasurement

Model Number StringModel Number String

Extended Properties, Extended Properties, Configuration, etc.Configuration, etc.

UUID - Universally Unique UUID - Universally Unique IdentifiersIdentifiers

(16 or 128 bits) identify (16 or 128 bits) identify Services and CharacteristicsServices and Characteristics

Registered CharacteristicsRegistered Characteristics

Registered ServicesRegistered Services

**ProfilesProfiles are services are services working together according working together according to a specification.to a specification.

Page 8: Ble boise codecamp

iOS Core Bluetooth FrameworkiOS Core Bluetooth Framework

Principal ClassesPrincipal Classes

CBCentralManager & delegate (Client support)CBCentralManager & delegate (Client support)

CBPeripheral & delegate (represents device)CBPeripheral & delegate (represents device)

CBService (a service on the device)CBService (a service on the device)

CBCharacteristic (a characteristic supporting a service)CBCharacteristic (a characteristic supporting a service)

Characteristics can be of type read, write, or Characteristics can be of type read, write, or notification/indication notification/indication

Notifications are events which clients can Notifications are events which clients can subscribe to which result in “pushed” updates subscribe to which result in “pushed” updates from the serverfrom the server

Page 9: Ble boise codecamp

Last Prep Slide!Last Prep Slide!

Objective-CObjective-C

syntax for demo code syntax for demo code

[receiver message][receiver message]

receiver is the “object”receiver is the “object”

message is the method invoked on the objectmessage is the method invoked on the object

C#/Java analagous expression: object.methodC#/Java analagous expression: object.method

Objective-C also uses dot notation convention when accessing Objective-C also uses dot notation convention when accessing properties of an objectproperties of an object

properties = C#/Java fieldsproperties = C#/Java fields

Objective-C Interfaces analagous to C#/Java ClassesObjective-C Interfaces analagous to C#/Java Classes

Objective-C Protocols analgous to C#/Java InterfacesObjective-C Protocols analgous to C#/Java Interfaces

Lastly Objective-C self equivalent to C#/Java thisLastly Objective-C self equivalent to C#/Java this

Page 10: Ble boise codecamp

iOS Devices Can Be Peripherals in iOS Devices Can Be Peripherals in iOS 6.0!iOS 6.0!

Functionality ProviderFunctionality ProviderFunctionality UserFunctionality UserAdvertiseAdvertise

DiscoverDiscover

InteractInteract

iPhone/iPad on both sides of the connectioniPhone/iPad on both sides of the connectionDemo - TI Key Fob SimulatorDemo - TI Key Fob Simulator

Demo - Heart Rate Monitor SimulatorDemo - Heart Rate Monitor Simulator

Page 11: Ble boise codecamp

Bluetooth Low Energy PicoNetsBluetooth Low Energy PicoNets

CCCC

PPPP PPPP PPPP

C = Central/MasterC = Central/MasterP = Peripheral/SlaveP = Peripheral/Slave

CCCC

PPPP

Not Currently PermittedNot Currently Permitted

Page 12: Ble boise codecamp

ResourcesResourcesCode Camp Demo CodeCode Camp Demo Code

https://github.com/chipk215/ble_scanner

https://github.com/chipk215/keyfobsimhttps://github.com/chipk215/keyfobsim

Bluetooth Low Energy Web Site Bluetooth Low Energy Web Site

http://www.bluetooth.com/Pages/low-energy.aspx

Bluetooth Low Energy Specification:Bluetooth Low Energy Specification:

https://www.bluetooth.org/Technical/Specifications/adopted.htm (Core Version 4.0)(Core Version 4.0)

StackOverflow StackOverflow core-bluetooth, bluetooth-lowenergy tagscore-bluetooth, bluetooth-lowenergy tags

http://stackoverflow.com

Page 13: Ble boise codecamp

ResourcesResources

TechBasic - A BASIC environment for iOS TechBasic - A BASIC environment for iOS available in the app store which provides an available in the app store which provides an Bluetooth Low Energy API. Educational friendly Bluetooth Low Energy API. Educational friendly projects.projects.

http://www.byteworks.us/Byte_Works/http://www.byteworks.us/Byte_Works/techBASIC.htmltechBASIC.html

Lots of well documented sample code. No Lots of well documented sample code. No Apple Development license or Xcode Apple Development license or Xcode environment required. Download program environment required. Download program files to the device using iTunes. files to the device using iTunes.

Page 14: Ble boise codecamp

ResourcesResources

iTunes University - Stanford CS193p iTunes University - Stanford CS193p

Coding Together: Developing Apps for iPhone Coding Together: Developing Apps for iPhone and iPad (Winter 2013 Latest Offering)and iPad (Winter 2013 Latest Offering)

This course significantly accelerated my iOS This course significantly accelerated my iOS indoctrination. It is fun, there are guest indoctrination. It is fun, there are guest lecturers, and the assignments are always lecturers, and the assignments are always interesting!interesting!

Page 15: Ble boise codecamp

Local ResourcesLocal Resources

Boise Cocoa HeadsBoise Cocoa Heads

contact Ron Adams (contact Ron Adams ( [email protected]

http://cocoaheads.org/us/BoiseIdaho/index.html

googleGroup: googleGroup: http://bit.ly/cocoaHeadsBoise

meetingLocation: meetingLocation: http://goo.gl/maps/80eiQ

http://twitter.com/cocoaheadsboisehttp://twitter.com/cocoaheadsboise

http://cocoaheads.tvhttp://cocoaheads.tv