56
Beacons Attendance Beacons Attendance - Firenze - Giugno 2015 - @hr2o

Ebeacons attendence

Embed Size (px)

Citation preview

Beacons Attendance

Beacons Attendance - Firenze - Giugno 2015 - @hr2o

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit1 Luca Tozzi

Luca Tozzi

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

GDG Firenze

Web Developer (Java/GWT/AngularJS)

Mobile Developer (Android)

Cloud Developer (Google Compute/App)

Domino Amministratore e sviluppatore

Luca Tozzi

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

➔ Software Engineer

➔ Consulente HR

➔ Product Manager di una soluzione di Risorse Umane

➔ “Imprenditore”

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit2 HR2O

HR2O

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

➔ START UP

➔ INNOVATIVA

➔ IN AMBITO HR (Human Resources)

➔ CLOUD e MOBILE

HR2O

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

➔ TIME & PLACE

➔ TIMBRATURE SMART

➔ LOCALIZZAZIONE e SUPPORTO VEICOLI

➔ ?!?!?!?! RAPPORTINI DI LAVORO ?!??!?

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit3 Pervasive Attendance

Pervasive Attendence

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

➔ MANUALE

➔ RILEVAMENTO POSIZIONE TRAMITE GSM

➔ RILEVAMENTO ORARIO TRAMITE GPS

➔ OBBLIGO DI SMARTPHONE

Pervasive Attendence

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

➔ TABLET o SMARTPHONE con CAMERA

➔ BASSISSIMO COSTO

➔ PUO’ CONTENERE SUFFICENTI INFORMAZIONI

➔ FACILMENTE CLONABILE

Pervasive Attendence

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

➔ NEAR FIELD COMUNICATION

➔ PUO CONTENERE ANCHE 2KB

➔ ANDROID 2.3.3 (GINGERBREAD MR1)

➔ DIFFUSIONE (mai supportato ad Apple)

Pervasive Attendence

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

➔ GEOFENCING

➔ COMODO

➔ IMPRECISO!!!!!

➔ GOOGLE PLAY (SOLO ANDROID?!?!)

Pervasive Attendence

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

➔ WIFI INDOOR

➔ COSTOSO

➔ DIPENDENTE DALL’AMBIENTE!!!

Pervasive Attendence

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

➔ PROXYMITY BLUETOOTH

➔ SERIALE

➔ COSTOSTO DI BATTERIA!!

➔ ANDVERTISMENT BLOCCATO su ANDROID & iPHONE

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit4 BLE

Bluetooth Low Energy

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

➔ BLUETOOTH SMART/READY o 4.0?

➔ PARTE DEL BLUETOOTH 4.0 MA NON COMPATIBILE

➔ NON SERIALE MA ASINCRONO

➔ TANTE CALLBACK!!

Bluetooth Low Energy

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

➔ Non solo Software… ma anche HW

➔ Apple da 4s in poi

➔ Android 4.3

➔ .. anche se consigliato Android 5.0..

Bluetooth Low Energy

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

➔ Advertiseremette periodicamente un segnale di presenza

➔ Pheripheraldispositivi periferici BLE che lavorano come Server

➔ Centraldispositivo che usa i servizi Advertiser o Pheripheral come client

➔ Observeropera solo alla ricerca di Advertiser e/o Pheripheral

Bluetooth Low Energy

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

➔ Internet of Things

➔ Weareble (watch, fitband, …)

➔ Advertisement (Beacons...

Bluetooth Low Energy

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

➔ UUID128-bit unique identifier

➔ Major16-bit unsigned integer to differentiate between beacons within the same proximity UUID

➔ Minor16-bit unsigned integer to differentiate between beacons with the same proximity UUID and major value.

Bluetooth Low Energy

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

ESEMPIO

➔ UUIDCommit University Attendance

➔ MajorFirenze

➔ MinorIncubatore

Bluetooth Low Energy

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

SETUP BLE on Android

<uses-permission android:name="android.permission.BLUETOOTH"/><uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

VERIFICA DEVICE BLEif (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) { …... finish();..}

OBBLIGO BLE<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>

Bluetooth Low Energy

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

ISTANZIA BLE

// Initializes Bluetooth adapter.final BluetoothManager bluetoothManager = (BluetoothManager)getSystemService(Context.BLUETOOTH_SERVICE);

mBluetoothAdapter = bluetoothManager.getAdapter();

BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

if (!mBluetoothAdapter.isEnabled()) { Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);}

Bluetooth Low Energy

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

FINDING BLE DEVICEmBluetoothAdapter.startLeScan(mLeScanCallback);/mBluetoothAdapter.stopLeScan(mLeScanCallback);

private BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback() { @Override public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord) { runOnUiThread(new Runnable() { @Override public void run() { ….. mLeDeviceListAdapter.addDevice(device);.... } }); } };

Scansionare un solo tipo di dispositivi startLeScan(UUID[], BluetoothAdapter.LeScanCallback),

Bluetooth Low Energy

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

➔ Generic Attribute Profile (GATT)

➔ Servizi

➔ Charatteristiche

➔ Attributi

Bluetooth Low Energy

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

