Author Topic: wclBluetoothDevice Pair request lock  (Read 56857 times)

ppaquin

  • Guest
Re: wclBluetoothDevice Pair request lock
« Reply #15 on: February 13, 2013, 03:32:34 PM »
Hi,

I'm on Seven 64bit pro. Maybe it's special on seven...

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: wclBluetoothDevice Pair request lock
« Reply #16 on: February 13, 2013, 04:24:28 PM »
Yes, that appears only on Win 7. Looks better on Win 8.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: wclBluetoothDevice Pair request lock
« Reply #17 on: February 13, 2013, 10:51:45 PM »
Hi,

Updated version (attached). Works much better. wclBluetoothDevice.Pair method has been reworked: now it takes PIN as a parameter and does not fire events (all events have been removed from wclBluetoothDevice class). The Pair method trys to pair with device with given PIN. If a target device supports BT 2.1 SSP authentication, the Pair method automatically accepts numeric/passkey comparison. If a target device requires legacy PIN authentication then the Pair method trys to pair with given PIN.

[attachment deleted by admin]

ppaquin

  • Guest
Re: wclBluetoothDevice Pair request lock
« Reply #18 on: February 14, 2013, 09:06:52 AM »
Hi,

previous version seems to work better to me. Now i get a "Access Denied" message when i want to pair my device (still with DiscoveryDemo app)... Pairing still work with Window classic dialog.

Reguards,

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: wclBluetoothDevice Pair request lock
« Reply #19 on: February 14, 2013, 09:38:34 AM »
Its good news that it gives that error. It means that now function works correctly but the device rejects pairing. It may be because WCL sends wrong PIN or something.
what is your target device you try connect to? And what is PIN it needs?

ppaquin

  • Guest
Re: wclBluetoothDevice Pair request lock
« Reply #20 on: February 14, 2013, 09:51:10 AM »
The device is actually a custom Bluetooth card of my society. The pin is actually 19980000.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: wclBluetoothDevice Pair request lock
« Reply #21 on: February 14, 2013, 10:16:59 AM »
Ok, thanks.

By the way, what do you want to do after pairing? If you want to connect to your device may be its better to use wclAuthenticator and handle authentication requests asynchronous during connecting instead if force pairing before connect?

ppaquin

  • Guest
Re: wclBluetoothDevice Pair request lock
« Reply #22 on: February 14, 2013, 10:24:33 AM »
True, i want to send some instruction with wclClient.write (i have some trouble here too). I'll have to receive instructions too. What's the best way to do that?

I have difficulties to find documentation over WCL, can you tell me where to find it? (some tuto or API doc as exemple?) Actually, i base my developpements over demos provided in the installation of WCL.

For explanation, we used 32Feet library before, but for some compatibility problem, we're trying to migrate to WCL our app. (we'll see for buying after, if all work of course)

Many thanks,


ppaquin

  • Guest
Re: wclBluetoothDevice Pair request lock
« Reply #23 on: February 14, 2013, 12:50:14 PM »
Ok Wonderfull,

This new version work very good... if i launch it in administrator rights. I had to generate the demo with visual studio then launch it with right clic and admin rights... That'll be hard to debug! But that's Microsoft fail :p.

Many thanks for your reactivity. In this new version, i can pair and unpair any time it works (in admin right).

For my last question (i hope) can you explain or show me some doc for use wclClient.Write? Actually, it sais "Device not connected", but it does! (I paired and use wclClient.connect before successfull). We even have some sound on our card for when i disconnect, and it rings when i stop the app, so i am well connected when this message prompt...

Thanks!

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: wclBluetoothDevice Pair request lock
« Reply #24 on: February 14, 2013, 01:53:10 PM »
That's great that it works! I have never thought that pairing can fail because of rigts (at least there is nothing in MS doncs for that).

wclClient is simple. First, take a look on BluetoothClientDemo. It shows how to use it for SPP connection. In few words:

1. Set wclClient Params (Transport, Radio, Address, Service)
2. Call Connect and if it is success wait for OnConnect event (e.Error indicates connection result. If it is WCL_E_SUCCESS then connection is established)
3. Then you can call Write (it takes buffer as parameter (buffer is simple bytes array)).
4. Received data will be passed in OnData event.
5. To disconnect call Disconnect method
6. When wclClient is disconnected OnDisconnect event fires (if you call Disconnect or if remote device forces disconnection).

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: wclBluetoothDevice Pair request lock
« Reply #25 on: February 14, 2013, 02:29:14 PM »
A little bit updated version (attached): added synchronization for Pair calls to prevent shared data corruption when trying to pair in threads.

[attachment deleted by admin]

ppaquin

  • Guest
Re: wclBluetoothDevice Pair request lock
« Reply #26 on: February 14, 2013, 02:37:25 PM »
Thanks for this new version, i'll check that.

For the connection, here's the point :

The following code goes to a never-ending loop
            wcl.wclErrors.wclShowError(wclClient.Connect());
            while (wclClient.State != wclClientState.csConnected)
            {
                Thread.Sleep(1000);
            }

But, if i stop there the method, and put some action (write....) int the "wclClient_OnConnect" method, that's working. It seems that the client wait for the current thread to end to realy connect.

I'll try to use as it, but if you've got some indications, i'll be glad!

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: wclBluetoothDevice Pair request lock
« Reply #27 on: February 14, 2013, 02:40:31 PM »
WCL is asynchronous library and you have to use events instead of waiting for state changes. Also it is recomended to use WCL in main thread (as it is async it doesn't block main thread).

However, if you need synchronous call then change you code as below:

while (wclClient.State != wclClientState.csConnected)
            {
                Application.DoEvents();
               Thread.Sleep(50);
            }


But it is not recomended way to use WCL.

ppaquin

  • Guest
Re: wclBluetoothDevice Pair request lock
« Reply #28 on: February 14, 2013, 02:55:34 PM »
Thanks!

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: wclBluetoothDevice Pair request lock
« Reply #29 on: February 14, 2013, 05:46:09 PM »
You are very welcome!

And thank you for found bug in Pairing methods! if you decide to purchase WCL I would like to offer you a 10% discount (20% if you would like to use PayPal).

 

Sitemap 1 2 3 4 5 6 7