A simple daemon which accepts commands from a paired bluetooth client.
$ sudo apt-get install python-bluez bluez python-gobject python-dbus python-daemon
-
Make sure Bluetooth is enabled on the phone/laptop.
-
Make sure Bluetooth on your phone/pc/laptop is discoverable.
-
On an Android phone, go to settings→Bluetooth. Make device discoverable (visible). The device only remains discoverable for a short time.
./finddevice.py
-
Temporarily:
bluez-simple-agent hci# xx:xx:xx:xx:xx:xx
-
Permanently:
sudo bluez-test-device trusted xx:xx:xx:xx:xx:xx yes
$ hostname prsg2 $ sudo hciconfig hci0 piscan $ hciconfig -a ... UP RUNNING PSCAN ISCAN ... $ bluez-simple-agent
-
Select settings→Bluetooth→SCAN.
-
Look for the host name from the hostname command above.
-
Click to connect with device. On the phone a dialog box appears. 'Bluetooth Pairing Request', Confirm passkey is 999999 to pair with prsg. DO NOT CLICK 'OK' ON PHONE yet. Back to the Pi.
$ bluez-simple-agent not registered RequestConfirmation (/org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX, 999999) Confirm passkey (yes/no) yes ^C
-
Use the Ctrl+C to terminate bluez-simple-agent.
-
Daemon implements start/stop/restart. To start daemon on Pi, type:
$ ./daemon-rxcmd.py start
-
Type this command with the address of the Pi:
./rxcmd.py xx:xx:xx:xx:xx:xx
You can now enter commands:
Talking to: rosrov1-0. Hit enter to send, 'esc' to quit command001