jam805 - beyond the device

32
Beyond the Device Extending the Device Experience with Wireless Peripherals JAM805 John Murray, Ranbijay Kumar September 26-27, 2013 1

Upload: dr-ranbijay-kumar

Post on 21-Jan-2017

156 views

Category:

Presentations & Public Speaking


0 download

TRANSCRIPT

Beyond the Device Extending the Device Experience with Wireless Peripherals JAM805 John Murray, Ranbijay Kumar September 26-27, 2013

1

Agenda

2

Introduc)on  

What’s  it  all  about?  

NFC  

WiFi  Direct  

Bluetooth  Low  Energy  

What’s it all about?

3

The Future!

“Wearables and connectables will herald a fast-changing local network of customer context. Devices worn on or near the body that sense and relay information will be embedded in clothing, accessories, and even the body itself.17 First-generation wearables like the Nike+ FuelBand and Fitbit will give way to internal biomedical instruments, shoes that generate power to recharge devices, and golf clubs that provide swing telemetry. Connectable home alarm systems, automobiles, and scales will function in a similar way. Developers will tap into these new information sources, with a phone or tablet acting as a local combination of router and remote-control device. Client-side developers will release updates faster than ever to dynamically add support for new devices in the extended local network.”

4 Source: Forrester Research Inc.: “The Future of Mobile Application Development” 2013

Imagine!!

�  Your home anticipates your arrival since it’s in contact with your smart phone

�  On arriving home you unlock your door using your smart phone

5

�  Lights and heating are automatically adapted when rooms detect that they are occupied.

�  Control and manage household services such as heating, lighting, blinds, security, entertainment and data

�  Lights and heating automatically turn down when rooms are vacated and everything can be switched off with one button on leaving.

Crazy? ... No!

6

Potential Experience: Fitness

�  Fitness app connects to running shoes via Bluetooth LE �  Notification received in Hub via Push from a Fitness BBM

Channel �  “Flash Special: Log a 5km+ run in the next 24 hours and get 20% off your

next purchase online” �  Your run is tracked and analyzed using Bluetooth LE and LBS �  Fitness app’s Scoreloop integration notifies user

�  “You’re in 2nd place this week at 21km total! 4km more and you’ll be on top of the leaderboard”

�  Achievement gets posted via Share to social media and with BBM trophy avatar

�  Minimized app motivates you to run more (Active Frames): �  “4km more and you’ll be the winner”

7

Other Potential Experiences!

�  Sports equipment with sensors – how about this Basketball?

8

�  Location aware beacons �  Indoor Navigation (e.g.

Museum Tour) �  In-store marketing/

payment

Limited only by ...

�  ... your imagination �  BlackBerry 10 has all the

capabilities you need to start exploring this area as a developer

�  Let’s take a look in more detail

9

NFC

We cover NFC in Session JAM803

10

What can I do with NFC? �  Enable users to interact securely and efficiently with their environment

�  Tap to share; Tap to pair; Tap to pay; Tap to access; Tap to…

�  Smart Tags: Tags can give the user information or automate common tasks

�  Tag reading and writing is supported

�  Tag Emulation: Tag functionality can also be replicated by the phone’s NFC antenna

�  Ticketing and Access: Allow users to gain access to workplaces, secure areas, theatres, events, trains, buses etc. �  BlackBerry - first phones to be HID-enabled, replacing security access badges

�  Data Exchange: Exchange pictures, messages or electronic items between devices

�  Automatically configure/connect devices by tapping them together

11

WiFi Direct

12

13

•  Peer-to-peer Wi-Fi connection without the need for wireless access points (APs)

•  Typically short-lived, application-controlled connections for a specific purpose

•  One device acts as Wi-Fi Direct Group Owner (GO) others are Group Clients

•  Backward compatible with existing Wi-Fi devices (GO looks like an AP to legacy devices)

•  Security is WPA2 Personal using Wi-Fi Protected Setup: Push Button or PIN-based

•  Simply establishes an IP connection on which services can run •  & Share)

Wi-Fi Direct – What is it?

14

•  BlackBerry Tag NFC-initiated file transfer uses Direct for faster performance •  File sharing also offers Wi-Fi Direct

•  Mobile Hotspot operates as Wi-Fi Direct Group Owner •  Saves battery when all clients are Direct-capable

•  DEMO!

Wi-Fi Direct – Use Cases

Bluetooth Low Energy

15

Bluetooth Low Energy Basics

16

Op)mised  for  ultra  low  power  • Different  from  Classic  Bluetooth  (Headsets,  Serial  Port,  ...  )  

• Smarter,  more  Efficient,  rather  than  Faster  • Powered  by  small  buIon  cells  like  this  • Perfect  for  devices  like  sensors  (Heart  Rate  Monitors,  Wearable  technology,  ..)    

• An  enabler  for  the  Internet  of  Things  

Radio Layer

37 15 31269 106 3338 227 272318 32112 16 342812 13 198 29343 14 20 25 35 36170 4 21 395 301

Wi-FiChannel 1

Wi-FiChannel 6

Wi-FiChannel 11

Advertising Channel 37 (2402 MHz)

Advertising Channel 38 (2426 MHz)

Advertising Channel 39 (2480 MHz)

Frequency Hopping Frequency Hopping

Others are Data Channels

Robust  and  Reliable  • Retains  ability  to  operate  in  noisy  radio  environments  • Shares  spectrum  with:  • WiFi  • DECT  cordless  phones  • Microwave  ovens  

