federico.caselli
Posts: 11
Joined: Tue Mar 28, 2006 9:41 pm
Location: Italy

RemoteDevice.Bond impossible with Widcomm stack?

Thu Mar 30, 2006 4:06 pm

Hi,
I'm trying a little change in FindAndConnectVB sample.
I added

remote_device.bound (strMyPin)

line of code, in order to avoid the Windows request.
But the code raises an exception and I must write the code through the keyboard.

I'm using the widcomm stack.

I read the documentation about the bond method:

"...Some bluetooth stacks allows secure connections without explicitly bonding. However, in this case, the bluetooth stack will negotiate a bond. Blocks until operation is finished."

So the problems always occours when the Widcomm stack is installed, doesn't it?

Since my application will be a Media Center add-in, the user won't be able to see the windows pin request...

Any suggestion?

Thank you.

User avatar
johan
GpsGate
Posts: 15403
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: RemoteDevice.Bond impossible with Widcomm stack?

Thu Mar 30, 2006 4:15 pm

Please describe in detail what is happening. What devices are involved. On which device do you run BlueTools. What are you connecting to? What kind of exception do you get?

Regards,
Johan

Franson Support

vnikitin
Posts: 11
Joined: Wed Dec 21, 2005 5:19 pm

RE: RemoteDevice.Bond impossible with Widcomm stack?

Thu Mar 30, 2006 9:52 pm

I am get tired with the same problem.
I use VC2005 and bluetools.200/200.CF
I try that for PocketPC (Windows Mobile 2003) and for Notebook (Win XP sp2) as well.
Notebook has Widcomm Stack 5.0.1.801 and internal blutooth device by CSR.
PocketPC is iPaq 2410 and has widcomm 1.5.0.2901.

This is code produces the input pincode dialoq.

_device.Bond(pinCode);
// breakpoint at next line. in imediate window: ?_device.Bondet >true
_device.DiscoverServices(Franson.BlueTools.ServiceType.SerialPort);
// dialoq appears

_device.Bond(pinCode);
_service = _device.ConnectService(1, serviceName);
// breakpoint at next line. in imediate window: ?_device.Bondet >true
_stream = _service.Stream;
// dialoq appears

if I try cancel dialoq the porogramm thread returns to line "_stream = _service.Stream;" and asks me input pincode again and again ...
When I try execute in immediate window next line
?_device.Unbond()
the computer hangs up. So I need shut down Visual Studio process by Task manager.

I try many Remote devices: iPaq 2410, Qteq-S100, Baracoda WML-C20 and another CSR based bluetooth modules. All the same.

when I use Qteq-S100 with Microsoft stack bond works.

federico.caselli
Posts: 11
Joined: Tue Mar 28, 2006 9:41 pm
Location: Italy

RE: RemoteDevice.Bond impossible with Widcomm stack?

Thu Mar 30, 2006 10:48 pm

Originally posted by johan

Please describe in detail what is happening. What devices are involved. On which device do you run BlueTools. What are you connecting to? What kind of exception do you get?


I'm trying a connection between my PC (xp sp2 mce 2005) and a Bluetooth RS232 Adapter by Eikon (www.eikonsite.it) which is connected to a micro-controller. I'm running Visual Studio 2005. The PC dongle is F8T013 by Belkin. The exception stack is

A first chance exception of type 'Franson.BlueTools.BlueToolsException' occurred in Franson.BlueTools.200.dll
at Franson.BlueTools.Toolkit.PullExceptions(IntPtr obj)
at Franson.BlueTools.RemoteDevice.Bond(String pincode)
at FindAndConnectVB.Form1.Autentica() in C:\Programmi\Franson\BlueTools SDK v1.1\dotNet200\VB.NET\FindAndConnect\Form1.vb:line 341
A first chance exception of type 'Franson.BlueTools.BlueToolsException' occurred in Franson.BlueTools.200.dll

Then Windows says "error during parin procedure with the xxx peripheral..."

But sometimes it does work fine.

Hope it's what you meant.

User avatar
johan
GpsGate
Posts: 15403
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: RemoteDevice.Bond impossible with Widcomm stack?

Thu Mar 30, 2006 11:07 pm

What happens if you check the RemoteDevice.Bonded() property and do not bond if it is already bonded?

Regards,
Johan

Franson Support

vnikitin
Posts: 11
Joined: Wed Dec 21, 2005 5:19 pm

RE: RemoteDevice.Bond impossible with Widcomm stack?

Thu Mar 30, 2006 11:32 pm

That is the question...
I don't know. But it happens. sorry[:I]

User avatar
johan
GpsGate
Posts: 15403
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: RemoteDevice.Bond impossible with Widcomm stack?

Thu Mar 30, 2006 11:36 pm

The question was directed to federico.caselli


vnikitin: You say that Bonding is required to discover services. As you state here:

_device.Bond(pinCode);
// breakpoint at next line. in imediate window: ?_device.Bondet >true
_device.DiscoverServices(Franson.BlueTools.ServiceType.SerialPort);
// dialoq appears

But in Bluetooth you do not need to bond before discover services. So there must be something fundamantaly wrong with what you are doing. Maybe you shouldn't run from the imediate window. Also note that it is sometimes bad to look at objects in VS "Watch", since doing that will execute a lot of code in the objects.

Try to run your application stand alone, outside Visual Studio to start with. Also try to use the FindAndConnect sample and modify it as little as possible until you understand how to get things to work.



Regards,
Johan

Franson Support

federico.caselli
Posts: 11
Joined: Tue Mar 28, 2006 9:41 pm
Location: Italy

RE: RemoteDevice.Bond impossible with Widcomm stack?

Fri Mar 31, 2006 12:44 pm

Checking the bonded property doesn't avoid the error.

The bond call comes in the "listDevices_SelectedIndexChanged" sub, after the "remote_device = listDevices.SelectedItem" line. Is it wrong?

federico.caselli
Posts: 11
Joined: Tue Mar 28, 2006 9:41 pm
Location: Italy

RE: RemoteDevice.Bond impossible with Widcomm stack?

Fri Mar 31, 2006 3:45 pm

As I said before, sometimes the bond method works, sometimes doesn't.

I tried to call it more times in a loop, but it can't work. Infact, every time it fails, I must close the windows balloon pin request, then I can try again. Normally it works after 3-4 trials. When it works, it takes very short time from the bound call to the acceptance (the flash on the BT-icon within the tray), so I don't think it's a timeout matter...

User avatar
johan
GpsGate
Posts: 15403
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: RemoteDevice.Bond impossible with Widcomm stack?

Fri Mar 31, 2006 4:35 pm

Ok, we'll run some more bonding tests here for WidComm and see what we come up with.

Regards,
Johan

Franson Support

Return to “BlueTools”