* [Bluez-users] Multithread Service Discovery
@ 2007-03-30 19:33 Robert Rawlins
2007-03-30 19:45 ` Malte Steiner
0 siblings, 1 reply; 10+ messages in thread
From: Robert Rawlins @ 2007-03-30 19:33 UTC (permalink / raw)
To: bluez-users
[-- Attachment #1.1: Type: text/plain, Size: 825 bytes --]
Hello Chaps,
I'm currently running a C program for service discovery on a list of devices. The function loops through the list elements and performs an SDP enquiry on each device and returns the results to the screen, but I'm finding that if i get a slow device in the list it can hold things up a little, and in general it would be fantastic to hit all the devices with an enquiry simultaneously.
What's the best method for multithreading this procedure to perform a discovery on several devices at once?, is this even possible? I'd appreciate any suggestions of tales of previous experiences,
Thanks again,
Rob
_________________________________________________________________
Try Live.com - your fast, personalized homepage with all the things you care about in one place.
http://www.live.com/getstarted
[-- Attachment #1.2: Type: text/html, Size: 1020 bytes --]
[-- Attachment #2: Type: text/plain, Size: 345 bytes --]
-------------------------------------------------------------------------
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
[-- Attachment #3: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bluez-users] Multithread Service Discovery
2007-03-30 19:33 [Bluez-users] Multithread Service Discovery Robert Rawlins
@ 2007-03-30 19:45 ` Malte Steiner
2007-03-31 13:44 ` Marcel Holtmann
0 siblings, 1 reply; 10+ messages in thread
From: Malte Steiner @ 2007-03-30 19:45 UTC (permalink / raw)
To: BlueZ users
Am Freitag, den 30.03.2007, 19:33 +0000 schrieb Robert Rawlins:
> Hello Chaps,
>
> I'm currently running a C program for service discovery on a list of
> devices. The function loops through the list elements and performs an
> SDP enquiry on each device and returns the results to the screen, but
> I'm finding that if i get a slow device in the list it can hold things
> up a little, and in general it would be fantastic to hit all the
> devices with an enquiry simultaneously.
Multithreading is possible, I use the OpenThreads library to do so for
the same reasons. Attention, OpenThreads is OO and C++ so you might look
for another solution like pthreads.
Cheers,
Malte
-------------------------------------------------------------------------
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
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bluez-users] Multithread Service Discovery
2007-03-30 19:45 ` Malte Steiner
@ 2007-03-31 13:44 ` Marcel Holtmann
0 siblings, 0 replies; 10+ messages in thread
From: Marcel Holtmann @ 2007-03-31 13:44 UTC (permalink / raw)
To: BlueZ users
Hi Malte,
> > I'm currently running a C program for service discovery on a list of
> > devices. The function loops through the list elements and performs an
> > SDP enquiry on each device and returns the results to the screen, but
> > I'm finding that if i get a slow device in the list it can hold things
> > up a little, and in general it would be fantastic to hit all the
> > devices with an enquiry simultaneously.
>
> Multithreading is possible, I use the OpenThreads library to do so for
> the same reasons. Attention, OpenThreads is OO and C++ so you might look
> for another solution like pthreads.
if you have a recent kernel then this might work since the kernel queues
the page requests. However in general a simultaneous service discovery
(or name resolving for that matter) is not possible. The chips baseband
can only page one remote device at a time. So even if it looks like
simultaneous service discovery. It is not. The kernel serializes it for
you and this means the same page timeout problems appear when devices
are out of range.
The only way to speed this up is to change the page timeout value of the
Bluetooth chip.
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
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bluez-users] Multithread Service Discovery
@ 2007-03-31 19:58 Robert Rawlins
2007-03-31 20:44 ` Loreno Oliveira
2007-04-01 7:01 ` Marcel Holtmann
0 siblings, 2 replies; 10+ messages in thread
From: Robert Rawlins @ 2007-03-31 19:58 UTC (permalink / raw)
To: bluez-users
[-- Attachment #1.1: Type: text/plain, Size: 1600 bytes --]
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
[-- Attachment #1.2: Type: text/html, Size: 1923 bytes --]
[-- Attachment #2: Type: text/plain, Size: 345 bytes --]
-------------------------------------------------------------------------
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
[-- Attachment #3: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bluez-users] Multithread Service Discovery
2007-03-31 19:58 Robert Rawlins
@ 2007-03-31 20:44 ` Loreno Oliveira
2007-04-01 7:01 ` Marcel Holtmann
1 sibling, 0 replies; 10+ messages in thread
From: Loreno Oliveira @ 2007-03-31 20:44 UTC (permalink / raw)
To: BlueZ users
[-- Attachment #1.1: Type: text/plain, Size: 3293 bytes --]
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 <robert_rawlins@hotmail.com> 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
> Bluez-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bluez-users
>
>
[-- Attachment #1.2: Type: text/html, Size: 4402 bytes --]
[-- Attachment #2: Type: text/plain, Size: 345 bytes --]
-------------------------------------------------------------------------
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
[-- Attachment #3: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bluez-users] Multithread Service Discovery
2007-03-31 19:58 Robert Rawlins
2007-03-31 20:44 ` Loreno Oliveira
@ 2007-04-01 7:01 ` Marcel Holtmann
1 sibling, 0 replies; 10+ messages in thread
From: Marcel Holtmann @ 2007-04-01 7:01 UTC (permalink / raw)
To: BlueZ users
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
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bluez-users] Multithread Service Discovery
@ 2007-04-01 10:25 Robert Rawlins
2007-04-01 12:58 ` Marcel Holtmann
2007-04-01 14:04 ` Malte Steiner
0 siblings, 2 replies; 10+ messages in thread
From: Robert Rawlins @ 2007-04-01 10:25 UTC (permalink / raw)
To: bluez-users
[-- Attachment #1.1: Type: text/plain, Size: 1467 bytes --]
Hi Guys,
Thanks again for your help, I'm glad that i now know simultaneous service requests is -not- an option, which means that my current solution isn't so bad. At the moment i run an HCI enquiry and then loop through the results, SDP each device for the obex channel and initiate a push to them. The speed is pretty good, we just have the problem that if we've got a slow 1.1 device in range, they can hold up the queue a couple of seconds.
Basically i'm looking to build a small application which distributes calendar information to people as they walk past my clients pub. But as people are walking past it is important that we discover the device and its services as quickly as possible, so they dont walk out of range before we get chance to push the file to them.
Have any of you had experience of working with this before? or have any advice on it?
With regards to pushing a file to them, is ObexObjectPush my best option? or is ObexFTP replacing this now?
Using python wont be an issue, I find that most of these top level languages are very similar so learning the syntax for python wont be an issue, its just a case of finding some good examples to look it.
Thanks again for your help guys, i look forward to hearing from you.
Rob
_________________________________________________________________
Try Live.com - your fast, personalized homepage with all the things you care about in one place.
http://www.live.com/getstarted
[-- Attachment #1.2: Type: text/html, Size: 1701 bytes --]
[-- Attachment #2: Type: text/plain, Size: 345 bytes --]
-------------------------------------------------------------------------
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
[-- Attachment #3: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bluez-users] Multithread Service Discovery
2007-04-01 10:25 Robert Rawlins
@ 2007-04-01 12:58 ` Marcel Holtmann
2007-04-01 14:04 ` Malte Steiner
1 sibling, 0 replies; 10+ messages in thread
From: Marcel Holtmann @ 2007-04-01 12:58 UTC (permalink / raw)
To: BlueZ users
Hi Robert,
> Thanks again for your help, I'm glad that i now know simultaneous
> service requests is -not- an option, which means that my current
> solution isn't so bad. At the moment i run an HCI enquiry and then
> loop through the results, SDP each device for the obex channel and
> initiate a push to them. The speed is pretty good, we just have the
> problem that if we've got a slow 1.1 device in range, they can hold up
> the queue a couple of seconds.
>
> Basically i'm looking to build a small application which distributes
> calendar information to people as they walk past my clients pub. But
> as people are walking past it is important that we discover the device
> and its services as quickly as possible, so they dont walk out of
> range before we get chance to push the file to them.
>
> Have any of you had experience of working with this before? or have
> any advice on it?
sort the list of found devices by RSSI to contact the devices in range
first. Modify the page timeout and link supervision timeout to faster
detect page failures and disconnected links.
You can use two dongles. So one for running the inquiry and the other
one for service discovery and pushing the actual files.
> With regards to pushing a file to them, is ObexObjectPush my best
> option? or is ObexFTP replacing this now?
No. OBEX Push is for pushing files and OBEX FTP is for FTP like access
to a file storage.
> Using python wont be an issue, I find that most of these top level
> languages are very similar so learning the syntax for python wont be
> an issue, its just a case of finding some good examples to look it.
The inquiry and service discovery is kinda simple via D-Bus and Python.
For pushing the actual file, we don't have a real Python binding.
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
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bluez-users] Multithread Service Discovery
@ 2007-04-01 14:00 Robert Rawlins
0 siblings, 0 replies; 10+ messages in thread
From: Robert Rawlins @ 2007-04-01 14:00 UTC (permalink / raw)
To: bluez-users
[-- Attachment #1.1: Type: text/plain, Size: 2202 bytes --]
Thanks for the advice Marcel, It'll prove invaluable i'm sure.
2 Dongles makes good sense, so i'll defiantly work with that arrangement to get things working fluidly. Is a single dongle able to handle a device enquiry and an SDP at the same time? or is that asking too much? I'm just trying to find the limitations of the hardware, just so i know what to expect as top performance.
>> Modify the page timeout and link supervision timeout to faster>> detect page failures and disconnected links.
I've seen you speak about this before and sounds like its a good way of managing the resources and speeding up the process. Could you explain a little more about modifying those page and link supervision time outs? is this something i do with my code or an alteration i need to make to the bluez stack? and are there any negative effects to making a change like this?
>> No. OBEX Push is for pushing files and OBEX FTP is for FTP like access>> to a file storage.
This is as i expected it would be, that's absolutely fine, i will continue to use our own USSP-Push like tool for doing the obex push, unless you have any other recommendations on doing this.
>> The inquiry and service discovery is kinda simple via D-Bus and Python.>> For pushing the actual file, we don't have a real Python binding.
I'll agree that the Python and D-Bus certainly appears simpler on the face of things, from the samples i've seen, many written by yourself, the code certainly seems less complex that the alternative C methods. Do i need to look into PyBluez to use the python d-bus method, or is the PyBluez wrapper something else all together?
I've noticed while reading through the API documentation is lists a function for 'periodic' enquiry, is this something i should be looking to use in my application? my guess is that its a 'yes' and this function just repeatedly looks for devices in range?
Thanks again for all your help Marcel, and thanks to you other guys for your suggestions.
Rob
_________________________________________________________________
Try Live.com: where your online world comes together - with news, sports, weather, and much more.
http://www.live.com/getstarted
[-- Attachment #1.2: Type: text/html, Size: 2518 bytes --]
[-- Attachment #2: Type: text/plain, Size: 345 bytes --]
-------------------------------------------------------------------------
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
[-- Attachment #3: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bluez-users] Multithread Service Discovery
2007-04-01 10:25 Robert Rawlins
2007-04-01 12:58 ` Marcel Holtmann
@ 2007-04-01 14:04 ` Malte Steiner
1 sibling, 0 replies; 10+ messages in thread
From: Malte Steiner @ 2007-04-01 14:04 UTC (permalink / raw)
To: BlueZ users
Hi,
the choice of C++ and an object orientated approach was more done by my
customer. It has some benefits, e.g. regarding encapsulating data and
functionality but didnt made life easier in the first place. Bluez and
OpenObex is C and gave me some headaches with the callback routines for
instance.
I use threading for the whole application, not only or particulary for
the SDP discovery. And in general the multitasking solution at least
feels faster than the single task one.
You want to use Push instead of Put or FTP, Push is the only Obex
service which doesnt need pairing.
Cheers,
Malte
-------------------------------------------------------------------------
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
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-04-01 14:04 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-30 19:33 [Bluez-users] Multithread Service Discovery Robert Rawlins
2007-03-30 19:45 ` Malte Steiner
2007-03-31 13:44 ` Marcel Holtmann
-- strict thread matches above, loose matches on Subject: below --
2007-03-31 19:58 Robert Rawlins
2007-03-31 20:44 ` Loreno Oliveira
2007-04-01 7:01 ` Marcel Holtmann
2007-04-01 10:25 Robert Rawlins
2007-04-01 12:58 ` Marcel Holtmann
2007-04-01 14:04 ` Malte Steiner
2007-04-01 14:00 Robert Rawlins
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.