Public Repository

Last pushed: 9 months ago
Short Description
Use a docker container for Raspberry Pi (ARM) with ibeacon configured inside.
Full Description

This image is only tested with a Raspberry Pi 3 (builtin bluetooth) running the hypriot-os.

The Dockerfile:

FROM fgabriel/rpi-armv7hf-debian-qemu
MAINTAINER Ferdinand Gabriel f.gabriel@gidea.at

RUN [ "cross-build-start" ]

VOLUME /config

RUN mkdir -p /usr/src/app/build
WORKDIR /usr/src/app

RUN sed -i "s/httpredir.debian.org/debian.ethz.ch/" /etc/apt/sources.list && apt-get clean && apt-get update && apt-get install -y --no-install-recommends bluez bluetooth sudo && apt-get clean && rm -rf /var/lib/apt/lists/ /tmp/ /var/tmp/*

RUN rm -rf /tmp/*

COPY run.sh .

CMD [ "/usr/src/app/run.sh" ]

RUN [ "cross-build-end" ]

The run.sh script :

#!/bin/bash
source /config/bluetooth_le.config

sudo hciconfig hci0 up
sudo hciconfig hci0 leadv 3
sudo hciconfig hci0 noscanc

sudo hcitool -i hci0 cmd $bluetooth_le_begin_command $bluetooth_le_length $bluetooth_le_company $bluetooth_le_uuid $bluetooth_le_major $bluetooth_le_minor $bluetooth_le_txpower $bluetooth_le_end_command

tail -f -n0 /etc/hosts

Before you use this image please configure your iBeacon with the creation of a file named bluetooth_le.config in a special configuration directory. The file must include following parameters:

bluetooth_le_begin_command="0x08 0x0008"
bluetooth_le_length="1E 02 01 1A 1A"
bluetooth_le_company="FF 4C 00 02 15"
bluetooth_le_uuid="64 af ff ab cd c4 b2 b7 8f fo cd 9f ab cd de fa"
bluetooth_le_major="00 00"
bluetooth_le_minor="00 00"
bluetooth_le_txpower="C8"
bluetooth_le_end_command="00"

You can leave most parameters untouched, except the parameter bluetooth_le_uuid. You can generate an uuid on a Mac with:

python -c 'import sys,uuid;sys.stdout.write(uuid.uuid4().hex)'|pbcopy && pbpaste && echo

The docker images can be started with following command:

docker run -d -it --name iBeacon --net=host --privileged --restart=always -v [your directory with the file bluetooth_le.config]:/config fgabriel/rpi-ibeacon:latest

--privileged is needed because there is a bluetoothd process already running on the host. Otherwise we cannot initialize hci0 inside of the container.

Docker Pull Command
Owner
fgabriel

Comments (0)