SlideShare a Scribd company logo
1 of 46
Download to read offline
@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

iBeacons e le novità di BLE [Mokapp 2013]

More Related Content

Similar to iBeacons e le novità di BLE [Mokapp 2013]

Asynchronous programming patterns in Perl
Asynchronous programming patterns in PerlAsynchronous programming patterns in Perl
Asynchronous programming patterns in Perldeepfountainconsulting
 
The Software Developers Guide to Prototyping Wearable Devices
The Software Developers Guide to Prototyping Wearable DevicesThe Software Developers Guide to Prototyping Wearable Devices
The Software Developers Guide to Prototyping Wearable DevicesTechWell
 
iBeacons - the new low-powered way of location awareness
iBeacons - the new low-powered way of location awarenessiBeacons - the new low-powered way of location awareness
iBeacons - the new low-powered way of location awarenessStefano Zanetti
 
Inside Bokete: Web Application with Mojolicious and others
Inside Bokete:  Web Application with Mojolicious and othersInside Bokete:  Web Application with Mojolicious and others
Inside Bokete: Web Application with Mojolicious and othersYusuke Wada
 
iOS Bluetooth Low Energy (BLE) Remote Robot Interface
iOS Bluetooth Low Energy (BLE) Remote Robot InterfaceiOS Bluetooth Low Energy (BLE) Remote Robot Interface
iOS Bluetooth Low Energy (BLE) Remote Robot InterfaceSteve Knodl
 
Core bluetooth @ cocohead
Core bluetooth @ cocoheadCore bluetooth @ cocohead
Core bluetooth @ cocoheadKai-Yuan Cheng
 
Mobile Development integration tests
Mobile Development integration testsMobile Development integration tests
Mobile Development integration testsKenneth Poon
 
Mobile Security Assessment: 101
Mobile Security Assessment: 101Mobile Security Assessment: 101
Mobile Security Assessment: 101wireharbor
 
Intro to iBeacon and Bluetooth Low Energy
Intro to iBeacon and Bluetooth Low EnergyIntro to iBeacon and Bluetooth Low Energy
Intro to iBeacon and Bluetooth Low EnergyKurt McIntire
 
Core Bluetooth and BLE 101
Core Bluetooth and BLE 101Core Bluetooth and BLE 101
Core Bluetooth and BLE 101Li Lin
 
RubyMotion
RubyMotionRubyMotion
RubyMotionMark
 
BTLE (Bluetooth Low Energy) and CoreBluetooth
BTLE (Bluetooth Low Energy) and CoreBluetooth BTLE (Bluetooth Low Energy) and CoreBluetooth
BTLE (Bluetooth Low Energy) and CoreBluetooth Zach Dennis
 
IoT: Internet of Things with Python
IoT: Internet of Things with PythonIoT: Internet of Things with Python
IoT: Internet of Things with PythonLelio Campanile
 
Introduction to Arduino and Circuits
Introduction to Arduino and CircuitsIntroduction to Arduino and Circuits
Introduction to Arduino and CircuitsJason Griffey
 

Similar to iBeacons e le novità di BLE [Mokapp 2013] (20)

Asynchronous programming patterns in Perl
Asynchronous programming patterns in PerlAsynchronous programming patterns in Perl
Asynchronous programming patterns in Perl
 
The Software Developers Guide to Prototyping Wearable Devices
The Software Developers Guide to Prototyping Wearable DevicesThe Software Developers Guide to Prototyping Wearable Devices
The Software Developers Guide to Prototyping Wearable Devices
 
iBeacons - the new low-powered way of location awareness
iBeacons - the new low-powered way of location awarenessiBeacons - the new low-powered way of location awareness
iBeacons - the new low-powered way of location awareness
 
Inside Bokete: Web Application with Mojolicious and others
Inside Bokete:  Web Application with Mojolicious and othersInside Bokete:  Web Application with Mojolicious and others
Inside Bokete: Web Application with Mojolicious and others
 
iOS Bluetooth Low Energy (BLE) Remote Robot Interface
iOS Bluetooth Low Energy (BLE) Remote Robot InterfaceiOS Bluetooth Low Energy (BLE) Remote Robot Interface
iOS Bluetooth Low Energy (BLE) Remote Robot Interface
 
Odk getting started
Odk getting startedOdk getting started
Odk getting started
 
Core bluetooth @ cocohead
Core bluetooth @ cocoheadCore bluetooth @ cocohead
Core bluetooth @ cocohead
 
Mobile Development integration tests
Mobile Development integration testsMobile Development integration tests
Mobile Development integration tests
 
Mojolicious
MojoliciousMojolicious
Mojolicious
 
Mobile Security Assessment: 101
Mobile Security Assessment: 101Mobile Security Assessment: 101
Mobile Security Assessment: 101
 
Intro to iBeacon and Bluetooth Low Energy
Intro to iBeacon and Bluetooth Low EnergyIntro to iBeacon and Bluetooth Low Energy
Intro to iBeacon and Bluetooth Low Energy
 
Core Bluetooth and BLE 101
Core Bluetooth and BLE 101Core Bluetooth and BLE 101
Core Bluetooth and BLE 101
 
Onsg11 iphone
Onsg11 iphoneOnsg11 iphone
Onsg11 iphone
 
