iBeacons e le novità di BLE [Mokapp 2013]
Upcoming SlideShare
Loading in...5
×
 

iBeacons e le novità di BLE [Mokapp 2013]

on

  • 1,017 views

iBeacons e le novità di BLE

iBeacons e le novità di BLE

Statistics

Views

Total Views
1,017
Views on SlideShare
1,006
Embed Views
11

Actions

Likes
6
Downloads
39
Comments
0

2 Embeds 11

https://twitter.com 10
https://www.linkedin.com 1

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

iBeacons e le novità di BLE [Mokapp 2013] iBeacons e le novità di BLE [Mokapp 2013] Presentation Transcript

  • @if9 - francesco.nove@gmail.com - runcode.it iBeacons e le novità di BLE Francesco Novelli

  • Francesco Novelli chi? ❖ Freelance! ! ❖ iOS Developer! ❖ Web (Back-end) Developer! ❖ Windows 8 Developer!
  • Chi?? fag.it
  • Di cosa parliamo? ❖ iOS 7!! ❖ Bluetooth 4.0! ❖ iBeacons! ❖ Raspberry PI
  • iBeacons
  • iBeacons e le novità di BLE Bluetooth 4.0 • • • • Cos’è?! Il solito bluetooth? NO! Chi lo usa?! Come lo uso nella mia app?
  • Bluetooth 4.0: cos’è? ❖ BLE: Blueooth Low Energy! ❖ Standard dal 2010! ❖ Chip diverso dal 3.0-! ❖ Dual Chip Device
  • Bluetooth 4.0: Le novità ❖ Completamente differente!! ❖ Niente abbinamenti, PIN etc.! ❖ Advertising continuo! ❖ ❖ Low Power! 
 0.01-0.5 (BLE) vs 1 (classic)! Peak di <15 mA vs <30mA di classic
  • Bluetooth 4.0: Le novità ❖ Range: 50m vs 100m! ❖ Throughput: 0.27 Mbit/s vs 2.1 Mbit/s! ❖ Latency: 6ms vs 100ms
  • Bluetooth 4.0: Le novità ❖ Niente auricolari Bluetooth 4.0! ❖ Niente scambio foto à la Symbian! ❖ Niente cuffie BLE! ❖ quindi? che ci faccio?
  • Bluetooth 4.0: Chi lo usa? ❖ Orologi! ❖ Sport e fitness devices! ❖ Healtcare devices! ❖ Security devices! ❖ Proxymity! ❖ Automation! ❖ …
  • Bluetooth 4.0: Profili disponibili ❖ GATT Profiles:! ❖ http://is.gd/blegatt! ❖ Rivolto a developer! ❖ Rivolto a hardware makers
  • Bluetooth 4.0 in iOS ❖ CoreBluetooth.framework! ❖ Disponibile su iOS e Mac OS! ❖ CBPeripheral (ogni BLE device)! ❖ CBCentralManager (iOS BLE)
  • Bluetooth 4.0 in iOS ❖ init CBCentralManage! ❖ ricercare e connettersi con i BLE device che trasmettono! ❖ esplorare le info del device BLE (CBPeripheral)! ❖ Ricevere e inviare richieste con data! ❖ Registrare notifiche per cambio valori
  • Bluetooth 4.0 in iOS: Discovering myCentralManager =! [[CBCentralManager alloc] initWithDelegate:self queue:nil options:nil]; [myCentralManager scanForPeripheralsWithServices:nil options:nil]; - (void)centralManager:(CBCentralManager *)central! didDiscoverPeripheral:(CBPeripheral *)peripheral! advertisementData:(NSDictionary *)advertisementData! RSSI:(NSNumber *)RSSI {! ! NSLog(@"Discovered %@", peripheral.name);! ! }
  • Bluetooth 4.0 in iOS: Connecting [myCentralManager connectPeripheral:peripheral options:nil]; - (void)centralManager:(CBCentralManager *)central! didConnectPeripheral:(CBPeripheral *)peripheral {! ! NSLog(@"Peripheral connected");! ... peripheral.delegate = self;!
  • Bluetooth 4.0 in iOS: Services - (void)peripheral:(CBPeripheral *)peripheral! didDiscoverServices:(NSError *)error {! ! for (CBService *service in peripheral.services) {! NSLog(@"Discovered service %@", service);! ...! }! ...
  • Bluetooth 4.0 in iOS: Services NSLog(@"Discovering characteristics for service %@", interestingService);! [peripheral discoverCharacteristics:nil forService:interestingService]; - (void)peripheral:(CBPeripheral *)peripheral! didDiscoverCharacteristicsForService:(CBService *)service! error:(NSError *)error {! ! for (CBCharacteristic *characteristic in service.characteristics) {! NSLog(@"Discovered characteristic %@", characteristic);! ...! }! ...!
  • Bluetooth 4.0 in iOS: Read NSLog(@"Reading value for characteristic %@", interestingCharacteristic);! [peripheral readValueForCharacteristic:interestingCharacteristic]; - (void)peripheral:(CBPeripheral *)peripheral! didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic! error:(NSError *)error {! ! NSData *data = characteristic.value;! // parse the data as needed! ... [peripheral setNotifyValue:YES forCharacteristic:interestingCharacteristic];
  • bpm Demo cardioble
  • bpm Demo
  • iBeacons e le novità di BLE iBeacons • • • • • Cos’è?! Come funziona?! Come si costruisce?! Quanto costa?! Come lo uso nella mia app?
  • iBeacons iBeacon, a new class of low-powered, low-cost transmitters that can notify nearby iOS 7 devices of their presence, provides apps a whole new level of location awareness, such as trail markers in a park, exhibits in a museum, or product displays in stores.
  • iBeacons: trasmette..? ❖ 3 info: UUDID, major, minor! ❖ SEMPRE! ❖ a qualsiasi BLE device attivo! ❖ nothing else matter
  • iBeacons IDs ❖ UUDID: E2C56DB5-DFFB-48D2-B060-D0F5A71096E0! ❖ Major: int! ❖ Minor: int! ❖ Major e Minor ID qualunque, ID generici
  • iBeacons IDs ❖ UUDID: E2C56DB5-DFFB-48D2-B060-D0F5A71096E0
 McDonald! ❖ Major: int 17
 Grosseto! ❖ Minor: int 9
 Cassa 9! ❖ quindi…! ❖ sei nel McDonald di Grosseto alla Cassa 9.
 propongo pagamento tramite app per il conto della Cassa 9.
  • iBeacons IDs ❖ UUDID: E2C56DB5-DFFB-48D2-B060-D0F5A71096E0
 Museo Uffizi! ❖ Major: int 2
 Piano 2! ❖ Minor: int 13
 Quadro 13! ❖ quindi…! ❖ sei nel Museo al secondo piano davanti al quadro 13.
 propongo audio guida per quel quadro.
  • iBeacons: come funziona? ❖ iOS device! ❖ MiniPC con Bluetooth 4.0! ❖ Standalone device! ❖ Estimone, etc..

  • iBeacons: iOS Beacon Adv Progetto AirLocate! CoreBluetooth.framework _peripheralManager = [[CBPeripheralManager alloc] initWithDelegate:self queue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)]; NSDictionary *peripheralData = nil; if(_uuid && _major && _minor) { CLBeaconRegion *region = [[CLBeaconRegion alloc] initWithProximityUUID:_uuid major:[_major shortValue] minor:[_minor shortValue] identifier:@"com.apple.AirLocate"]; peripheralData = [region peripheralDataWithMeasuredPower:_power]; } [_peripheralManager startAdvertising:peripheralData];
  • iBeacons: Quanto costa? low-cost transmitters Nome Estimote Costo Tempi 99$ x 3 (33$ each) Late December Affdabilità ***** BLE Mini 30£ each Weeks **** Alibaba seller 10$-20$ Days/Week ***
  • iBeacons: come lo uso? ❖ Monitoring! ❖ Notify
  • iBeacons: Monitoring _locationManager = [[CLLocationManager alloc] init]; _locationManager.delegate = self; CLBeaconRegion *region = nil; _uuid = [[NSUUID alloc] initWithUUIDString:@“E2C56DB5-DFFB-48D2-B060-D0F5A71096E0"]; region = [[CLBeaconRegion alloc] initWithProximityUUID:_uuid identifier:@"com.apple.AirLocate"]; [_locationManager startRangingBeaconsInRegion:region]; ! ! - (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region { ! ! NSLog(@"Major: %@, Minor: %@, Acc: %.2fm %li", beacon.major, beacon.minor, beacon.accuracy, beacon.proximity); ! }
  • bpm Demo
  • iBeacons: Notify _locationManager = [[CLLocationManager alloc] init]; _locationManager.delegate = self; CLBeaconRegion *region = nil; _uuid = [[NSUUID alloc] initWithUUIDString:@“E2C56DB5-DFFB-48D2-B060-D0F5A71096E0"]; region = [[CLBeaconRegion alloc] initWithProximityUUID:_uuid identifier:@"com.apple.AirLocate"]; region.notifyOnEntry = YES; region.notifyOnExit = YES; region.notifyEntryStateOnDisplay = YES; [_locationManager startMonitoringForRegion:region]; NSNumber *major = @2; NSNumber *minor = @2; region = [[CLBeaconRegion alloc] initWithProximityUUID:_uuid major:[major shortValue] minor:[minor shortValue] identifier:@"com.apple.AirLocate"];
  • iBeacons: Notify - (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region; - (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region; typedef NS_ENUM(NSInteger, CLRegionState) { - (void)locationManager:(CLLocationManager *)manager CLRegionStateUnknown, CLRegionStateInside, didDetermineState:(CLRegionState)state CLRegionStateOutside forRegion:(CLRegion *)region; } NS_ENUM_AVAILABLE_IOS(7_0); PS: CLBeacon *beacon = (CLBeacon *)region;
  • bpm Demo
  • iBeacons on Raspberry PI ❖ Compra un Raspberry PI. ORA!! ❖ Compra un adattatore BLE. 10€ on Amazon! ❖ Collegali ed esegui i comandi delle prossime slide..
  • iBeacons on Raspberry PI apt-get update! apt-get install libglib2.0-dev libdbus-1-dev libudev-dev libical-dev libreadline6-dev! wget https://www.kernel.org/pub/linux/bluetooth/bluez-5.9.tar.xz! tar xvJf bluez-5.9.tar.xz! cd bluez-5.9! ./configure --disable-systemd --enable-library! make! make install hciconfig hciconfig hci0 up! hciconfig
  • iBeacons on Raspberry PI git clone https://github.com/carsonmcdonald/bluez-ibeacon.git! cd bluez-ibeacon/bluez-beacon/! make ./ibeacon 200 e2c56db5dffb48d2b060d0f5a71096e0 1 1 -59
  • bpm Demo
  • Di cosa abbiamo parlato? ❖ Bluetooth 4.0
 cos’è, come funziona, come si implementa! ❖ iBeacons
 cos’è, come funzionano, come si implementa! ❖ Raspberry PI
 come diventa un iBeacon
  • bpm Thanks
  • @if9 - francesco.nove@gmail.com - runcode.it iBeacons e le novità di BLE Francesco Novelli