| 1 |
Bluetooth Monitor System |
| 2 |
------------------------ |
| 3 |
|
| 4 |
This comprises a daemon which monitors the status of a Bluetooth device (such |
| 5 |
as a mobile phone) and emits DBUS signals when the device gets within a certain |
| 6 |
threshold distance of the computer, a client program can start and stop |
| 7 |
programs in response to these signals and a program which can query the status |
| 8 |
of a device. The device must be paired with your computer. When starting the |
| 9 |
daemon you specify the Bluetooth address of the device and a threshold; the |
| 10 |
client you start with the Bluetooth address and programs to run whenever it |
| 11 |
crosses the threshold. |
| 12 |
|
| 13 |
IPC is done over DBUS, so anything which can use DBUS can trap signals from |
| 14 |
the daemon and query the status (see bluemon-dbus(7)) The XML |
| 15 |
protocol description file is installed to |
| 16 |
$PREFIX/usr/share/doc/bluemon/bluemon-dbus.xml |
| 17 |
|
| 18 |
Installation |
| 19 |
------------ |
| 20 |
|
| 21 |
See INSTALL |
| 22 |
|
| 23 |
Configuration |
| 24 |
------------- |
| 25 |
|
| 26 |
There is an example config file and init script in bluemon.default and |
| 27 |
bluemon.init (these are installed in $PREFIX/usr/share/doc/bluemon/examples/). |
| 28 |
The config file is just a convenience since all parameters must be passed on |
| 29 |
the command line. The command line syntax for bluemon, bluemon-client and |
| 30 |
bluemon-query is documented in the section 1 manpages. |
| 31 |
|
| 32 |
Starting Bluemon |
| 33 |
---------------- |
| 34 |
|
| 35 |
The sample initscript should be copied to the system initscript directory and |
| 36 |
used to start the program. It uses a config file to read the parameters to pass |
| 37 |
to the program. The config file is searched for as /etc/default/bluemon, |
| 38 |
/etc/bluemon.conf or /etc/bluemon/bluemon.conf. If not, use man or --help to |
| 39 |
decide which parameters you wish to use. A good sample command line is: |
| 40 |
|
| 41 |
bluemon -qai 100 -t 210 -b BLUETOOTHADDR |
| 42 |
|
| 43 |
as root, and then as a user: |
| 44 |
|
| 45 |
bluemon-client -u "UP COMMAND" -d "DOWN COMMAND" -b BLUETOOTHADDR |
| 46 |
|
| 47 |
where UP COMMAND is executed when the signal passes the threshold upwards |
| 48 |
and DOWN COMMAND when it passes the threshold downwards. |
| 49 |
|
| 50 |
Running bluemon with no session |
| 51 |
------------------------------- |
| 52 |
|
| 53 |
If you want to run bluemon as a purely system component, without having a |
| 54 |
session or a login to run the client program, you can. Simply run the client command from an initscript in the background: |
| 55 |
|
| 56 |
start-stop-daemon --start -x /usr/bin/bluemon-client -p /var/run/bluemon-client.pid -b -d / -m -- -u "UP COMMAND" -d "DOWN COMMAND" -b BLUETOOTHADDR |
| 57 |
|
| 58 |
and to stop it: |
| 59 |
|
| 60 |
start-stop-daemon --stop -x /usr/bin/bluemon-client -p /var/run/bluemon-client.pid |
| 61 |
|
| 62 |
you can add a -c parameter to start-stop-daemon to run it as a non-root user. |
| 63 |
|
| 64 |
Up/Down Commands |
| 65 |
---------------- |
| 66 |
|
| 67 |
The Up command is executed when the link quality becomes good. The Down command |
| 68 |
is executed when the link quality becomes bad. |
| 69 |
|
| 70 |
Thresholds |
| 71 |
---------- |
| 72 |
|
| 73 |
The system works by sampling the signal strength of the Bluetooth connection |
| 74 |
and then using a user-defined threshold to decide on whether the device is 'in |
| 75 |
range' or not. Threshold values are in the range 0-255. Higher values indicate |
| 76 |
a more sensitive system which requires the device to be in close proximity. |
| 77 |
Lower values are less sensitive and will consider the device to be `in range' |
| 78 |
even if it is quite a long way away. Features such as doors and walls cut the |
| 79 |
signal strength such that a threshold of 'in the same room' is easy to achieve. |
| 80 |
Testing suggests that values of around 210 for the threshold is good. For more |
| 81 |
detail you can read section 4.1 of my paper on the subject |
| 82 |
(http://www.matthew.ath.cx/publications/2005-JohnsonSta-hats.pdf) |
| 83 |
|
| 84 |
Comments Etc |
| 85 |
------------ |
| 86 |
|
| 87 |
To Matthew Johnson <[email protected]> |