Ruby Kaigi 2008 LT
Ruby Kaigi 2008 LTRuby Kaigi 2008 LT
Ruby Kaigi 2008 LT
 
RubyMotion
RubyMotionRubyMotion
RubyMotion
 
Using iBeacons in Titanium
Using iBeacons in TitaniumUsing iBeacons in Titanium
Using iBeacons in Titanium
 
Pioc
PiocPioc
Pioc
 
BTLE (Bluetooth Low Energy) and CoreBluetooth
BTLE (Bluetooth Low Energy) and CoreBluetooth BTLE (Bluetooth Low Energy) and CoreBluetooth
BTLE (Bluetooth Low Energy) and CoreBluetooth
 
IoT: Internet of Things with Python
IoT: Internet of Things with PythonIoT: Internet of Things with Python
IoT: Internet of Things with Python
 
Introduction to Arduino and Circuits
Introduction to Arduino and CircuitsIntroduction to Arduino and Circuits
Introduction to Arduino and Circuits
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Recently uploaded (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

iBeacons e le novità di BLE [Mokapp 2013]

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

  • 3. Francesco Novelli chi? ❖ Freelance! ! ❖ iOS Developer! ❖ Web (Back-end) Developer! ❖ Windows 8 Developer!
  • 5. Di cosa parliamo? ❖ iOS 7!! ❖ Bluetooth 4.0! ❖ iBeacons! ❖ Raspberry PI
  • 6.
  • 8. iBeacons e le novità di BLE Bluetooth 4.0 • • • • Cos’è?! Il solito bluetooth? NO! Chi lo usa?! Come lo uso nella mia app?
  • 9. Bluetooth 4.0: cos’è? ❖ BLE: Blueooth Low Energy! ❖ Standard dal 2010! ❖ Chip diverso dal 3.0-! ❖ Dual Chip Device
  • 10. 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
  • 11. Bluetooth 4.0: Le novità ❖ Range: 50m vs 100m! ❖ Throughput: 0.27 Mbit/s vs 2.1 Mbit/s! ❖ Latency: 6ms vs 100ms
  • 12. Bluetooth 4.0: Le novità ❖ Niente auricolari Bluetooth 4.0! ❖ Niente scambio foto à la Symbian! ❖ Niente cuffie BLE! ❖ quindi? che ci faccio?
  • 13. Bluetooth 4.0: Chi lo usa? ❖ Orologi! ❖ Sport e fitness devices! ❖ Healtcare devices! ❖ Security devices! ❖ Proxymity! ❖ Automation! ❖ …
  • 14. Bluetooth 4.0: Profili disponibili ❖ GATT Profiles:! ❖ http://is.gd/blegatt! ❖ Rivolto a developer! ❖ Rivolto a hardware makers
  • 15. Bluetooth 4.0 in iOS ❖ CoreBluetooth.framework! ❖ Disponibile su iOS e Mac OS! ❖ CBPeripheral (ogni BLE device)! ❖ CBCentralManager (iOS BLE)
  • 16. 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
  • 17. 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);! ! }
  • 18. Bluetooth 4.0 in iOS: Connecting [myCentralManager connectPeripheral:peripheral options:nil]; - (void)centralManager:(CBCentralManager *)central! didConnectPeripheral:(CBPeripheral *)peripheral {! ! NSLog(@"Peripheral connected");! ... peripheral.delegate = self;!
  • 19. Bluetooth 4.0 in iOS: Services - (void)peripheral:(CBPeripheral *)peripheral! didDiscoverServices:(NSError *)error {! ! for (CBService *service in peripheral.services) {! NSLog(@"Discovered service %@", service);! ...! }! ...
  • 20. 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);! ...! }! ...!
  • 21. 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];
  • 24. iBeacons e le novità di BLE iBeacons • • • • • Cos’è?! Come funziona?! Come si costruisce?! Quanto costa?! Come lo uso nella mia app?
  • 25. 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.
  • 26. iBeacons: trasmette..? ❖ 3 info: UUDID, major, minor! ❖ SEMPRE! ❖ a qualsiasi BLE device attivo! ❖ nothing else matter
  • 27. iBeacons IDs ❖ UUDID: E2C56DB5-DFFB-48D2-B060-D0F5A71096E0! ❖ Major: int! ❖ Minor: int! ❖ Major e Minor ID qualunque, ID generici
  • 28. 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.
  • 29. 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.
  • 30. iBeacons: come funziona? ❖ iOS device! ❖ MiniPC con Bluetooth 4.0! ❖ Standalone device! ❖ Estimone, etc..

  • 31. 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];
  • 32. 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 ***
  • 33. iBeacons: come lo uso? ❖ Monitoring! ❖ Notify
  • 34. 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); ! }
  • 36. 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"];
  • 37. 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;
  • 39. iBeacons on Raspberry PI ❖ Compra un Raspberry PI. ORA!! ❖ Compra un adattatore BLE. 10€ on Amazon! ❖ Collegali ed esegui i comandi delle prossime slide..
  • 40. 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
  • 41. 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
  • 43. 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
  • 45. @if9 - francesco.nove@gmail.com - runcode.it iBeacons e le novità di BLE Francesco Novelli