Quite by chance I stumbled on how to do this when trying to connect to devices automatically...
The problem is with using the RNotifier function StartNotifierAndGetResponse with Bluetooth. All the examples use this to show the list of known Bluetooth devices.
That code does not handle multiple data connections.
I was able to connect my 3650 to my computer, and do an automatic connect to my other bluetooth device using the code described in an other thread (search för automatic Bluetooth connection). You'll probably have to create your own code for getting the whole list of devices and letting the user choose between them. The only downside is that the Bluetooth status icon (at the top right of the screen) is controlled from the RNotifier plugin stuff. (You can even disable bluetooth in the settings, the automatic connect will still work... :-)
it should do multiple connections.. however, i tested this with two phones only, for now, because i simply don't have a third one.. :-)
it includes a tcp layer for testing in the emulator, too.
try ignoring all the crap except for the src/net and src/net/bt folder and you should get a good idea on how to do bluetooth bi-directional comms and multiple connections..
Do U have experience with open bluetooth connections and searching bluetooth devices at the same time (with RHostResolver) ?
I am searching other devices and at the same time trying to exchange data with an open bluetooth connection. The data exchange hangs when RHostResolver is busy, even when cancelling the discovery the delays for exchanging data are up to 10 seconds... :-(
In which files do U have your bluetooth stuff (BTtest.zip or Essentials.zip?) I couldn't download the essentials.zip file.
i fixed the download link. but the bluetooth stuff is contained in the BtTest.zip in the src/net/bt folder.
i am, however, not doing anything in parallel. because only the client is "discovering" BEFORE it can make a connection.. of course.. :-)
well, the server could be sending data while a new client may be discovering him.. that's not a problem..
AFAIK it is a problem to do discovery and send/receive at the same time on the same device.. but i think this is a generic bluetooth problem. there's a post from a bluetooth SIG member somewhere talking about this.. i think it is cyperabi.. :-) but i dunno..
regards,
tfdj
So, is it impossible to have background BT connections?
2003-11-25, 21:08#7
Hi,
From the previous discussion I understood that BT "Searching"
dialog does not come up if there is any active link on the device.
Is it true? Is there any way to reconfigure the system to make it work? Can we get a definitive answer from a Nokia expert?
Pocket PC and desktop Windows do not have this ridiculous
limitation.
I have to write a BT application, which will maintain a background
connection most of the time (from device boot forward).
And now I found that no other BT applications can work while
my application is connected, which appears to be a show stopper.
When a bluetooth connection is existing U can't use the RNotifier Plug-in anymore. It will tell U that the max number of bluetooth connections is already in use.
That RHostResolver class can search for other bluetooth devices even when there is already a bluetooth connection existing.
Having bluetooth activity on the background is no problem (I have at the moment 3 open bluetooth connections active on the background while doing menu stuff for the user, phone must be client). My problem is (was) that the search for new devices and having existig bluetooth connections doesn't work so well (delays up to 10 seconds).
But if U only want bluetooth activity on the background without discovery for new devices I believe U won't have problems.
Sorry...I don't know a solution to your problem. :-(
For your own applications U could replace the RNotifier with your own made searcher and display those... But like you said...other applications use that RNotifier so it still wouldn't be such a good solution.