Wireless Communication Library Support Forum

Frameworks => Bluetooth Framework => Topic started by: smalinowski on June 01, 2015, 09:10:57 AM

Title: WCL Demo - SilentAuth
Post by: smalinowski on June 01, 2015, 09:10:57 AM
I'm very interested in feature SilentAuth (auto-pairing devices). How to use WclAuthenticator to pair devices automatically? Is there any demo for this feature?
Title: Re: WCL Demo - SilentAuth
Post by: Mike Petrichenko on June 01, 2015, 09:49:51 AM
Hello,

Take a look on AuthenticatorDemo from WCL package. It shows how to use wclAuthenticator to handle authentication requests.
Title: Re: WCL Demo - SilentAuth
Post by: smalinowski on June 01, 2015, 11:11:35 AM
Yep, I've seen. But it didn't helps me.

I have AuthenticatorDemo running on two devices. On first device I click Discover and it works find, then I select discovered  device and click Connect. I get "Unkown error: 44".  I didn't found documentation for these methods
- wclAuthenticator.Open()
- wclAuthenticator.Close()

Should I listen for authentication on second device?  Please give me steps how to auto-pair these two devices using AuthenticatorDemo.
Thank you.
Title: Re: WCL Demo - SilentAuth
Post by: Mike Petrichenko on June 01, 2015, 11:24:11 AM
Hello,

Error 44 means that service not found on target device. the demo by default uses DUN service on cell to connect to (as lot of cells have one). If your target device does not have DUN service change demo code to connect to service you want. For example for Serial Port Profile change this code line

wclClient.BluetoothParams.Service = wcl.wclUUIDs.DialupNetworkingServiceClass_UUID;

to

wclClient.BluetoothParams.Service = wcl.wclUUIDs.SerialPortServiceClass_UUID;

After you start demo click Enum then Open (call to wclAuthenticator.Open() which starts "listening" for auth requests). Then Connect to connect to you device. If your device requires Auth then one of the event fires.
Title: Re: WCL Demo - SilentAuth
Post by: smalinowski on June 02, 2015, 08:52:45 AM
Changes to:

wclClient.BluetoothParams.Service = wcl.wclUUIDs.SerialPortServiceClass_UUID;

almost solved problem. When, I click connect then I get below message prompt (see attachment). When I enter default PIN (0000) or empty PIN then I get message: Unable to connect: 43 (I've found this is WCL_E_TIMEOUT). Where is the problem? How to hide or omit this message prompt?

My device spec:
First: Windows 8.1, API: baMicrosoft
Second: Windows 7 Pro, API: Toshiba

I try to connect from First -> Second.

[attachment deleted by admin]
Title: Re: WCL Demo - SilentAuth
Post by: Mike Petrichenko on June 02, 2015, 08:55:08 AM
Have you opened Authenticator (click on Open button) before connect?
Title: Re: WCL Demo - SilentAuth
Post by: smalinowski on June 02, 2015, 09:27:57 AM
Yes, on Second device.
Title: Re: WCL Demo - SilentAuth
Post by: Mike Petrichenko on June 02, 2015, 10:16:06 AM
You have to do it on both. On Second you have to run server.
Title: Re: WCL Demo - SilentAuth
Post by: smalinowski on June 02, 2015, 10:53:42 AM
Ok it works, device are connected. But user has to enter PIN, without this can't connect. It is possible to omit these step?

Other issue, I can connect from First (win8) -> Second (win7), but can't connect Second -> First. I get error: WCL_E_SERVICE_NOT_FOUND.
Title: Re: WCL Demo - SilentAuth
Post by: Mike Petrichenko on June 02, 2015, 12:32:46 PM
You have to run server with wclAuthenticator on PC you want connect to. Toshiba has default (build-in) SPP server running. MS has no one. In any case to be able to process data on both sides you have to run client on one side and server on other. Take a look on BlueChatClient/BlueChatServer demos.
Title: Re: WCL Demo - SilentAuth
Post by: smalinowski on June 03, 2015, 09:16:18 AM
Still not works. Let me explain
A. I try to auto-pair devices using Authenticator Demo. I follow these steps

1. Click Open on Device A (Win8/baMicrosoft)
2. Click Open on Device B (Win7/Toshiba)
3. Click Discover on Device A. Device B has been found. Select Device B.
4. Click connect.
5. On Device B  native message box is shown (screen attached in previous post) to confirm authentication. PIN number must be given (If not authentication fails).
6. I put PIN in message box on Device B (default 0000).
7. On device A message is shown - authentication success.  Device are paired.

Summary:
- Firstly, device are paired but not silently. I want to omit these steps 5-6.
- Secondly, when I swap devices in given scenario (Device A = Win7/Toshiba) then after step 4 occurs error: WCL_E_SERVICE_NOT_FOUND. Propably this is incorrect:                   
wclClient.BluetoothParams.Service = wcl.wclUUIDs.SerialPortServiceClass_UUID;

B. I try to auto-pair devices using ChatClient/ChatServerDemo.
1. Click Listen on Device A
2. Click discover on Device B. Device A has been found. Select Device A.
3. Click connect on Device B.
4. On Device B  native message box is shown (similar to previous scenario, but without textBox for PIN) to confirm authentication. Click OK to confirm.
5. I get WCL_E_TIMEOUT. Windows shows tooltip authentication with Device A went wrong.

I am really interested in buy your library but now I'm not satisfied enough. Please help.
Title: Re: WCL Demo - SilentAuth
Post by: Mike Petrichenko on June 03, 2015, 09:24:40 AM
Hello,

As I already told to be able to handle authentication requests with Toshiba stack you must run WCL based server and authentication in one application  on server side. It must not be native (build-in) server but server running by wclServer class. That is by Toshiba API design. But you have to use the same way for any stack as low-level API may change.

By the way, if you conectorl both sides you do not need pairing actualy.
Title: Re: WCL Demo - SilentAuth
Post by: smalinowski on June 04, 2015, 01:17:08 PM
Ok, thank you. I understood :)

