2007-03-31 19:58:17

by Robert Rawlins

[permalink] [raw]
Subject: Re: [Bluez-users] Multithread Service Discovery

Hello Guys,

Thank you both for your replies, this is interesting stuff.

I spent some time this afternoon playing around with multithreading an SDP enquiry, whilst i've almost got it working, when i use the loop to initiate the threads they all seem to get their arguments mixed up, so when i loop through the join i get the wrong details returned, they all list the same mac address but with different channels, unfortunately i'm away from my code at the moment so cant post any samples.

Basically i'm trying to do a device discovery, and then SDP each of the devices to obtain the obex channel, which i can then use to push a file to, and i'm looking to have it do this as quickly as possible.

What would you recommend the best method for something like this? At the moment i'm using a C program, a large amount of the code from it is stripped out of an excellent article written by Albert Huang found here http://people.csail.mit.edu/albert/bluez-intro/c401.html.

I note that a lot of people recently have been talking about the D-Bus API, is this something i should perhaps be using? does it suite my requirements?

I've looked through the API documentation and it appears to have some excellent functions, however as novice C programmer, I'm a little bit lost as to where i might start with integrating the API into my application.

Thanks again for any help guys,

Rob
_________________________________________________________________
Try Live.com: where your online world comes together - with news, sports, weather, and much more.
http://www.live.com/getstarted


Attachments:
(No filename) (345.00 B)
(No filename) (164.00 B)
Download all attachments

2007-03-31 20:44:36

by Loreno Oliveira

[permalink] [raw]
Subject: Re: [Bluez-users] Multithread Service Discovery

Hi Robert,

don't know if I understood your needs. Let me check. You have a client
device A that needs to inquiy neraby devices and check which of them have a
certain service of interest of A. once found such devices, A will connect to
each and consume the service. Is that right?

If this is your situation, I dealt with the same scenario some days ago in
the project I am developing. In my case, to avoid connect and query all the
devices foind during inquiry about the presence of a certain service, I
changed the device class of the devices that have the service I need. So, my
discovering phase now is quite efficient, because along with the information
of remote devices, gotten after inquiry, that are the bits that describe the
class of the remote device. So I can now discard all the devices that do not
have the bit that describe availability of a service I need.

Well, this is just my experience. In me scenario this solution is feasible
because the requeriments of my project allow it. Maybe it can be applied to
your project, maybe not :-)

Cheers!

Loreno

On 3/31/07, Robert Rawlins <[email protected]> wrote:
>
> Hello Guys,
>
> Thank you both for your replies, this is interesting stuff.
>
> I spent some time this afternoon playing around with multithreading an SDP
> enquiry, whilst i've almost got it working, when i use the loop to initiate
> the threads they all seem to get their arguments mixed up, so when i loop
> through the join i get the wrong details returned, they all list the same
> mac address but with different channels, unfortunately i'm away from my code
> at the moment so cant post any samples.
>
> Basically i'm trying to do a device discovery, and then SDP each of the
> devices to obtain the obex channel, which i can then use to push a file to,
> and i'm looking to have it do this as quickly as possible.
>
> What would you recommend the best method for something like this? At the
> moment i'm using a C program, a large amount of the code from it is stripped
> out of an excellent article written by Albert Huang found here
> http://people.csail.mit.edu/albert/bluez-intro/c401.html.
>
> I note that a lot of people recently have been talking about the D-Bus
> API, is this something i should perhaps be using? does it suite my
> requirements?
>
> I've looked through the API documentation and it appears to have some
> excellent functions, however as novice C programmer, I'm a little bit lost
> as to where i might start with integrating the API into my application.
>
> Thanks again for any help guys,
>
> Rob
>
> ------------------------------
> With Live Spaces email straight to your blog. Upload jokes, photos and
> more. It's free! It's free!<http://specials.uk.msn.com/spaces/default.aspx+>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Bluez-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-users
>
>


Attachments:
(No filename) (3.22 kB)
(No filename) (4.30 kB)
(No filename) (345.00 B)
(No filename) (164.00 B)
Download all attachments

2007-04-01 07:01:55

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] Multithread Service Discovery

Hi Robert,

> I spent some time this afternoon playing around with multithreading an
> SDP enquiry, whilst i've almost got it working, when i use the loop to
> initiate the threads they all seem to get their arguments mixed up, so
> when i loop through the join i get the wrong details returned, they
> all list the same mac address but with different channels,
> unfortunately i'm away from my code at the moment so cant post any
> samples.
>
> Basically i'm trying to do a device discovery, and then SDP each of
> the devices to obtain the obex channel, which i can then use to push a
> file to, and i'm looking to have it do this as quickly as possible.

if you only have one Bluetooth adapter then you have to do SDP service
search for one device at a time. There is no other way. You can't do
this simultaneous. Period. And explained why.

> What would you recommend the best method for something like this? At
> the moment i'm using a C program, a large amount of the code from it
> is stripped out of an excellent article written by Albert Huang found
> here http://people.csail.mit.edu/albert/bluez-intro/c401.html.
>
> I note that a lot of people recently have been talking about the D-Bus
> API, is this something i should perhaps be using? does it suite my
> requirements?

The D-Bus API makes this a lot easier since it takes care of all the
stuff that otherwise you have to think about. For example the different
Bluetooth versions etc. You can also sort the device list after inquiry
via the RSSI to check the devices near by you first.

> I've looked through the API documentation and it appears to have some
> excellent functions, however as novice C programmer, I'm a little bit
> lost as to where i might start with integrating the API into my
> application.

The bluez-utils source package contains enough examples on how to use
D-Bus within C code. However it is faster to use it from within Python.

Regards

Marcel



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users