Bluetooth LE & Lumia Sensor Core
-
Upload
dan-ardelean -
Category
Mobile
-
view
268 -
download
1
description
Transcript of Bluetooth LE & Lumia Sensor Core
Dan ArdeleanMicrosoft MVPXamarin Certified Mobile Developer
Blog: sviluppomobile.blogspot.comTwitter: @danardelean EMail: [email protected]
Bluetooh LE &Lumia SensorCore
Windows Phone 8.1
04/07/2023 2
• 2001 Nokia inizia lavorare su una nuova tecnologia wireless• 2004 risultati pubblicati con il nome Bluetooth Low End
Extension• 2006 rilasciato pubblicamente come Wibree• 2007 accordo per includere Wibree dentro Bluetooth come
Ultra low power technology• 2010 integrato come Bluetooth Smart dentro Core
Specifications 4.0• 2011 viene rilasciato iPhone 4S con supporto per BLE• 2012 escono i primi dispositivi• 2013 Windows 8.1 aggiunge supporto parziale per BLE• 2014 Windows Phone 8.1 aggiunge supporto per BLE
Bluetooth Low Energy - Smart
04/07/2023 3
• “Internet of Things”: low cost, low power• Proximity and out of range detection
(geofencing)• Fast connections (10 msec) and low data
latency (3-6 msec)• Adaptive Frequency Hopping (AFH), resilient to
interference• Broadcast support (iBeacons)• Connectionless always off technology• Low power consumption: ~30μA average
consumption 1 second data interval, equivalent to 330 days on a single coin cell
• Range up to 280 meters (in practice about 10-30 meters)
Bluetooth Smart
04/07/2023 4
Classic vs SmartTechnical Specification Classic Bluetooth technology Bluetooth Smart technology
Distance/Range (theoretical max.) 100 m (330 ft) >100 m (>330 ft)
Over the air data rate 1–3 Mbit/s 1 Mbit/sApplication throughput 0.7–2.1 Mbit/s 0.27 Mbit/s
Active slaves 7 Not defined; implementation dependent
Security 56/128-bit and application layer user defined
128-bit AES with Counter Mode CBC-MAC and
application layer user defined
Robustness Adaptive fast frequency hopping, FEC, fast ACK
Adaptive frequency hopping, Lazy Acknowledgement, 24-bit CRC, 32-
bit Message Integrity Check
Latency (from a non-connected state) Typically 100 ms 6 ms
Total time to send data (det.battery life) 100 ms 3 ms
04/07/2023 5
• HTP - for medical temperature measurement devices.
• GLP - for blood glucose monitors.• BLP - for blood pressure measurement.
Health Care
04/07/2023 6
• HRP - for devices which measure heart rate.• CSCP - for sensors attached to a bicycle or exercise bike to
measure cadence and wheel speed.• RSCP - running speed and cadence profile.• CPP - cycling power profile.• LNP — location and navigation profile.
Sport & Fitness
04/07/2023 7
• FMP - the "find me" profile — allows one device to issue an alert on a second misplaced device
• PXP - the proximity profile — allows a proximity monitor to detect whether a proximity reporter is within a close range.
Proximity Sensor
04/07/2023 8
Home Automation
9
Altri dispositivi
04/07/2023 10
Architettura Bluetooth Low Energy
GAP ATT
L2CAP
GATT
GAP Role Profiles (Master / Slave) GATT Profiles
User Application
Host Controller Interface (HCI)
SMP Host
Cont
rolle
r
Link Layer (LL)
Physical Layer (PHY)
Appl
icatio
n
04/07/2023 11
Generic Access Profile (GAP) : Roles• Transmit advertisement onlyBroadcaster
(Advertiser)
• Only receives advertisementsObserver (Scanner)
• 1 connection to a masterPeripheral (Slave)
• Supports multiple connections• Initiates connections to devices in peripheral roleCentral (Master)
Central
Peripheral
Peripheral
Broad- caster Obser-
ver
11
04/07/2023 12
Profili standard GATT
Characteristic
Value
Descriptor Descriptor
Value types: Broadcast, Read, Write, Write without response, Notify, Indicate (needs reply)Descriptors describe:
Presentation formatValid RangeUser description
Profile
Service
Characteristic
Characteristic
04/07/2023 13
Profili BLE standard
xxxxxxxx-0000-1000-8000-00805F9B34FB
04/07/2023 14
Heart Rate
04/07/2023 15
• Package.appxmanifest
• Trovare dei dispositivi che implementano il servizio
• Realizzare la connessione al servizio desiderato
Windows Phone 8.1
04/07/2023 16
• “Collegamento” alla caratteristica desiderata
• Impostare eventualmente il tipo di lettura
• Leggere/scrivere o sottoscrivere le notifiche
• Interpretare il risultato della lettura
Windows Phone 8.1
17
DEMO
04/07/2023 18
• Creare un progetto Windows Phone Runtime component e implementare IBackgroundTask
• Aggiungere reference e modificare Package.appxmanifest
Background Tasks
04/07/2023 19
• Verificare se l’app ha il consenso di girare nel background
• Registrare un nuovo task
• Rimuovere/gestire I task registrati
Background Tasks
20
Nokia LumiaSensorCore SDK
04/07/2023 21
Dispositivi con Lumia SensorCore
Lumia 630 / 635 Lumia 930
04/07/2023 22
• Collezione di API che usano i dati forniti da vari sensori: accelerometro, location
• Usato per tenere traccia delle attività fisica e movimento
• I sensori girano in background e raccolgono dati per un massimo di 10 giorni
• Sempre attivi ma in Low Power Mode• Potrebbe fornire accesso a dati PRIVATI
quindi può essere disabilitata e lo storico può essere cancellato
Cos’è Lumia SensorCore?
23
API
23
• Step Counter• Activity Monitor • Place Monitor • TrackPoint Monitor
04/07/2023 24
• Dll disponibile da NuGet• Architettura ARM o x86• Microsoft Visual C++ 2013 Runtime
Package for Windows Phone• Testing Tools opzionale
Visual Studio
04/07/2023 25
• Quando si installa l’SDK vengono aggiunte in automatico dentro Package.appxmanifest
Capabilities – Lumia SensorCore HID
04/07/2023 26
API state:
04/07/2023 27
• Quanti passi e per quanto tempo• Caminata o corsa – usa anche l’intensità del
movimento non solo la velocità• Granularità 5 minuti – storico 10 giorni• 5-6 secondi fino quando inizia vedere gli eventi• Ci possono essere falsi positivi
Step Counter API
04/07/2023 28
Step Counter API
04/07/2023 Microsoft Confidential 29
• Cambiamenti nell’attività del utente: fermo, cammina, corre…
• Delay tipico 5-10 sec per eliminare alcuni falsi positivi
• Risultati migliori dentro la borsa o in tasca• Bisogna abilitare l’API• API con risultati real-time e storico 10 giorni
Activity Monitor
04/07/2023 30
Activity monitor
04/07/2023 31
Activity monitor
04/07/2023 32
•Lista di geo-coordinate•Usa principalmente celle del operatore e/o hotspot WiFi. GPS solo se un’altra applicazione lo usa•Non fornisce dati in tempo reale•Prova indovinare l’indirizzi di casa e lavoro•Classificazione può durare 2-3 giorni•Area raggio almeno 200 metri, distanze minimo 500 m, tempo di permanenza almeno 10 minuti
Place Monitor
04/07/2023 33
Place Monitor
04/07/2023 34
• Simile a Place Monitor ma traccia le rute• API offline come Place Monitor• Track point ogni 5 minuti e un minimo di 500
metri• Accuratezza dipende da numero di celle o
hotspot. Una corsa in un parco senza una sessione GPS attiva potrebbe registrare un solo trackpoint
TrackPoint Monitor
04/07/2023 35
TrackPoint Monitor
36
DEMOhttps://github.com/nokia-developer
04/07/2023 Microsoft Confidential
37
© 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
The information contained in this document represents the current view of Microsoft Corp. on the issues discussed as of the dateof publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitmenton the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication.This guide is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT.Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no partof this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form, by any means (electronic, mechanical, photocopying, recording or otherwise), or for any purpose, without the express written permission of Microsoft.Microsoft may have patents, patent applications, trademarks, copyrights or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights or other intellectual property.The example companies, organizations, products, domain names, email addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, email address, logo, person, place, or event is intended or should be inferred.