PyBeac n
Eddystone Protocol implementation in Python




- Prabhanshu Attri
Agenda
- What are Beacons?
- Eddystone Protocol: What's the fuss all about?
- Making Beacons Useful and demo
- PyBeacons
- Demo of PyBeacons

artstation.com
What is a beacon?
- A beacon is a small Bluetooth radio transmitter. It's kind of like a lighthouse: it repeatedly transmits a single signal that other devices can see.
Giphy.com





https://www.youtube.com/user/GoogleDevelopers
- An open beacon format developed by Google
- Can be detected by both Android and iOS devices
-
Available Frame formats
- Eddystone-UID: A unique, static ID
- Eddystone-URL: A compressed URL
- Eddystone-TLM: Beacon status data
- Eddystone-EID: A time-varying beacon




URL
https://xprss.org/starwars

URL







| Kitkat and up | |
| iOS 8 and up (With chrome or app) | |
| version 49+ | |
| Bluetooth enabled device | preferred Bluetooth 4.0 and up |











| Open Source | Proprietary |
| All four frame types work with iOS and Android. | Official only works with iOS |
| Transmits: Eddystone-URL, Eddystone-UID, Eddystone-EID and Eddystone-TLM | Transmits: UUID, Major (4 digits) and Minor (4 digits) |
| Eddystone URL doesn't require app | Requires app |
| EID changes frequently which can be decoded by authorized clients | EID isn't supported |
| APIs released by Google: Nearby API and Proximity Beacon API | No specific APIs |
| Flexible but requires more complicated programming | Simple to implement |

URL
| Byte offset | Field | Description |
|---|---|---|
| 0 | Frame Type | Value = 0x10 |
| 1 | TX Power | Calibrated Tx power at 0 m |
| 2 | URL Scheme | Encoded Scheme Prefix |
| 3+ | Encoded URL | Length 1-17 |
Frame Specification
URL Scheme Prefix
| Decimal | Hex | Expansion |
|---|---|---|
| 0 | 0x00 | http://www. |
| 1 | 0x01 | https://www. |
| 2 | 0x02 | http:// |
| 3 | 0x03 | https:// |
| Expansion | .com/ | .org/ | .edu/ | .net/ | .info/ | .biz/ | .gov/ |
| Hex | 0x0 | 0x01 | 0x02 | 0x03 | 0x04 | 0x05 | 0x06 |
| Expansion | .com | .org | .edu | .net | .info | .biz | .gov |
| Hex | 0x07 | 0x08 | 0x09 | 0x10 | 0x11 | 0x12 | 0x13 |
| Decimal | Hex | Expansion |
|---|---|---|
| 0 | 0x00 | .com/ |
| 1 | 0x01 | .org/ |
| 2 | 0x02 | .edu/ |
| 3 | 0x03 | .net/ |
| 4 | 0x04 | .info/ |
| 5 | 0x05 | .biz/ |
| 6 | 0x06 | .gov/ |
| 7 | 0x07 | .com |
| 8 | 0x08 | .org |
| 9 | 0x09 | .edu |
| 10 | 0x01 | .net |
| 11 | 0x0b | .info |
| 12 | 0x0c | .biz |
| 13 | 0x0d | .gov |
| 14..32 | 0x0e..0x20 | Reserved for Future Use |
| 127..255 | 0x7F..0xFF | Reserved for Future Use |
Eddystone-URL HTTP URL encoding
| Alphabet | Hex |
|---|---|
| a | 61 |
| b | 62 |
| c | 63 |
| d | 64 |
| e | 65 |
| f | 66 |
| g | 67 |
| h | 68 |
| i | 69 |
| j | 6A |
| k | 6B |
| l | 6C |
| m | 6D |
| n | 6E |
| o | 6F |
| p | 70 |
| q | 71 |
| Alphabet | Hex |
|---|---|
| r | 72 |
| s | 73 |
| t | 74 |
| u | 75 |
| v | 76 |
| w | 77 |
| x | 78 |
| y | 79 |
| z | 7A |


https://www.raspberrypi.org
| Expansion | Hex |
|---|---|
| https://www. | 01 |

https://www.raspberrypi.org
| Expansion | Hex |
|---|---|
| https://www. | 01 |
| r | 72 |
| a | 61 |
| s | 73 |
| p | 70 |
| b | 62 |
| e | 65 |
| r | 72 |
| r | 72 |
| y | 79 |
| p | 70 |
| i | 69 |

https://www.raspberrypi.org
| Expansion | Hex |
|---|---|
| https://www. | 01 |
| r | 72 |
| a | 61 |
| s | 73 |
| p | 70 |
| b | 62 |
| e | 65 |
| r | 72 |
| r | 72 |
| y | 79 |
| p | 70 |
| i | 69 |
| .org | 08 |

https://eddyst.one
PyBeac n
- Python package for scanning and advertising Eddystone-URL and Eddystone-UID.
-
Dependencies:
- Bluez
- Python3

PyBeac n
- Installation:
sudo pip install PyBeacon
- Upgrade:
sudo pip install PyBeacon --upgrade
- Usage:

PyBeacon [-h] [-u [URL]] [-s] [-t] [-o] [-v] [-V]
optional arguments:
-h, --help show this help message and exit
-u [URL], --url [URL] URL to advertise.
-i [UID], --uid [UID] UID to advertise.
-s, --scan Scan for URLs.
-t, --terminate Stop advertising URL.
-o, --one Scan one URL only.
-v, --version Version of PyBeacon.
-V, --Verbose Print lots of debug output.PyBeac n

Demo
https://xprss.org/pybeacon
PyBeac n
Implementations based on
- PyBTSteward
- Repo: https://github.com/wolfspyre/PyBTSteward
- Pikiosk
- Repo: https://hayvalley.io/chromium-kiosk/
- Blog: https://github.com/chriso0710/pikiosk

PyBeac n
Blogs about
- https://www.schlafhacking.de/wiki/index.php/BLE-Indoor-Navigation
- http://mabushiisign.hatenablog.jp/entry/2016/09/17/100446
- https://bbs.nextthing.co/t/how-to-create-a-eddystone-beacon-with-your-chip/5141/10
- https://www.linkedin.com/pulse/turn-raspberrypi-3-bluetooth-beacon-john-paavo-tengström/
- https://medium.com/@urish/exploring-the-physical-web-without-buying-beacons-efae51e36c2e
- https://blog-giwisoft.rhcloud.com/beacons-android-ubuntu/
- https://www.mybridge.co/view/124318

Thank you

PyBeacon Repo: https://xprss.org/pybeacon
Eddystone Repo: https://xprss.org/eddystone
@PrabhanshuAttri
prabhanshu.com
@PrabhanshuAttri
PyBeacon: Eddystone Protocol implementation in Python
By Prabhanshu Attri
PyBeacon: Eddystone Protocol implementation in Python
PyBeacon is an Eddystone implementation in Python for Linux systems. Using this, Linux systems can be used as a beacon or a beacon scanner. https://xprss.org/pycon2017
- 4,042