Welcome, Guest. Please login or register.

Login with username, password and session length
July 31, 2010, 10:08:24 AM
Pages: [1]
  Print  
Topic: How do I set a channel when opening a BT server? (Urgent!)  (Read 721 times)
« on: April 21, 2009, 08:23:50 AM »
WhiteAxe
Newbie

View Profile
*
Karma: +0/-0
Posts: 2



Hi everyone.

I'm kinda new to Java and Bluetooth, and I'm trying to build an app which opens a server for receiving text messages, but also connects to other devices for sending text (one thread for input, one for output).
I've noticed every time I open a server, it uses channel 10.
The problem is, other devices also use channel 10 when opening servers, so after I get a connection URL from a remote device and try to connect to it (using Connector.open), I get a message saying that a connection on channel 10 is already opened, and I cannot use it for sending.
Can I set a random channel for each device when opening a server? this could solve the problem, isn't it? one channel for the server, and one for connecting to others.
By the way, I use a 'btspp://' prefix, if it matters.
Thanks in advance.

P.S: I must solve this till Friday, so I'll READLY appreciate a quick replay. thanks again Smiley
Logged
« Reply #1 on: April 22, 2009, 05:11:13 PM »
cookdav
Newbie

View Profile
*
Karma: +0/-0
Posts: 5



WhiteAxe -

There is almost NO ONE using these forums, so in general, you'll probably find
(like I have) that posting questions in these forums will yield only
sporatic answers.

As to your question, the answer is that you can NOT explicitly specify
the channel #.  According to BOTH the JSR-82 bluetooth-textbooks I bought,
they both say that the stack itself is the arbitrator/assigner of the channel#
that they specify which channel will be used.  (If you print out the 'connection-URL' that gets
generated, you should be able to SEE which channel got assigned (which you
no doubt have already, since you say that it was channel-10).

So, my best guess is that your 'bluetooth stack' must have some sort of fault
or bug in it.  Either that, or else you are not 'cleaning up' from some earlier
experiment running some earlier server/client!?  (Just reboot between experiments
if in doubt.)

If you reply back, state which vendor's adapter, stack, and OS that you
are using, as bluetooth works on all OSes (WinXP,Win-Vista, Mac, and Linux), you know.

[Having said that, I too am having trouble understanding exactly whose
'stack' that I am using, as the term 'stack' gets confused by all the various
vendors whose hands are in the 'bluetooth soup', as I call it.  For example,
I own 3 separate USB-bluetooth adapters (an 'Encore', a 'Cirago', and a
'TRENDnet', and they all came with various INCOMPATIBLE Windows stacks/drivers/services.
e.g. the 'Cirago' was the worst...it came with a 'Toshiba' software stack, which
claimed that it had expired about two weeks after I started using it.  The 'Encore'
works pretty well WITHOUT me needing to install the CDROM-stuff that came with
it (as it uses the existing Microsoft-stack that comes with Vista), but the
TRENDnet would not respond AT ALL, until I installed its 'driver' (which
it claims is a 'Widcomm stack').]  [I've also tried my adapters on Linux and all
work uniformly there, althought one Java device-detection-API behaves a bit
differently there than it does on Windows.]

For my JSR-82/Java support, on top of the 'drivers and native stack', one must
additionally install/use a 'Java stack', and my chosen one has been 'Bluecove 2.1.0' in
all my experiments and code-development so far.  (I'm trying to mostly stay PC-based and
use JavaSE, before I even consider trying to write 'Midlets' for a cellphone/PDA,
partly just because I don't own a Java-capable cell/PDA.)

Needless to say, I am NOT HAPPY with this state of affairs in the 'bluetooth-adapter'
market.  [Can we imagine what chaos there'd be if 'flash-drives' all came with
separate conflicting drivers?]  So, why doesn't Microsoft (or some designated member
of the bluetooth-SIG) step up and STANDARDIZE this Bluetooth driver/stack/firmware
mess on the Windows-platform?  [Really glad to have had Linux to test against, as it
showed the confusions are mostly confined to the Windows-world.]

[Thanks to all for listening to my rant.  Not that I expect any action, but it makes me
feel good to rant.   Wink ]
« Last Edit: April 22, 2009, 11:08:12 PM by cookdav » Logged
« Reply #2 on: April 23, 2009, 04:07:10 AM »
WhiteAxe
Newbie

View Profile
*
Karma: +0/-0
Posts: 2



Thanks for your reply!  Wink

I'm running my app on my cellphone, if that matters.

Well, if I cannot choose the channel number I want, my questions are:
1. Let's say I'm now sending some data to another device (using Connector.open(someDeviceUrlIGot)). Does the sending device (mine) uses the same channel the server is on? Do 2 devices must use the same channel to exchange data?
2. If so, is if possible for a device to read & write data on the same channel at the same time?
3. If not, is it possible to read & write data on seperate channels at the same time?

Thanks in advance.
Logged
 
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC