.NET Components for Mobility

Search for Part of DeviceName on DiscoverDevices

Last post 11-17-2008 6:37 AM by alanjmcf. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 06-01-2007 10:09 PM

    Search for Part of DeviceName on DiscoverDevices

    I'm writing a program that much communicate with my hardware using a PDA and bluetooth. All of my hardware begins with specific string and I was wondering if there was a way that I could force the DiscoverDevices to look for only devices beginning with that string. The problem with looking for all devices, is that on some occasions, there are a number of bluetooth devices in use around me and after I discover them I must sort through their DeviceNames. This presents a problem because some of the devices don't have names and so a name must be built from what I assume is the address. Waiting for these names to be found is causing my device discovery function to run for more than a minute at times. If there is some way to search for a string at the beginning of the name (ie "iA123" or "iA456"), and not to discover anything but that, it would speed up the search a lot. Any Suggestions?

    Thanks, Chris

  • 06-06-2007 8:16 PM In reply to

    Re: Search for Part of DeviceName on DiscoverDevices

    Bluetooth discovery is a two stage process first the devices in range are discovered by their addresses and only later is a query done to find what name each has.  So what you would like to do is not possible.  You'd have to implemente it yourself e.g. have a thread that does discovery and for new devices waits until the name is known before passing it back to the rest of the application; either just by waiting until its returned by the discovery process or calling BluetoothDeviceInfo.Refresh etc...

    Alan J. McFarlane
    http://www.alanjmcf.me.uk/
    Please follow-up in the newsgroup for the benefit of all.
    Have I helped? Consider visiting my Amazon wishlist, see my homepage.
  • 11-12-2008 11:03 AM In reply to

    Re: Search for Part of DeviceName on DiscoverDevices

    Can you switch of the 2bd stage of the process so your only retriving teh device address which would hopefully speed up teh discovery time

  • 11-17-2008 6:37 AM In reply to

    Re: Search for Part of DeviceName on DiscoverDevices

    On the Microsoft stack the discovery (Inquiry) process does complete before the names are discovered.  You can control the length of time the process will wait for more devices to appear with the BluetoothClient.InquiryLength property.  Or run the discovery in the background and add new devices to a list (with thread safety) for the foreground process to try to connect to.

    Alan

    Alan J. McFarlane
    http://www.alanjmcf.me.uk/
    Please follow-up in the newsgroup for the benefit of all.
    Have I helped? Consider visiting my Amazon wishlist, see my homepage.
Page 1 of 1 (4 items)
Copyright © 2001-2008 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy.