Author Topic: Problem while listing services of BT Device  (Read 21439 times)

Veldrin

  • Guest
Problem while listing services of BT Device
« on: March 08, 2010, 01:40:57 PM »
Hi,
I have encountered strange behaviour while trying to list services in descovered bluetooth device.

I modified some samples delivered with library to discover devices in the area and list only those of them that supports SPP service. So for every detected device I check if it have service SPP active by using function !wclErrors.wclShowError(wclBluetoothDevice.EnumServices(Radio, Services, wclUUIDs.SerialPortServiceClass_UUID))).

It works fine, but... it really rare happens that following window appears while executing EnumServices function:

If I cancel it I have an "Internal driver error" message shown.

Why does it happen? Can it be somehow prevented by my application? It happens on Microsoft stack, I haven't tested it on any other stack.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Problem while listing services of BT Device
« Reply #1 on: March 08, 2010, 01:50:10 PM »
Hi,

It appears because your device requires pairing to enumerate its services. Some devices need it. Just pair with device before check its services. To be sure try to enumerate ALL services. It it will not ask for PIN when you try to enumerate all services then it looks like a WCL bug. So let us know about result and:

1. OS?
2. Device?
3. BT Drivers?

Veldrin

  • Guest
Re: Problem while listing services of BT Device
« Reply #2 on: March 08, 2010, 02:02:08 PM »
Hi.
Enumerating all services generates same problem.
I would like to avoid situation that I have to pair devices before I really want to have conection with them. Is this totally device dependent?

OS: Windows XP Pro SP2,
BT Drivers:Microsoft 5.1.2600.2180
Device detected that needs pairing to list services: not sure, it's not mine

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Problem while listing services of BT Device
« Reply #3 on: March 08, 2010, 02:06:30 PM »
It depends on device model/settings. If device requires for pairing then there is no way to avoid it. Usualy it is Bluetooth HandsFree. Also it can be Fly or BlackBerry phones. However, you can use wclAuthenticator to avoid that message box and provide default PIN for such situations.

Veldrin

  • Guest
Re: Problem while listing services of BT Device
« Reply #4 on: March 08, 2010, 02:10:50 PM »
What will wclAuthenticator do if it fail to authenticate? Will it throw any exception or what?

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Problem while listing services of BT Device
« Reply #5 on: March 08, 2010, 02:13:36 PM »
It will do nothing but you will get error from method which cause authentication (EnumService for your case).

Veldrin

  • Guest
Re: Problem while listing services of BT Device
« Reply #6 on: March 08, 2010, 02:14:20 PM »
Well... I have to check it.

thanks for help.

pshaw

  • Guest
Re: Problem while listing services of BT Device
« Reply #7 on: June 14, 2010, 03:25:53 AM »
Is there sample code to solve this?  I have the same issue and it is also in the BT Discovery sample. 

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Problem while listing services of BT Device
« Reply #8 on: June 14, 2010, 07:39:18 AM »
Yes. Check BluetoothDiscovery demo and Pair method. Also you can use wclAuthenticator,

pshaw

  • Guest
Re: Problem while listing services of BT Device
« Reply #9 on: June 14, 2010, 08:44:03 AM »
Thanks for the quick response.  I tried the BluethoothDiscovery demo before posting my question and it prompts for a PIN.  I have tried the wclAuthenticator cannot get the syntax correct.  This is what I have:
                    for (uint i = 0; i < e.Devices.Count; i++)
                    {
                        wcl.wclBluetoothDevice Device = e.Devices;
                        wcl.wclBluetoothServices Services = new wcl.wclBluetoothServices();
                        wcl.wclBluetoothRadio Radio = GetSelectedRadio();
                        if (Radio != null)
                        {
                            //Dim a As Integer = e.Device.EnumServices(Radio, Services, wcl.wclUUIDs.OBEXObjectPushServiceClass_UUID)
                            //e.Accept = ((a = wcl.wclErrors.WCL_E_SUCCESS) And (Services.Count > 0))


                            wcl.wclAuthenticator Authenticate = Radio;

                            if (!wcl.wclErrors.wclShowError(Device.EnumServices(Radio, Services, null)))
                                if (Services.Count == 0)
                                    toolStripStatusLabelDiscovery.Text = "No Services found";
                                else

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Problem while listing services of BT Device
« Reply #10 on: June 14, 2010, 10:39:21 AM »
Hello,

You lost Authenticator.Open()

Please refer to Authenticator demo to see how it works.

 

Sitemap 1 2 3 4 5 6 7