Transcript
Page 1: NFC, Bluetooth e comunicazione tra app

NFC E BLUETOOTH: INTERAZIONE TRA DISPOSITIVI Michele Locuratolo

Nokia Developer Champion

Microsoft MVP

Page 2: NFC, Bluetooth e comunicazione tra app

INTERAZIONE CON HARDWARE!

Page 3: NFC, Bluetooth e comunicazione tra app

Nokia Internal Use Only

BLUETOOTH

Page 4: NFC, Bluetooth e comunicazione tra app

BLUETOOTH Short Range Wireless communication

• Tipicamente range max 10mt

Scenari:

• App to Device:

• L’applicazione stabilisce una connessione con il device

• Pairing da effettuare preventivamente

• App to App:

• comunicazione tra 2 applicazioni via che espongono un servizio

• Pairing non richiesto

• La comunicazione avviene via StreamSocket

Page 5: NFC, Bluetooth e comunicazione tra app

CAPABILITIES

Scenario Required capabilities

App to app ID_CAP_PROXIMITY

App to device ID_CAP_PROXIMITY, ID_CAP_NETWORKING

Page 6: NFC, Bluetooth e comunicazione tra app

CONNESSIONE

Peerfinder FindAllPeers

Selezione del device

Creazione StreamSocket over Bluetooth

Stream dei dati

Page 7: NFC, Bluetooth e comunicazione tra app

APP TO DEVICE

["Bluetooth:SDP"] = “{GUID}" Service Discovery Protocol

Page 8: NFC, Bluetooth e comunicazione tra app

Nokia Internal Use Only

DEMO

Bluetooth App to Device

Page 9: NFC, Bluetooth e comunicazione tra app

APP TO APP

Page 10: NFC, Bluetooth e comunicazione tra app

SEND/RECEIVE MESSAGE

Page 11: NFC, Bluetooth e comunicazione tra app

MESSAGGI E PROTOCOLLI

• SendMessage e GetMessage implementano lo stesso protocollo che serializza il messaggio (testo) allo stesso modo per entrambi

• Dati più complessi possono essere passati usando le tecniche di serializzazione appropriate (come si fa generalmente quando si trasmettono informazioni attraverso un canale)

Page 12: NFC, Bluetooth e comunicazione tra app

Nokia Internal Use Only

DEMO

App to App

Page 13: NFC, Bluetooth e comunicazione tra app

PROFILI BLUETOOTH SUPPORTATI

• Advanced Audio Distribution Profile (A2DP 1.2)

• Audio/Video Remote Control Profile (AVRCP 1.4)

• Hands Free Profile (HFP 1.5)

• Phone Book Access Profile (PBAP 1.1)

• Object Push Profile (OPP 1.1)

• Out of Band (OOB) and Near Field Communications (NFC)

• Bluetooth Low Energy (GDR2)

Page 14: NFC, Bluetooth e comunicazione tra app

Nokia Internal Use Only

NFC

Page 15: NFC, Bluetooth e comunicazione tra app

NFC IN WP8

• Short Range: da 2 a 4 cm

• Low bandwith: ~424 kbit/s

• Scenari: • App to Device (tag etc)

• App to App (tap + send)

Page 16: NFC, Bluetooth e comunicazione tra app

SCENARI

App to Device

Lettura tag

Scrittura tag

Open app

App to App

Tap + Send

StreamSocket Bootstrap

Page 17: NFC, Bluetooth e comunicazione tra app

NFC BASE

Page 18: NFC, Bluetooth e comunicazione tra app

SCRITTURA NFC

http://msdn.microsoft.com/en-us/library/windows/apps/hh701129.aspx

WindowsWindowsUri WindowsMime

Windows:WriteTag

WindowsUri:WriteTag WindowsMime:WriteTagLaunchApp:WriteTag

WriteableTagPairing:Bluetooth

NDEF

NDEF:ext

NDEF:MIME

NDEF:URINDEF:wkt

NDEF:WriteTag

NDEF:Unknown

Page 19: NFC, Bluetooth e comunicazione tra app

NFC DATA EXCHANGE FORMAT (NDEF)

• Un messaggio NDEF è composto da 1 o più NDEF records

• Possono esserci più records (array)

• Il numero di record dipende dalla dimensione del tag e dalla nostra applicazione

Page 20: NFC, Bluetooth e comunicazione tra app

NFC DATA EXCHANGE FORMAT (NDEF)

Page 21: NFC, Bluetooth e comunicazione tra app

Nokia Internal Use Only

DEMO NFC

Page 22: NFC, Bluetooth e comunicazione tra app

LETTURA NFC

Page 23: NFC, Bluetooth e comunicazione tra app

Nokia Internal Use Only

DEMO

NFC Lettura/Scrittura

Page 24: NFC, Bluetooth e comunicazione tra app

PROTOCOLLI

• Diversi protocolli per azioni specifiche • WindowsUri: WP8 AssociationUri

• NDEF: messaggio NDEF

• LaunchApp: avvio app

• Lista: http://msdn.microsoft.com/en-us/library/windows/apps/hh701129.aspx

• URI Scheme per avvio app specifiche (anche di sistema) • mailto: invio mail

• ms-settings-wifi: avvia i settings wifi

• Lista: http://tinyurl.com/bh4btf4

Page 25: NFC, Bluetooth e comunicazione tra app

TAP + SEND

NFC Peerfinder start

Rilevazione Device

Creazione StreamSocket over Bluetooth

Stream dei dati

Page 26: NFC, Bluetooth e comunicazione tra app

Nokia Internal Use Only

DEMO

Tap + Send

Page 27: NFC, Bluetooth e comunicazione tra app

LAUNCHAPP TAGS

• NdefLaunchAppRecord con AppID • Se l’app non è installata, viene data la possibilità di installarla dal marketplace

• Possibilità di passare parametri

• CustomUriProtocol • Creazione di un protocollo custom

• Registrazione extension

• Il messaggio è di tipo URI

• Se l’app non è installata, viene fatta una ricerca sul marketplace

Page 28: NFC, Bluetooth e comunicazione tra app

NDEFLAUNCHAPPRECORD

Page 29: NFC, Bluetooth e comunicazione tra app

LAUNCHAPP TAGS

Page 30: NFC, Bluetooth e comunicazione tra app

CUSTOMURIPROTOCOL

Page 31: NFC, Bluetooth e comunicazione tra app

DIFFERENZE UI

NdefLaunchAppRecord Protocollo

Page 32: NFC, Bluetooth e comunicazione tra app

Nokia Internal Use Only

DEMO

Launch App

Page 33: NFC, Bluetooth e comunicazione tra app

TAG SUPPORTATI

• NFC Forum Tag Type 1: e.g., Broadcom Topaz

• NFC Forum Tag Type 2: e.g., NXP Mifare Ultralight, NXP Mifare Ultralight C, NXP NTAG203

• NFC Forum Tag Type 3: e.g., Sony FeliCa

• NFC Forum Tag Type 4: e.g., NXP DESFire, NXP SmartFX with JCOP

Page 34: NFC, Bluetooth e comunicazione tra app

LIMITI NFC IN WP8

• Non è possibile bloccarli (write lock)

• Non possono essere formattati (comprateli formattati NDEF)

• Possono contenere solo messaggi NDEF

• Non è possibile usare tutta la memoria disponibile (presenza di dati privati/formattazione)

• Non è possibile ricevere dati se l’applicazione è in background

Page 36: NFC, Bluetooth e comunicazione tra app

Nokia Internal Use Only

Thank you!

© 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.


Recommended