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
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
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.