I change a ChatClient/Server demo by adding wclAuthenticator. Now I can auto-pair devices but... still not silently.

A. When I try connect from A (client/baMicrosoft) to B (server/baToshiba) then windows message box is shown. I need to pass PIN (see attachment TPBluetoothConfirm.png). I pass pin and then devices are paired.

B. When I try connect from B to A  then then windows message box is shown. I don't have to pass PIN (see other attachment). I click on and then devices are paired.

I've tried many combinations with OnPasskey and OnPINRequest events but nothing works.


"By the way, if you conectorl both sides you do not need pairing actualy."
Do you mean that I don't need pairing devices to send data? How to do that? I tried without authenticator and it not works.

[attachment deleted by admin]
Title: Re: WCL Demo - SilentAuth
Post by: Mike Petrichenko on June 04, 2015, 02:37:53 PM
Hello,

The dialog appears when you connect to default Toshiba SPP  service. Disable all default services first.

To be able to connect without PIN you have to set wclClient.BluetoothParams.Authentication = false and wclServer.BluetoothParams.Authentication = false

By the way, which Toshiba version do you use?
Title: Re: WCL Demo - SilentAuth
Post by: smalinowski on June 04, 2015, 08:16:06 PM
I stopped TOSHIBA Bluetooth Service and also Bluetooth Support Service. It doesn't help, confirmation message box still apper :(

