SlideShare uma empresa Scribd logo
1 de 34
Baixar para ler offline
Stefano Zanetti § DevCamp
iBeacons
the new low-powered way of location awareness
DevCamp
Stefano Zanetti
 Apple iOS Developer
Superpartes Innovation Campus & H-Farm	

!
 Co-founder di
# Pragma Mark ― www.pragmamark.org	

!
 [tt] @stezanna

[in] Stefano Zanetti

[fb] stefano.znt 

[email] stefano.zanetti@pragmamark.org
DevCamp
What is a Beacon?
A Bluetooth LE radio, some minor electronic
components and a button cell.
That’s all!
DevCamp
estimote.com radiusnetworks.com kontakt.io
DevCamp
How Beacons could change the world:
1. Your home will automatically react to you.
2. Your phone will give you a tour of museums.
3. Tickets that automatically load as you enter
sporting events.
4. …
DevCamp
Bluetooth LE
DevCamp
a lot of versions…
• first stable version 1.2 (2003)	

• 2.0 + EDR (2004)	

• 2.1 + EDR (2007)	

• 3.0 + HS (2009)	

• 4.0 & 4.0 LE (2010)
DevCamp
ISM 2.4GHz
This is in the globally unlicensed (but not
unregulated) Industrial, Scientific and Medical
(ISM) 2.4 GHz short-range radio frequency band
2400–2483.5 MHz
DevCamp
Mbit/s
0
7,5
15
22,5
30
version
v1.2 v2.o+EDR v3.0+HS v4.0 v4 LE
0,3Mbit/s
24Mbit/s24Mbit/s
3Mbit/s1Mbit/s
Speed
DevCamp
Other differences
classic bluetooth bluetooth low energy
latency 100ms 6ms
total time to
send data
100ms 3ms
peak current
consumption
<30mA <15mA
active slaves! 7
implementation
dependent
profile
standard BT profile
like SPP, DUN, PAN
GATT: Generic
Attribute profile
paring YES NO
DevCamp
Single and Double mode
Classic and low energy BT are not
compatible with each other
Single-mode
devices
Classic OR low
energy radio
Double-mode
devices
Classic AND low
energy radio
DevCamp
Connectionless
Devices do not need to maintain a connection
for useful information to be exchanged quickly
between them
The connectionless model solves these
problems by not defining the state of a
connection, but the state of the device
DevCamp
Stateless
Any client can send any request at any time
and the server will respond to the same
request in exactly the same way, regardless of
which client made the request.
DevCamp
Packet structure
DevCamp
Advertising packet
• Preamble - 1 Byte - fixed 8bit to synchronize bit timing and set
radio’s automatic gain control. 101010101 or 010101010
• Access Address - 4 Bytes - 32 fixed and random bit. 0x8E89BED6
(that in binary is 01101011011111011001000101110001.The preamble
would be 01010101)
• Header - 1 Byte - to describe the contents of packet
• Length - 1 Byte - to describe the payload length
• CRC - 3 Bytes: checksum calculated over PDU
• PDU (Protocol Data Unit) - 37 Bytes
DevCamp
iBeacon
DevCamp
iBeacon is a new technology that
extends Location Services in iOS
iBeacons provide a way to create and
monitor beacons that advertise certain
identifying information using Bluetooth
low energy wireless technology
(ref. iOS 7: Understanding Location Services - Apple)
DevCamp
example of iBeacon PDU
9F436059ADC00201061AFF4C000215B9407F30F5F8466EAFF925556B57FE6D010000FFB6
9F436059ADC0: Beacon’s Bluetooth MAC address
02: Length of the next field
01: Flags field identifier
06: Flags (LE General Discoverable Mode)
1A: Length of the next field
FF: Manufacturer Specific Data field identifier
4C00: Apple’s ID
0215: Two fixed bytes
B9407F30F5F8466EAFF925556B57FE6D: Proximity UUID
0100: Major
00FF: Minor
B6: Measured power
DevCamp
iOS Frameworks
iBeacon
Core
Bluetooth
Core
Location
DevCamp
iOS Classes
CLBeacon
CLLocationManager
CLLocationManagerDelegate
CBPeripheralManager
CBPeripheral
CBCentralManager
CLBeaconRegion
DevCamp
CLBeacon
Identifying the Beacon


    proximityUUID  property


    major  property


    minor  property
