Bluetooth presence detection

I recently found my USB Bluetooth adapter and have been tinkering with using it to talk to my Palm. I’ve successfully configured Linux to allow PPP connections over Bluetooth, so I can sync my Palm if I don’t have the cradle hooked up.

But a more interesting use for Bluetooth is presence detection. BlueProximity is a project that will establish a connection to a device and use it to trigger Gnome’s screensaver. When you leave the room the screensaver locks, and when you come back it unlocks. Nifty idea in theory, but it renders my Palm useless while I’m in the room — it displays a “Connecting” dialog that blocks use of anything else. While BlueProximity can be disabled with a few mouse clicks, why would I want to go through the hassle of disabling and enabling something that’s supposed to make my life easier? It’s far fewer steps to, say, hit a key combination to lock and enter my password to unlock.

But it’s not always necessary to make a connection. hcitool allows you to, for example, query device names by Bluetooth address. If it can get a response we assume that the device is in range. I’ve employed this technique in a script I’ve been maintaining over some years for myself. I trigger it from cron at certain times and it raises my volume to 90% and loops over a Spin Doctors song — a pretty effective alarm clock. What if I get up early and leave though? My neighbors probably wouldn’t appreciate hearing music that loud that early until I get back (however good the music may be). So last night I added a conditional that checks if my Palm is in range of my computer. It will only continue if it sees my Palm. And since I take my Palm everywhere, leaving my dorm room effectively disables my alarm clock. Neat.

I wonder if BlueProximity could be patched to allow picking between connection-based and name-discovery-based detection. This kind of tool has a lot of cool applications, such as setting Pidgin away when I leave and setting it available when I get back.

Better would be a “presence” D-Bus service that could be configured using a variety of presence-detection systems (such as checking for a Bluetooth device) and would fire an event when the user leaves or returns. Any interested application could be notified of user presence changes.

2 Replies to “Bluetooth presence detection”

  1. I recently started using blueproximity, too. I have the same problem with the always-on nature of the connection. So I looked at the source… Yikes! I was hoping it would be pretty straightforward to replace the hcitool calls, but it isn’t to someone with my level of familiarity with Python (read: none).

    Any idea where I can find a Bluetooth lib for c#/Mono?

  2. Hi guys,

    I am in serious work at the moment getting my bachelor degree done. I will have more time for blueproximity once I’ve finished university. It should take about two weeks. You are invited to help me with developing in explaning how you think detection should be alternatively configured to. (The given approach has some security advantages…)

    Please drop me a line at sourceforge or launchpad if you are still interested.

    Bye
    Lars

Comments are closed.