• Similar  channel  structure  to  classic  Bluetooth  • Adap%ve  Frequency  Hopping  

Bluetooth LE devices interaction

Advertiser

Slave

Master / Scanner

Scanner

Slave

Slave

Advertiser

Advertiser

Adv

ertis

es

Adve

rtise

s

Adve

rtise

s

Adve

rtise

s

Connection

Con

nect

ion

Connection

Various  Roles  • Adver%ser  • “Here  I  am!”  

• Scanner  • “Who’s  there?”  

•  Ini%ator  • “Can  I  connect  to  you?”  

• Master  • “I’m  in  charge!”  

• Slave  • “I’ll  respond  to  requests!”  

Bluetooth Low Energy Services

Use Case

Use Case

Use Case

Characteristic

Characteristic

Characteristic

Characteristic

Request

Response

GATT Client GATT Server

Service

Service

...

...

Indication

Notification

Acknowledgement

Applica)ons  use  this  model  •  As  a  Developer  you  will  work  with  services  •  Services  •  Client  • Make  requests  •  Interact  with  Characteris)cs  

•  Server  •  Responds  to  requests  • Manage  Characteris)cs  •  Can  also  send  events  called  •  Indica%ons    •  No%fica%ons  

...

...

Characteristics

Primary Service <<GAP>>

Primary Service <<GATT>>

Primary Service <<Temperature>>

<<Device Name>> “XYZ Thermometer”

<<Appearance>> <<Thermometer>>

<<Attribute Opcodes Supported>> 0x03fdf

<<Temperature Celsius>> 0x0801

(Note: by specification 0x0801 = 2049 * 0.01 deg C = 20.49 C )

More  than  just  numbers  or  strings  •  Uniquely  universally  iden)fied  •  UUIDs  (16-­‐  or  128-­‐bits)  •  Registered  by  Bluetooth  SIG  

•  Used  to  •  Iden)fy  device  (GAP)  •  Describe  capabili)es  (GATT)  •  Applica)on  aIributes  

•  Permissions  •  Have  associate  scale  (  e.g.  )  •  Temp  (Celsius,  Kelvin  etc)  •  Pressure  (  mmHg,  Nm-­‐2)  

Examining GATT Services

Sample application review

22

HeartMonitor - BT LE Notifications

GATT Notifications

Heart rate measurement values

Coding Recipe - High Level

24

INITIALISATION  

DEVICE  DISCOVERY  AND  SELECTION  

MONITOR  

Coding Recipe - Initialisation

25

• bt_device_init  •  ini)alise  the  Bluetooth  device  and  library    

• bt_ldev_set_power  •  switch  the  Bluetooth  radio  on  

• bt_ga@_init  •  specify  call    back  func)ons  for  GATT  events  

Ini)alisa)on  

Coding Recipe - Device Discovery

26

•  bt_disc_start_inquiry  •  start  scanning  for  Bluetooth  devices  •  delay(5)  

•  bt_disc_cancel_inquiry  • we’ve  waited  long  enough  so  cancel  the  scan  

•  bt_disc_retrieve_devices  •  retrieve  list  of  Bluetooth  devices  that  are  within  range  

•  bt_rdev_get_type  •  check  devices  for  being  LE  devices.  Disregard  those  that  are  not.  

•  bt_rdev_get_services_ga@  •  examine  services  supported  by  each  found  device  and  filter  those  that  do  not  support  the  service  we  need  

Device  Discovery  and  Selec)on  

Coding Recipe - Monitoring #1

27

• bt_ga@_connect_service    •  connect  to  the  heart  rate  service  on  the  selected  device    

•  ga@_service_connected  •  your  call  back  func)on,  called  when  connec)on  to  the  selected  service  is  achieved  

• bt_ga@_reg_no%fica%ons  •  register  for  GATT  no)fica)ons  from  the  service  we  connected  to  

• bt_ga@_enable_no%fy  •  indicate  the  specific  characteris)cs  we  want  to  receive  no)fica)ons  for  

• no%fica%ons_cb  •  your  call  back  func)on.  Receive  a  no)fica)on  for  a  characteris)c  of  interest  here  

Monitoring  

Coding Recipe - Monitoring #2

28

• bt_ga@_characteris%cs_count  • Find  out  how  many  characteris)cs  this  service  offers  

• bt_ga@_characteris%cs  • Obtain  a  list  of  the  service’s  supported  characteris)cs  

• bt_ga@_enable_no%fy  • Enable  no)fica)ons  for  a  selected  characteris)c  

Register  for  GATT  no)fica)ons  

Bizarre Apps – Heart Monitor

29

�  Two of my crazy colleagues from London took this one step further

�  Control a music track using your heart rate

�  Let’s give that a go here!!!!!!!

�  Ran???? Don (@donturner) and Luca (@blackberryluca) in their Bizarre Apps Laboratory deep underground the UK Technical Centre

Close

30

How can I find out more?

31

• Code  •  Full  source  code  available  on  Git  Hub  hIps://github.com/blackberry/Cascades-­‐Community-­‐Samples    

• Ar%cle  • A  more  detailed  Ar)cle  is  available  on  the  Support  Forums  hIp://supporgorums.blackberry.com  

• Contact  us  if  you  have  ques%ons  •  TwiIer  •  John  Murray  @jcmrim  • Mar)n  Woolley  @mdwrim  • Ranbijay  Kumar  @ranbijay  

Resources  

THANK YOU

JAM805 John Murray, Ranbijay Kumar September 26-27, 2013

32