!
Determining the Beacon Distance


    proximity  property


    accuracy  property


    rssi  property
DevCamp
CLBeaconRegion
Initializing the Beacon Region
!! – initWithProximityUUID:identifier:
!! – initWithProximityUUID:major:identifier:
!! – initWithProximityUUID:major:minor:identifier:
Accessing the Beacon Attributes


    proximityUUID  property


    major  property


    minor  property
Delivering Beacon Notifications


    notifyEntryStateOnDisplay  property
Getting Beacon Advertisement Data
!! – peripheralDataWithMeasuredPower:
DevCamp
Code
DevCamp
iDevice as an iBeacon
self.manager = [[CBPeripheralManager alloc] initWithDelegate:self queue:nil];
!
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@“666972D4-9BE7-4E7D-
A1D4-973E1285BE19"];
!
CLBeaconRegion *region = [[CLBeaconRegion alloc] initWithProximityUUID:uuid
major:1234
minor:12
identifier:@“My region”];
!
[self.manager startAdvertising:[region peripheralDataWithMeasuredPower:nil]];
!
[self.manager stopAdvertising];
DevCamp
Monitoring & Ranging
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@“666972D4-9BE7-4E7D-
A1D4-973E1285BE19"];
!
CLBeaconRegion *region = [[CLBeaconRegion alloc] initWithProximityUUID:uuid
identifier:@“My region”];
!
self.manager = [[CLLocationManager alloc] init];
self.manager.delegate = self;
[self.manager startMonitoringForRegion:region];
[self.manager requestStateForRegion:region];
DevCamp
- (void)locationManager:(CLLocationManager *)manager didDetermineState:
(CLRegionState)state forRegion:(CLRegion *)region
{
if (state == CLRegionStateInside)
{
NSLog(@“INSIDE REGION");
[manager startRangingBeaconsInRegion:(CLBeaconRegion *)region];
}
}
!
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion
*)region
{
NSLog(@“ENTER REGION");
[manager startRangingBeaconsInRegion:(CLBeaconRegion *)region];
}
!
- (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region
{
NSLog(@“EXIT REGION");
[manager stopRangingBeaconsInRegion:(CLBeaconRegion *)region];
}
DevCamp
- (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray
*)beacons inRegion:(CLBeaconRegion *)region
{
for (CLBeacon *beacon in beacons)
{
NSLog(@"%@ %@ %@ %zd %f",
beacon.major,
beacon.minor,
@[@"Unknown", @"Immediate", @"Near", @"Far"][beacon.proximity],
beacon.rssi,
beacon.accuracy);
}
}
DevCamp
Background mode
DevCamp
Background region monitoring
If a region boundary is crossed while an app isn’t running, that app
is relaunched into the background to handle the event.
In iOS, regions associated with your app are tracked at all times,
including when the app isn’t running.
Similarly, if the app is suspended when the event occurs, it’s woken
up and given a short amount of time (around 10 seconds) to handle
the event.
When necessary, an app can request more background execution
time using the beginBackgroundTaskWithExpirationHandler:
method of the UIApplication class.
DevCamp
but…
Region monitoring in background takes very long time to notify the
region change (up to 15min).
there is a little trick:
Set the notifyEntryStateOnDisplay toYES
the location manager sends beacon notifications when the user turns
on the display and the device is already inside the region.These
notifications are sent even if your app is not running.
DevCamp
Limitations
1. Signal interference
2. Very small data packets
3. Easy to sniff advertising packets
4. Easy to clone a beacon
DevCamp
Internet & Books
http://developer.radiusnetworks.com
http://estimote.com
https://www.bluetooth.org/en-us/specification/adopted-specifications
“Bluetooth Low Energy:The Developer's Handbook” (Heydon, Robin)
DevCamp
Link
!
facebook.com/pragmamark	

facebook.com/groups/pragmamark	



@pragmamarkorg	

!
!
http://pragmamark.org
DevCamp
NSLog(@”Thank you!”);
stefano.zanetti@pragmamark.org

Mais conteúdo relacionado

Semelhante a iBeacons - the new low-powered way of location awareness

IWAN Lab Guide
IWAN Lab GuideIWAN Lab Guide
IWAN Lab Guidejww330015
 
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
 
Indoor Wireless Localization - Zigbee
Indoor Wireless Localization - ZigbeeIndoor Wireless Localization - Zigbee
Indoor Wireless Localization - ZigbeeAlex Salim
 
How to Connect SystemVerilog with Octave
How to Connect SystemVerilog with OctaveHow to Connect SystemVerilog with Octave
How to Connect SystemVerilog with OctaveAmiq Consulting
 
R07_Senegacnik_CBO.pdf
R07_Senegacnik_CBO.pdfR07_Senegacnik_CBO.pdf
R07_Senegacnik_CBO.pdfcookie1969
 
Security Monitoring with eBPF
Security Monitoring with eBPFSecurity Monitoring with eBPF
Security Monitoring with eBPFAlex Maestretti
 
Netw 208 Success Begins / snaptutorial.com
Netw 208  Success Begins / snaptutorial.comNetw 208  Success Begins / snaptutorial.com
Netw 208 Success Begins / snaptutorial.comWilliamsTaylor65
 
[1C2]webrtc 개발, 현재와 미래
[1C2]webrtc 개발, 현재와 미래[1C2]webrtc 개발, 현재와 미래
[1C2]webrtc 개발, 현재와 미래NAVER D2
 
Athens IoT meetup #7 - Create the Internet of your Things - Laurent Ellerbach...
Athens IoT meetup #7 - Create the Internet of your Things - Laurent Ellerbach...Athens IoT meetup #7 - Create the Internet of your Things - Laurent Ellerbach...
Athens IoT meetup #7 - Create the Internet of your Things - Laurent Ellerbach...Athens IoT Meetup
 
Web Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdfWeb Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdfSamHoney6
 
Introduction to WebRTC
Introduction to WebRTCIntroduction to WebRTC
Introduction to WebRTCPatrick Cason
 
Using Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systemsUsing Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systemsSerge Stinckwich
 
OpenStack API's and WSGI
OpenStack API's and WSGIOpenStack API's and WSGI
OpenStack API's and WSGIMike Pittaro
 
The Ring programming language version 1.6 book - Part 7 of 189
The Ring programming language version 1.6 book - Part 7 of 189The Ring programming language version 1.6 book - Part 7 of 189
The Ring programming language version 1.6 book - Part 7 of 189Mahmoud Samir Fayed
 
Sunspot Final
Sunspot FinalSunspot Final
Sunspot Finalpauldeng
 
Score (smart contract for icon)
Score (smart contract for icon) Score (smart contract for icon)
Score (smart contract for icon) Doyun Hwang
 
Introducing the Sun SPOTs
Introducing the Sun SPOTsIntroducing the Sun SPOTs
Introducing the Sun SPOTsStefano Sanna
 

Semelhante a iBeacons - the new low-powered way of location awareness (20)

IWAN Lab Guide
IWAN Lab GuideIWAN Lab Guide
IWAN Lab Guide
 
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
 
Indoor Wireless Localization - Zigbee
Indoor Wireless Localization - ZigbeeIndoor Wireless Localization - Zigbee
Indoor Wireless Localization - Zigbee
 
How to Connect SystemVerilog with Octave
How to Connect SystemVerilog with OctaveHow to Connect SystemVerilog with Octave
How to Connect SystemVerilog with Octave
 
R07_Senegacnik_CBO.pdf
R07_Senegacnik_CBO.pdfR07_Senegacnik_CBO.pdf
R07_Senegacnik_CBO.pdf
 
Security Monitoring with eBPF
Security Monitoring with eBPFSecurity Monitoring with eBPF
Security Monitoring with eBPF
 
Netw 208 Success Begins / snaptutorial.com
Netw 208  Success Begins / snaptutorial.comNetw 208  Success Begins / snaptutorial.com
Netw 208 Success Begins / snaptutorial.com
 
[1C2]webrtc 개발, 현재와 미래
[1C2]webrtc 개발, 현재와 미래[1C2]webrtc 개발, 현재와 미래
[1C2]webrtc 개발, 현재와 미래
 
Athens IoT meetup #7 - Create the Internet of your Things - Laurent Ellerbach...
Athens IoT meetup #7 - Create the Internet of your Things - Laurent Ellerbach...Athens IoT meetup #7 - Create the Internet of your Things - Laurent Ellerbach...
Athens IoT meetup #7 - Create the Internet of your Things - Laurent Ellerbach...
 
Web Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdfWeb Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdf
 
Introduction to WebRTC
Introduction to WebRTCIntroduction to WebRTC
Introduction to WebRTC
 
Using Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systemsUsing Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systems
 
OpenStack API's and WSGI
OpenStack API's and WSGIOpenStack API's and WSGI
OpenStack API's and WSGI
 
MattsonTutorialSC14.pdf
MattsonTutorialSC14.pdfMattsonTutorialSC14.pdf
MattsonTutorialSC14.pdf
 
The Ring programming language version 1.6 book - Part 7 of 189
The Ring programming language version 1.6 book - Part 7 of 189The Ring programming language version 1.6 book - Part 7 of 189
The Ring programming language version 1.6 book - Part 7 of 189
 
Sunspot Final
Sunspot FinalSunspot Final
Sunspot Final
 
Node.js - As a networking tool
Node.js - As a networking toolNode.js - As a networking tool
Node.js - As a networking tool
 
Using iBeacons in Titanium
Using iBeacons in TitaniumUsing iBeacons in Titanium
Using iBeacons in Titanium
 
Score (smart contract for icon)
Score (smart contract for icon) Score (smart contract for icon)
Score (smart contract for icon)
 
Introducing the Sun SPOTs
Introducing the Sun SPOTsIntroducing the Sun SPOTs
Introducing the Sun SPOTs
 

Último

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
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
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 

Último (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
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
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 

iBeacons - the new low-powered way of location awareness

  • 1. Stefano Zanetti § DevCamp iBeacons the new low-powered way of location awareness
  • 2. DevCamp Stefano Zanetti  Apple iOS Developer Superpartes Innovation Campus & H-Farm !  Co-founder di # Pragma Mark ― www.pragmamark.org !  [tt] @stezanna
 [in] Stefano Zanetti
 [fb] stefano.znt 
 [email] stefano.zanetti@pragmamark.org
  • 3. DevCamp What is a Beacon? A Bluetooth LE radio, some minor electronic components and a button cell. That’s all!
  • 5. DevCamp How Beacons could change the world: 1. Your home will automatically react to you. 2. Your phone will give you a tour of museums. 3. Tickets that automatically load as you enter sporting events. 4. …
  • 7. DevCamp a lot of versions… • first stable version 1.2 (2003) • 2.0 + EDR (2004) • 2.1 + EDR (2007) • 3.0 + HS (2009) • 4.0 & 4.0 LE (2010)
  • 8. DevCamp ISM 2.4GHz This is in the globally unlicensed (but not unregulated) Industrial, Scientific and Medical (ISM) 2.4 GHz short-range radio frequency band 2400–2483.5 MHz
  • 9. DevCamp Mbit/s 0 7,5 15 22,5 30 version v1.2 v2.o+EDR v3.0+HS v4.0 v4 LE 0,3Mbit/s 24Mbit/s24Mbit/s 3Mbit/s1Mbit/s Speed
  • 10. DevCamp Other differences classic bluetooth bluetooth low energy latency 100ms 6ms total time to send data 100ms 3ms peak current consumption <30mA <15mA active slaves! 7 implementation dependent profile standard BT profile like SPP, DUN, PAN GATT: Generic Attribute profile paring YES NO
  • 11. DevCamp Single and Double mode Classic and low energy BT are not compatible with each other Single-mode devices Classic OR low energy radio Double-mode devices Classic AND low energy radio
  • 12. DevCamp Connectionless Devices do not need to maintain a connection for useful information to be exchanged quickly between them The connectionless model solves these problems by not defining the state of a connection, but the state of the device
  • 13. DevCamp Stateless Any client can send any request at any time and the server will respond to the same request in exactly the same way, regardless of which client made the request.
  • 15. DevCamp Advertising packet • Preamble - 1 Byte - fixed 8bit to synchronize bit timing and set radio’s automatic gain control. 101010101 or 010101010 • Access Address - 4 Bytes - 32 fixed and random bit. 0x8E89BED6 (that in binary is 01101011011111011001000101110001.The preamble would be 01010101) • Header - 1 Byte - to describe the contents of packet • Length - 1 Byte - to describe the payload length • CRC - 3 Bytes: checksum calculated over PDU • PDU (Protocol Data Unit) - 37 Bytes
  • 17. DevCamp iBeacon is a new technology that extends Location Services in iOS iBeacons provide a way to create and monitor beacons that advertise certain identifying information using Bluetooth low energy wireless technology (ref. iOS 7: Understanding Location Services - Apple)
  • 18. DevCamp example of iBeacon PDU 9F436059ADC00201061AFF4C000215B9407F30F5F8466EAFF925556B57FE6D010000FFB6 9F436059ADC0: Beacon’s Bluetooth MAC address 02: Length of the next field 01: Flags field identifier 06: Flags (LE General Discoverable Mode) 1A: Length of the next field FF: Manufacturer Specific Data field identifier 4C00: Apple’s ID 0215: Two fixed bytes B9407F30F5F8466EAFF925556B57FE6D: Proximity UUID 0100: Major 00FF: Minor B6: Measured power
  • 21. DevCamp CLBeacon Identifying the Beacon    proximityUUID  property    major  property    minor  property ! Determining the Beacon Distance    proximity  property    accuracy  property    rssi  property
  • 22. DevCamp CLBeaconRegion Initializing the Beacon Region !! – initWithProximityUUID:identifier: !! – initWithProximityUUID:major:identifier: !! – initWithProximityUUID:major:minor:identifier: Accessing the Beacon Attributes    proximityUUID  property    major  property    minor  property Delivering Beacon Notifications    notifyEntryStateOnDisplay  property Getting Beacon Advertisement Data !! – peripheralDataWithMeasuredPower:
  • 24. DevCamp iDevice as an iBeacon self.manager = [[CBPeripheralManager alloc] initWithDelegate:self queue:nil]; ! NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@“666972D4-9BE7-4E7D- A1D4-973E1285BE19"]; ! CLBeaconRegion *region = [[CLBeaconRegion alloc] initWithProximityUUID:uuid major:1234 minor:12 identifier:@“My region”]; ! [self.manager startAdvertising:[region peripheralDataWithMeasuredPower:nil]]; ! [self.manager stopAdvertising];
  • 25. DevCamp Monitoring & Ranging NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@“666972D4-9BE7-4E7D- A1D4-973E1285BE19"]; ! CLBeaconRegion *region = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:@“My region”]; ! self.manager = [[CLLocationManager alloc] init]; self.manager.delegate = self; [self.manager startMonitoringForRegion:region]; [self.manager requestStateForRegion:region];
  • 26. DevCamp - (void)locationManager:(CLLocationManager *)manager didDetermineState: (CLRegionState)state forRegion:(CLRegion *)region { if (state == CLRegionStateInside) { NSLog(@“INSIDE REGION"); [manager startRangingBeaconsInRegion:(CLBeaconRegion *)region]; } } ! - (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region { NSLog(@“ENTER REGION"); [manager startRangingBeaconsInRegion:(CLBeaconRegion *)region]; } ! - (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region { NSLog(@“EXIT REGION"); [manager stopRangingBeaconsInRegion:(CLBeaconRegion *)region]; }
  • 27. DevCamp - (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region { for (CLBeacon *beacon in beacons) { NSLog(@"%@ %@ %@ %zd %f", beacon.major, beacon.minor, @[@"Unknown", @"Immediate", @"Near", @"Far"][beacon.proximity], beacon.rssi, beacon.accuracy); } }
  • 29. DevCamp Background region monitoring If a region boundary is crossed while an app isn’t running, that app is relaunched into the background to handle the event. In iOS, regions associated with your app are tracked at all times, including when the app isn’t running. Similarly, if the app is suspended when the event occurs, it’s woken up and given a short amount of time (around 10 seconds) to handle the event. When necessary, an app can request more background execution time using the beginBackgroundTaskWithExpirationHandler: method of the UIApplication class.
  • 30. DevCamp but… Region monitoring in background takes very long time to notify the region change (up to 15min). there is a little trick: Set the notifyEntryStateOnDisplay toYES the location manager sends beacon notifications when the user turns on the display and the device is already inside the region.These notifications are sent even if your app is not running.
  • 31. DevCamp Limitations 1. Signal interference 2. Very small data packets 3. Easy to sniff advertising packets 4. Easy to clone a beacon