Reply
Thread Tools
Posts: 13 | Thanked: 5 times | Joined on Oct 2009
#1
Hi,

I'm trying to use bluetooth to determine what devices are around me (context awareness). For this purpose I use bluez api in a way that I turn bt on, start device scanning and than I catch signals DeviceFound. The problem is that this signal is emitted only if devices are not paired. If for example I have my computer which has been paired with my phone I won't get signal that this device has been found.

The question is: how can I determine if known devices are in range (in a nice way ) - any ideas?

My first idea was to try to connect to every possible known device and catch errors but this is not the thing...


Thank you for your answers,
Best regards,
Skomialek
 
aboaboit's Avatar
Posts: 129 | Thanked: 60 times | Joined on Jul 2009 @ Castello d'Argile (BO)
#2
Originally Posted by skomialek View Post
The question is: how can I determine if known devices are in range (in a nice way ) - any ideas?
An acceptable way would be to ping it but that would still be polling. Unless all known devices are instructed to reconnect automatically, I guess you can't rely on a passive notification.
 

The Following User Says Thank You to aboaboit For This Useful Post:
Posts: 13 | Thanked: 5 times | Joined on Oct 2009
#3
Originally Posted by aboaboit View Post
An acceptable way would be to ping it but that would still be polling. Unless all known devices are instructed to reconnect automatically, I guess you can't rely on a passive notification.
Is there any way to simply 'ping' the device using bluez api (I mean without manual connect/disconnect procedure)
 
Posts: 605 | Thanked: 137 times | Joined on Nov 2005 @ La Rochelle, France
#4
I suppose you could look at BlueProximity ...
 
Posts: 13 | Thanked: 5 times | Joined on Oct 2009
#5
Originally Posted by fredoll View Post
I suppose you could look at BlueProximity ...
Thanks, but I'm not looking for a desktop app. What I'm trying to do is to make maemo based device aware what BT devices are in its range
 
Khertan's Avatar
Posts: 1,012 | Thanked: 817 times | Joined on Jul 2007 @ France
#6
You can simply do a bluetooth scan ... which will give you a list of device at promity with their mac address ... store this and compare.
 

The Following 2 Users Say Thank You to Khertan For This Useful Post:
Posts: 15 | Thanked: 48 times | Joined on Nov 2009 @ United Kingdom
#7
Originally Posted by Khertan View Post
You can simply do a bluetooth scan ... which will give you a list of device at promity with their mac address ... store this and compare.
Only ones which are set to discoverable. Even if you're paired, but the other device is not discoverable, you won't see it this way.

Since non-discoverable devices will only respond to direct requests, the only way to see them is with direct requests such as L2CAP echo requests (aka bluetooth ping.) Sure, this is polling, but repeated scans are also a form of polling.
 
Posts: 605 | Thanked: 137 times | Joined on Nov 2005 @ La Rochelle, France
#8
Originally Posted by skomialek View Post
Thanks, but I'm not looking for a desktop app. What I'm trying to do is to make maemo based device aware what BT devices are in its range
I was thinking that you could look the source code ...
 
Posts: 13 | Thanked: 5 times | Joined on Oct 2009
#9
Originally Posted by Khertan View Post
You can simply do a bluetooth scan ... which will give you a list of device at promity with their mac address ... store this and compare.
yes ... this is what i've been do' . it turns out that it lists paired devices but doesn't list connected ones (but those I can check in device properties) . The problem was probably in my other phone's bt power saving properties. If I leave the phone and don't use it it doesn't get detected ... when I was angry that it doesn't get detected I simply removed pairing on both devices and this way bt got awaken ...

sorry for bothering you... problem solved (actually it's never existed..)

Best regards,
Skomialek
 
Posts: 15 | Thanked: 48 times | Joined on Nov 2009 @ United Kingdom
#10
Originally Posted by fredoll View Post
I was thinking that you could look the source code ...
http://blueproximity.svn.sourceforge...py?view=markup

It seems to establish an rfcomm connection to the known device, in order to get the signal strength (RSSI) and make an estimation of the distance to the device.
 
Reply


 
Forum Jump


All times are GMT. The time now is 15:32.