I develop application for Panasonic FZ-G1 ToughPad. Unfortunetaly, this tablet has system downgraded from Win8 to Win7. It has bluetooth drivers installed:
Bluetooth RFBUS: 9.0.1905.0
Bluetooth RFCOMM: 8.0.281.0
Bluetooth RFHIB: 9.0.801
Bluetooth V4.0 Module: 8.1.1919.0
Title: Re: WCL Demo - SilentAuth
Post by: Mike Petrichenko on June 05, 2015, 07:37:20 AM
Checked Thsiba 9. It looks like there is a bug in Toshiba 9 stack and it always requires authentication. Change Authentication = true; in client and server demos. Should work with such settings. Or switch to toshiba 8.
Title: Re: WCL Demo - SilentAuth
Post by: smalinowski on June 19, 2015, 09:45:52 AM
Solution works only partially :(

Firstly, I changed Authentication = true and hardcoded PIN both on server and client side. When I tried to connect

Device A (Toshiba stack / Win7)  [Client]  --->  [Server]   Device B (Microsoft stack / Win8).

Yes! It works, device has been paried and data sent. But in reversed configuration 

Device B (Microsoft stack / Win8) [Client]  --->  [Server]  Device A (Toshiba stack / Win7) 

It not works silently. Toshiba security bluetooth still prompts for PIN :(
Checked for Toshiba 8, and newest 9.1

I attach modifed demo source code of Chat/Server used for my tests.


[attachment deleted by admin]
Title: Re: WCL Demo - SilentAuth
Post by: Mike Petrichenko on June 19, 2015, 04:28:14 PM
Hello,

I tryed to reproduces the issu all the day today and it looks like a problem appears only with 64 build. Try to check 32 bit build on your side as well. I will keep working on this and let you know result in a couple of days.
Title: Re: WCL Demo - SilentAuth
Post by: smalinowski on June 22, 2015, 08:25:36 AM
I compiled with platform targer x86. I referenced WCL\build\x32\45\wcl.dll Still not works for Toshiba.
I tested chat for two machines with Win8 / baMicrosoft. It works great. Device connected even without pairing.
Title: Re: WCL Demo - SilentAuth
Post by: Mike Petrichenko on June 22, 2015, 10:18:52 AM
We have found workaround for this issue and adding it in WCL. The fix will be available soon.
Title: Re: WCL Demo - SilentAuth
Post by: smalinowski on June 29, 2015, 09:51:51 PM
Would you like to tell when this fix is supposed to be available?
Title: Re: WCL Demo - SilentAuth
Post by: Mike Petrichenko on June 29, 2015, 10:04:41 PM
Hello,

Should be in a couple of weeks. It's something with one undocumented function we use to handle Toshiba Auth requests for server side. We use undocumented features because documented API does not provide any metods for server auth.
Title: Re: WCL Demo - SilentAuth
Post by: Mike Petrichenko on July 03, 2015, 08:49:49 AM
Hello,

It looks we finally fixed the problem. Please, try this attached version.

[attachment deleted by admin]
Title: Re: WCL Demo - SilentAuth
Post by: Mike Petrichenko on July 07, 2015, 01:42:06 PM
Hello,

One more update fixed AV appears on some systems.

[attachment deleted by admin]
Title: Re: WCL Demo - SilentAuth
Post by: smalinowski on July 10, 2015, 03:00:42 PM
I referenced new wcl.dll to my modified Chat source.

For configuration  Device B (Microsoft stack / Win8) [Client]  --->  [Server]  Device A (Toshiba stack / Win7) 
when I click connect on client Device B then server app on Device A crashes (stops working...). I tried to catch exception on event handlers but It not helps. Propably exception is thrown from diffrent thread... I attached windows error log and mem dump.

[attachment deleted by admin]
Title: Re: WCL Demo - SilentAuth
Post by: Mike Petrichenko on July 10, 2015, 03:05:30 PM
Please download released version (6.14.4) from btframework.com. The A/V has already been fixed in that version.
Title: Re: WCL Demo - SilentAuth
Post by: smalinowski on July 13, 2015, 07:34:46 AM
Yes, it works! :)
Title: Re: WCL Demo - SilentAuth
Post by: smalinowski on July 14, 2015, 11:03:35 AM
If I need features like auto-pairing and server-client communication what licence should I buy? Personal is ok?
Title: Re: WCL Demo - SilentAuth
Post by: Mike Petrichenko on July 14, 2015, 12:08:39 PM
Hello,

If you need server features then you need Developer. If just simple pairing (without server features supporn in WCL) then personal is enough.
Title: Re: WCL Demo - SilentAuth
Post by: smalinowski on July 14, 2015, 11:29:45 PM
It is possible to send data through BT between two devices without server-feature?
If I buy Personal licence it is possible to upgrade to Developer?
Title: Re: WCL Demo - SilentAuth
Post by: Mike Petrichenko on July 15, 2015, 07:33:26 AM
It is possible to send data through BT between two devices without server-feature?

Unfortunately no.

If I buy Personal licence it is possible to upgrade to Developer?

Yes of couse. Just with a price difference. And of course, we can give a discount for Developer if it looks expensive for you.