pabloesp
Posts: 7
Joined: Fri Jan 16, 2009 1:33 pm
Location: Spain

Bond problem

Thu Jan 29, 2009 8:16 pm

Hi,

I rememember you my settings: The PDA is a IPAQ 240 with Widcomm stack.

The Bond() function takes about 50 seconds to end, even if the bonding has been done correctly or if not. is there a way to avoid that?

I tried BondAsync() and i manage to get a lower response, but in that case, although my application has finished, it does not return control to O.S. until bonding seems to finish, again the 50 seconds. So this does not work already.

Could you give me another way to try it?
Excuse my English!!

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

RE: Bond problem

Fri Jan 30, 2009 9:50 am

No, you cannot avoid this. The hand-shaking for the bonding at stack level is sometimes slow.

Regards,
Jonas

rharrison
Posts: 31
Joined: Fri Oct 12, 2007 6:40 pm
Location: United Kingdom

RE: Bond problem

Fri Feb 06, 2009 2:51 pm

Your problem may be related to this thread (particularly towards the end of the thread):

http://www.franson.com/forum/topic.asp?TOPIC_ID=5824

I had problems with Bond() taking a long time so wrote a workaround simple DLL containing a call directly to the Widcomm bond API function which solved the problem.

pabloesp
Posts: 7
Joined: Fri Jan 16, 2009 1:33 pm
Location: Spain

RE: Bond problem

Fri Feb 06, 2009 9:13 pm

Hi rharrison,
The problem may be related to that i can not do a discovery because our connections are always direct (with mac address and pincode).

Could please private message me and give me some help with this code? are you trying a p/invoke workaround?

rharrison
Posts: 31
Joined: Fri Oct 12, 2007 6:40 pm
Location: United Kingdom

RE: Bond problem

Wed Feb 11, 2009 7:06 pm

Originally posted by pabloesp

Hi rharrison,
The problem may be related to that i can not do a discovery because our connections are always direct (with mac address and pincode).

Could please private message me and give me some help with this code? are you trying a p/invoke workaround?

That's right, the solution that worked for me (r.e. bond taking ages on HP iPAQ 110) is described in the link to the previous thread. What I did was:

1.) Ensure that Bluetools event notifications are NOT synchronised to the GUI thread.
2.) Ensure that if you are bonding right after a discovery, that you sleep() the thread for at least 500 milliseconds. Although you're not discovering so this may not be an issue for you.
2.) Create a native code DLL with a single Bond function, the source code is defined in the previously linked thread.
3.) P/Invoke the native Bond function instead of the Bluetools bond function.

pabloesp
Posts: 7
Joined: Fri Jan 16, 2009 1:33 pm
Location: Spain

RE: Bond problem

Wed Feb 11, 2009 7:33 pm

Hi rharrison,

I will try the solution and write again with the result.
Thank you!

pabloesp
Posts: 7
Joined: Fri Jan 16, 2009 1:33 pm
Location: Spain

RE: Bond problem

Mon Feb 16, 2009 4:14 pm

Hi rharrison,

I tried con create a MFD Dll with VS2008 but do not seems to work. What do i need to link from Widcomm SDK?

Thanks,

rharrison
Posts: 31
Joined: Fri Oct 12, 2007 6:40 pm
Location: United Kingdom

RE: Bond problem

Wed Feb 18, 2009 3:01 pm

Your bond DLL is targeted at Windows Mobile so you cannot use the MFC libraries that come with VS i.e. they're built for native x86. There is no need to use MFC here anyway. Make sure your configuration property 'Use of MFC' is set to 'Use Standard Windows Libraries'.

At least for the iPAQ 110 or 210 series your DLL build target should be ARMV4I Windows Mobile 6 Professional SDK.

Set your additional include path to include:
C:\Program Files\WIDCOMM\WIDCOMM BTW-CE SDK\Sdk\Inc

To allow your project to find the necessary Widcomm lib file I set my 'Additional Library Directories' to C:\Program Files\WIDCOMM\WIDCOMM BTW-CE SDK\Sdk\Lib\ArmRel (the location that the Widcomm SDK installed to)

Now you should be able to #include <BtSdkCE.h> and your project will correctly link against the Widcomm SDK


Originally posted by pabloesp
I tried con create a MFD Dll with VS2008 but do not seems to work. What do i need to link from Widcomm SDK?

Return to “BlueTools”