Proximity detection with Bluetooth and Perl
The attached code was used to demonstrate Bluetooth proximity detection with Perl at the Birmingham Perl Mongers technical meeting on 29 October 2003. View the slides from the talk at http://perl.jonallen.info/talks. The program checks the RSSI (Received Signal Strength Indicator) of your Bluetooth device once every two seconds. If two consecutive measurements fall outside a pre-determined threshold, then the screensaver will be activated. System requirements:- Perl
- Linux
- XScreenSaver
- Inline::C
- BlueZ Bluetooth stack
xscreensaver.pl bluetooth_mac_address
Please note that the program must be run as root to allow access to the HCI layer of the Bluetooth protocol stack.
Edit the source code to reflect the location of the Bluetooth library (libbluetooth.so) on your system, and the required RSSI threshold level (-10 works well with most phones).
Update: 23 November 2003
Many thanks to Jimmy Hedman, who reported that the code requires this patch to compile.
Copyright © 2003-2008 Jon Allen (JJ)
Last site update was on 07 May 2008 - 10:18 What's new?