Click to Rate and Give Feedback
MSDN
MSDN Library
Networking
Wireless Networking
Bluetooth
Bluetooth Reference
 BLUETOOTH_DEVICE_SEARCH_PARAMS Stru...
BLUETOOTH_DEVICE_SEARCH_PARAMS Structure

The BLUETOOTH_DEVICE_SEARCH_PARAMS structure specifies search criteria for Bluetooth device searches.

Syntax

C++
typedef struct {
  DWORD  dwSize;
  BOOL   fReturnAuthenticated;
  BOOL   fReturnRemembered;
  BOOL   fReturnUnknown;
  BOOL   fReturnConnected;
  BOOL   fIssueInquiry;
  UCHAR  cTimeoutMultiplier;
  HANDLE hRadio;
}BLUETOOTH_DEVICE_SEARCH_PARAMS;

Members

dwSize

The size, in bytes, of the structure.

fReturnAuthenticated

A value that specifies that the search should return authenticated Bluetooth devices.

fReturnRemembered

A value that specifies that the search should return remembered Bluetooth devices.

fReturnUnknown

A value that specifies that the search should return unknown Bluetooth devices.

fReturnConnected

A value that specifies that the search should return connected Bluetooth devices.

fIssueInquiry

A value that specifies that a new inquiry should be issued.

cTimeoutMultiplier

A value that indicates the time out for the inquiry, expressed in increments of 1.28 seconds. For example, an inquiry of 12.8 seconds has a cTimeoutMultiplier value of 10. The maximum value for this member is 48. When a value greater than 48 is used, the calling function immediately fails and returns E_INVALIDARG.

hRadio

A handle for the radio on which to perform the inquiry. Set to NULL to perform the inquiry on all local Bluetooth radios.

Requirements

Minimum supported clientWindows Vista, Windows XP with SP2
Minimum supported serverNone supported
HeaderBluetoothAPIs.h (include Bthsdpdef.h or BluetoothAPIs.h)

See Also

BluetoothDisplayDeviceProperties
BluetoothGetDeviceInfo
BluetoothFindDeviceClose
BluetoothFindFirstDevice
BluetoothFindNextDevice
BluetoothRemoveDevice
BluetoothUpdateDeviceRecord

Send comments about this topic to Microsoft

Build date: 11/19/2009

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
More details      Carl Kenner   |   Edit   |   Show History
This structure only work on the Microsoft Bluetooth Stack. If you have BlueSoleil, you need to use the BlueSoleil SDK. If you have Widcomm you need to use the Widcomm SDK, unless you have Vista, in which case Widcomm uses the Microsoft Bluetooth Stack. If you have Toshiba, then I have no idea.

"Bluetooth Radio" means the USB bluetooth adapter or internal bluetooth adapter in your computer. Each one can only talk to 7 bluetooth devices, so people who need more than 7 devices simply plug two bluetooth adapters into their computer. That is why the "hRadio" field exists, it allows you to say which bluetooth adapter to use for the search. Setting "hRadio" to 0 or NULL, will use all the bluetooth adapters.

When doing a search (by setting fIssueInquiry to true), BluetoothFindFirstDevice will always take the full amount of time specified in cTimeoutMultiplier, regardless of whether it finds a device before then or not. So you still have to wait for that timeout before the first result appears. Which is very annoying. If you want a more responsive interface, you can try doing a short timeout first, then following it by a long timeout if you didn't find what you are looking for.

Setting any of the flags to true will return more results rather than less.

"Remembered" devices are those that were already listed in the "Bluetooth Devices" window before you called BluetoothFindFirstDevice. They might not be connected though.

If you specify "fIssueInquiry" to do a search, and it finds a remembered device again, that device won't be returned unless you specify "fReturnRemembered".

There is no way to tell the difference between a remembered device that was found again, and a remembered device that wasn't found.

Remembered devices are a pain. If they are HID devices then they still show up in HID, but they won't work, and there is no way to tell if the device is really there or not other than trying to talk to it.

You can remove devices from the "Bluetooth Devices" window, and thus from the list of remembered devices, by calling BluetoothRemoveDevice.

Once you have found bluetooth devices with BluetoothFindFirstDevice, and BluetoothFindNextDevice, you can tell windows to automatically connect to it and load the appropriate drivers. If the device doesn't need a pin number, you just use

BluetoothSetServiceState(0, &bdi, HumanInterfaceDeviceServiceClass_UUID, BLUETOOTH_SERVICE_ENABLE);
// Replacing HumanInterfaceDeviceServiceClass_UUID with whatever service you want to connect to.

Unfortunately connecting like that doesn't seem to work on remembered devices, at least it didn't work for me. You can either call BluetoothRemoveDevice directly before calling BluetoothSetServiceState, or you can remove the remembered devices before doing the actual search.

"Unknown" devices are those whose Bluetooth address has been discovered, but whose name has not been discovered yet.
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker