Author Topic: Wrong InRange status after fast discovery  (Read 18923 times)

dartecs

  • Guest
Wrong InRange status after fast discovery
« on: January 26, 2015, 12:05:30 PM »
I found a strange behaviour after fast discovery. Here is what I found:

- Using WCL BluetoothDiscoveryDemo
- Changed the Discovery to the (undocumented) fast mode:

Code: [Select]
        private void btDiscover_Click(object sender, EventArgs e)
        {
            wcl.wclBluetoothRadio Radio = GetSelectedRadio();
            if (Radio != null)
            {
                wcl.wclErrors.wclShowError(wclBluetoothDiscovery.Discovery(Radio,
                    Convert.ToByte(edDiscoverTimeout.Text), true));   // true = fast mode
            }
        }

- When running the demo sometimes turned off non-paired devices are still discovered. (Screen Shot #1) This is not what I would expect but is also not a big problem.
- Then I turn on the device and click "Is In Range". The device is still shown as not in range. (Screen Shot #2) Why? I would expect the device to be shown as "In Range" now.

Is this a bug or am I doing something wrong?

I need a "correct" in range discovery because I want to implement my own "add a device" dialog.


[attachment deleted by admin]

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Wrong InRange status after fast discovery
« Reply #1 on: January 26, 2015, 03:17:33 PM »
Hello,

Both situations are normal

1. Non paired device may appears during Fast discovering if it has "Remembered" status on MS (it is how MS stack works and no way to find a workaround).
2. Device may appears as not in range if it requires pairing to enumerate its services or even sometime if it does not. IsInRange simple connects to device and trys to enumerate its services as there is no other easy way (as for example HCI PING) to know is device in range or not.

dartecs

  • Guest
Re: Wrong InRange status after fast discovery
« Reply #2 on: January 27, 2015, 12:37:11 PM »
Thank you for the detailed explanations. So I will have to make some changes to my application and use "normal" discovering when looking up new devices in range.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Wrong InRange status after fast discovery
« Reply #3 on: January 27, 2015, 12:39:30 PM »
The biggest problem with MS stack that it returns paired/remembered devices when they are turned of even with full discovery. If you need to just detect that device is in range I recomend to unpair all devices after discovering. In this case discovering returns only available device. Also you can use Monitoring feature (you have to unpair devices as well).

dartecs

  • Guest
Re: Wrong InRange status after fast discovery
« Reply #4 on: January 27, 2015, 02:45:46 PM »
One more question: Is there a way to find out if a device is a "remebered" device? There seems to be some way, because the Windows "Add a Device" dialog does not display those "remebered" devices.

Example: I have a device (seemingly in the remembered state) that is discovered by my wcl.wclBluetoothDiscovery but at the same time is neither shown in the Windows "Show Bluetooth Devices" nor in the Windows "Add a Device" dialog.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Wrong InRange status after fast discovery
« Reply #5 on: January 27, 2015, 02:50:32 PM »
Unfortunately WCL does not show that status because that status available only on MS drivers. Try to execute discovery with Fast = False and Timeout = 30 (default settings). Then call Unpair for all found devices. It should help to hide unavailable devices.

When MS BT dialog appears it uses some special feature before show device. The problem why we can not add it in WCL that WCL must support more than 1 stack.

If you have some knowlages in Windows API programming try to use WM_DEVICE_CHANGE message. The MS BT stack sends it when device's name resolved and when some other communication with device appears (HCI communication). You do not need that when work with any other stack.

dartecs

  • Guest
Re: Wrong InRange status after fast discovery
« Reply #6 on: January 27, 2015, 03:44:10 PM »
OK, all clear now. I already assumed that this is some Microsoft stack feature... Thanks again for the excellent support!

 

Sitemap 1 2 3 4 5 6 7