Quick tutorial step-by-step for setting up a Raspberry Pi device to be controlled over BlueTooth. You will need the source code from https://github.com/matzpersson/pinet-toothd and if you want to see it work over bluetooth, you will need the piNet app from AppStore. Only available for iOS at this stage.
This assumes that you have already done a base Jessie install and are ready to download the piNet repo from GitHub onto your Raspberry Pi.
Update Rasbian
Getting started with making sure you have latest installs on your Raspberry and reboot:
apt-get update apt-get upgrade apt-get install -y libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev git
Install Bluez 5.37. I could not go much higher in version as it broke bluetooth on the RPI at the time of installation:
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.37.tar.xz tar xvf bluez-5.37.tar.xz cd bluez-5.37 ./configure make make install
Edit the bluetooth.service file at /lib/systemd/system/bluetooth.service:
[Unit] Description=Bluetooth service Documentation=man:bluetoothd(8) ConditionPathIsDirectory=/sys/class/bluetooth [Service] Type=dbus BusName=org.bluez ExecStart=/usr/local/libexec/bluetooth/bluetoothd --experimental -d NotifyAccess=main #WatchdogSec=10 #Restart=on-failure CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE LimitNPROC=1 [Install] WantedBy=bluetooth.target Alias=dbus-org.bluez.service
Install the dbus packages required to setup GATT services:
apt-get install python-dev libdbus-1-dev libdbus-glib-1-dev python-pip python-gi python2.7 -m pip install dbus-python systemctl daemon-reload systemctl restart bluetooth
Download the source code from GitHub into your application directory. Im chucking it into /var/lib:
mkdir /var/lib/pinet cd /var/lib/pinet git clone https://github.com/matzpersson/pinet-toothd.git
Run toothd.py
python toothd.py
You can now go an grab the piNet app from the AppStore and try it out.