Page 1 of 1

Connection-Problem after disapper of remotedevice

Posted: Thu Sep 04, 2008 2:15 pm
by Michael.mwi

I'm new to this SDK and I have a big problem.

by the way, I had problems with registration - who do I have to contact?

The Problem:
I got an Application on a mobile Device (C# netcf 2.0 sp1, Microsoft Stack) where I have to make a connection to another mobile device. This connection should be enabled the whole time. So my Bluetooth application is trying to connect to the device every X seconds. I've build a solution with the Franson BlueTools, but there are some problems:

After the app has connected to the device (direct connection via network.ConnectDevice and Mac address), everything works fine. But when I turn off the remote device, the app detects the disconnection (try to write into the stream gives an exception, everything will be disconnected). After turn on the remote device again, the app will say "Remote device cannot be found." and will never connect again. Restarting the application solves the problem.

btDevice = network.ConnectDevice(btAdr, "");
Service[] services = btDevice.DiscoverServices(ServiceType.SerialPort);

Second line throws the exception. When disconnecting, the stream will be closed with networkStream.Close().

What do I need to do, to solve the problem? Did I missed anything? ;)

Second Problem:
For now, it works with synchron code. I would like to use asynchrone detection of Services. But there was, I guess, the same problem. Everytime when I startet the detection I get an device.Error (cannot be found.). Looks like the same problem?


I guess the bluetooth device shuts down. We had this problem with the other lib, too. Sometime the bluetooth turn off, withou any reason. On the Windows CE 5.0 there is no bthutil.dll, whitch the lib needs to turn the bluetooth back on - right? Is there anything else I can do to turn the bluetooth on?

Thank you in advance!

Greez, Michael

RE: Connection-Problem after disapper of remotedevice

Posted: Thu Sep 04, 2008 10:23 pm
by Jonas
If your device is running the MS stack it requires bthutil.dll to access the bluetooth radio. Without it you simply can't modify it.

On the other hand, the stack shouldn't shutdown without any reason either. Is it some power-saving feature at work here?


RE: Connection-Problem after disapper of remotedevice

Posted: Mon Sep 15, 2008 4:39 pm
by Michael.mwi
Thanks for reply!

We're not sure about the reason for shutting down the Bluetooth device. Most of the time it's after disconnecting, transferring a lot of data or sending Data when the other device has been shut down without disconnecting Bluetooth.

By the way, how does the Software, which is on the device, turn bluetooth on and off without the bthutil.dll?

RE: Connection-Problem after disapper of remotedevice

Posted: Mon Sep 15, 2008 9:07 pm
by Jonas
I will look at this shutdown issue for next release. I have no answer in the short term.

As for your other question, the stack at lower level (hardware, built-in OS) can do anything the stack is capable of (after all, it can do what is is coded), but BlueTools can only access features that are available through the bluetooth SDK and if bthutil.dll is not available, the radio status commands are simply not present for the SDK to access.