Michael.mwi
Posts: 2
Joined: Thu Sep 04, 2008 2:02 pm
Contact: Website

Connection-Problem after disapper of remotedevice

Thu Sep 04, 2008 2:15 pm

Hallo!

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.

Code:
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?


=====
EDIT

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

Jonas
Posts: 2319
Joined: Mon Jan 09, 2006 2:20 pm
Location: Sweden

RE: Connection-Problem after disapper of remotedevice

Thu Sep 04, 2008 10:23 pm

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?

Regards,
Jonas

Michael.mwi
Posts: 2
Joined: Thu Sep 04, 2008 2:02 pm
Contact: Website

RE: Connection-Problem after disapper of remotedevice

Mon Sep 15, 2008 4:39 pm

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?

Jonas
Posts: 2319
Joined: Mon Jan 09, 2006 2:20 pm
Location: Sweden

RE: Connection-Problem after disapper of remotedevice

Mon Sep 15, 2008 9:07 pm

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.

Regards,
Jonas

Return to “BlueTools”