Saturday, August 29, 2009

Programmatically Bluetooth device pairing with no passkey -- problem and workaround/ solution

Hi,

I hope you already know that, some Bluetooth devices are dumb/ without non interactive GUI and for some of these devices, pairing is done with no passkey. This is very easily done from OS level (via control panel). But the problem occurs when you try to pair with such devices programmatically. You will see some GUI where a request from device will require some passkey to you. This problem I observed with Microsoft Bluetooth Stack.



I have searched the web extensively, but found no workaround. I got some suggestions, such as 0000, 9999, 1234 and so on. But no result was there.

WorkAround

There can be 2 workaround here.
  • Using Windows Bluetooth API
  • Using 32feet.net API..this works well with Microsoft Bluetooth stack
Seems Interesting??? Just Chime in so that I can add the workarounds here...

14 comments:

  1. Yes, I am really interested on it! Please post the solution...Thanks!

    ReplyDelete
  2. Hi,

    Can you please mention which one you need, as I mentioned about 2 ways for the solution or workaround. I think you need a solution for a particular way...are you using windows Bluetooth API anyway? do you work with Microaoft Bluetooth Stack?? if not, which Bluetooth stack you use?

    ReplyDelete
  3. Hello...I'm using a windows bluetooth API and need a workaround for this problem. What can I do? Thanks!

    ReplyDelete
  4. Hi Anom,

    Normally, you will call BluetoothAuthenticateDevice method to exchange passkey. But the method does not provide option for the situation of "no passkey". So if you are using this method, it will fail for the "no passkey" scenario. Just call BluetoothSetServiceState method in this case. you will see notification in task bar that your device is installed and ready to use. Whooa!!! Let me know whether it works or not.

    ReplyDelete
    Replies
    1. Hi TBari,
      Thanks for your information. It is really help.
      I use BluetoothSetServiceState() and install the serial com port successfully. But the user prompt interface is still shown after connect() is called. Do you have any suggestion? Thanks.

      Delete
  5. Could you post the specifics of the workaround please?

    ReplyDelete
  6. I need to know this. Please post.

    ReplyDelete
  7. Hi anonymous,

    Rea you trying Windows Bluetooth API? by 'specifics ', do you mean some source code?

    ReplyDelete
  8. Hi thomas,
    Please see my 1st comment for this post. Express the specifics of your problem.

    ReplyDelete
  9. hi..
    can u plz help me in disabling bluetooth throigh code,Im using BluetoothSetServiceState() but it is not disabling bluetooth..
    plz mail me at nidhi@unistal.com
    Thanks

    ReplyDelete
  10. Hi TBari,

    I am using Windows 7 with microsoft API could you post the work around as this is a very frustrating feature of windows.

    Thanks

    ReplyDelete
  11. I dont think you have any idea TBari as not a single person has said thanks.

    Just post both solutions and someone might thank you.

    ReplyDelete
  12. Hi TBari,

    Are you able to provide the code. All I want to do is add the device to windows. I already have the device BT address and pin. So when I turn the device on (for the first time), it automatically connects to the laptop without going through the discovery method...

    Thanks for your response :)

    ReplyDelete
  13. Sorry, I should have mentioned before, I am writing my application in c#

    ReplyDelete