Problem when using the function PairRequest()

Topics: Bluetooth - Microsoft
Oct 19, 2012 at 11:47 AM
Edited Oct 19, 2012 at 11:54 AM


We are using the 32feet library to communicate with some robots called epucks. Our problem is that sometimes the function PairRequest(device.DeviceAddress, pin) returns false and we don't know why. If we try to pair the robots nonprogrammatically (Control Panel ->Bluetooth Devices), it works. The range can't be the problem because it also happens when the robots are very close to the Bluetooth Dongle. By the way, we are using the Microsoft Bluetooth Stack and the code is running on the OS's Windows XP and Windows 7. Do you have an idea what could be the problem?

Thanks and best regards

Oct 19, 2012 at 2:05 PM

Can you download the library sources from here. Compile and reference in your project. Then set a breakpoint in function PairRequest(BluetoothAddress device, string pin) in file "....\InTheHand.Net.Personal\InTheHand.Net.Personal\Net.Bluetooth.Msft\WindowsBluetoothSecurity.cs"

 What's the value of result then?  For instance if the target device isn't in range I see 258 (0x0102) which is Timeout.

Oct 19, 2012 at 2:23 PM


Yes, when I debug it, the return value is equal to 258, so it is a timeout, you're right. But why doesn't this happen when I pair my devices nonprogrammatically?

Or is there a way to enlarge this timeout?


Thanks in advance

Oct 21, 2012 at 6:24 PM

Hmm. I wasn't really expecting your problem to be timeout.  Are you doing the PairRequest soon after some other action? Maybe when done manually it takes longer to get there and when done programmatically the device or the Bluetooth link is busy with something else? Maybe add a delay before the PairRequest?