Bluetooth Low Energy

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

Connecting to a GATT ServermBluetoothGatt = device.connectGatt(this, false, mGattCallback);private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() { @Override public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) { } @Override // New services discovered public void onServicesDiscovered(BluetoothGatt gatt, int status) { }

@Override // Result of a characteristic read operation public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { } }

Bluetooth Low Energy

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

Discover Services and Characteristics

List<BluetoothGattService> services = bluetoothGatt.getServices();

// Loops through available GATT Services.for (BluetoothGattService service : services) {

List<BluetoothGattCharacteristic> characteristics = service.getCharacteristics();

}

Discover Characteristics// Loops through available GATT Characteristics.List<BluetoothGattCharacteristic> gattCharacteristics = gattService.getCharacteristics();for (BluetoothGattCharacteristic gattCharacteristic : gattCharacteristics) {

Bluetooth Low Energy

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

Bluetooth Low Energy

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

Receiving GATT Notifications on CharacteristicChanged

private BluetoothGatt mBluetoothGatt;BluetoothGattCharacteristic characteristic;boolean enabled;...mBluetoothGatt.setCharacteristicNotification(characteristic, enabled);

Once notifications are enabled for a characteristic, an onCharacteristicChanged() callback is triggered if the characteristic changes on the remote device:

@Override// Characteristic notificationpublic void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {//read the characteristic databyte[] data = characteristic.getValue();

}

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit5 Beacons

BEACONS

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

➔ Dispositivi BLE di Advertisment

➔ Radiofaro trasmettitore radio che trasmette continuamente un segnale su una specifica frequenza.

➔ Inoltra ogni %secondiUUID, MAJOR, MINOR

RANGING

➔ Rilevamento distanza

➔ Proximity analisys :lontano, vicino, prossimo

➔ Proximity marketing

➔ Fatto per Foreground

BEACONS

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

BEACONS

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

Monitoring

➔ Rilevamento Entrata ed Uscita

➔ Region

➔ Definita da UUID, Major e Minor

➔ Fatto per Background service

BEACONS

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

BEACONS

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

Ulteriori Servizi

➔ Indoor LocationLocalizza un oggetto in un luogo chiuso

➔ Way Findingconoscereil percordo di uscita data la posizione attuale

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit6 iBEACONS

iBeacons

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

➔ Tecnologia Propietaria APPLE

➔ PheriPheral o Advertiser

➔ IOS Scansiona autonomamente i BLE

➔ GLi IOS possono a loro volta essere Peripheral

iBeacons

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

➔ Definizione del protocollo di Advertisement

➔ Protocollo beacon diventa ibeacon

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit7 iBeacons SDK

Beacons SDK

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

IOS

➔ https://developer.apple.com/ibeacon/

ANDROID

➔ Estimote SDK

➔ ALT Beacon

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit8 MONITORING

MONITORING

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

Creazione di un Servicepublic class MonitoringService

extends Service

implements BeaconManager.ServiceReadyCallback, BeaconManager.MonitoringListener {

MONITORING

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

Setup Estimote mEstimoteBeaconManager = new BeaconManager(this);mEstimoteBeaconManager.setMonitoringListener(this);mEstimoteBeaconManager.connect(this);

mEstRegion = new com.estimote.sdk.Region( getString(R.string.region_id), getResources().getString(R.string.beacons_uuid), null, null);

Gestione del Monitoring

@Overridepublic void onEnteredRegion(Region region, List<Beacon> beacons) {}

@Overridepublic void onExitedRegion(Region region) {

}

MONITORING

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit9 Commit University

Attendance

C.U. - Attendances

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

➔ Applicativo Commit University

➔ Rilevazione Presenza tramite Beacons

➔ Ricerca per UUID Estimote

➔ Segnalazione di Entrata

C.U. - Attendances

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

C.U. - Attendances

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

➔ Uscita Region (mancanza segnale)

➔ Segnalazione Uscita (vedi Antincendio)

➔ Eliminare l’app perchè in BETA

C.U. - Attendances

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

Q&A

Question & Answer

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit10 News

&References

NEWS

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

17/6/2015 Proposta Dlgs attuativi Jobs act

- aggiornamento dell’articolo 4 dello Statuto dei lavoratori sui controlli a distanza

- distinguo per i controlli sugli impianti da quelli sugli strumenti di lavoro- controlli a distanza attraverso gli strumenti di lavoro,

cioè pc, tablet, telefoni aziendali - inderogabile dai Contatti Collettivi?- ma si chiede all’azienda un preciso documento di policy da consegnare

ai dipendenti.

References

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

Ref. Ufficiale https://developer.android.com/guide/topics/connectivity/bluetooth-le.html

Android Avanzato Fabio Collini, Stefano Sanna, ..

Matteo Gazzurelli (DroidCon 2015)https://youtu.be/8DQ5Ng_nE8E

AltBeacon/Estimote SDKhttp://github.com/..

[email protected]

https://it.linkedin.com/in/ltozzi

References

Beacons Attendance - Firenze - Giugno 2015 - @hr2oit

GRAZIE!!

Beacons Attendance - Firenze - Giugno 2015 - @hr2o