Dela via


BluetoothLEDevice.FromBluetoothAddressAsync Method

Definition

Overloads

FromBluetoothAddressAsync(UInt64)

Returns a BluetoothLEDevice object representing the peer Bluetooth LE device with the given address. See Remarks (in this member topic).

FromBluetoothAddressAsync(UInt64, BluetoothAddressType)

Returns a BluetoothLEDevice object representing the peer device with the given address and address type. See Remarks (in this member topic).

FromBluetoothAddressAsync(UInt64)

Returns a BluetoothLEDevice object representing the peer Bluetooth LE device with the given address. See Remarks (in this member topic).

public:
 static IAsyncOperation<BluetoothLEDevice ^> ^ FromBluetoothAddressAsync(unsigned long long bluetoothAddress);
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<BluetoothLEDevice> FromBluetoothAddressAsync(uint64_t const& bluetoothAddress);
/// [Windows.Foundation.Metadata.RemoteAsync]
/// [Windows.Foundation.Metadata.Overload("FromBluetoothAddressAsync")]
 static IAsyncOperation<BluetoothLEDevice> FromBluetoothAddressAsync(uint64_t const& bluetoothAddress);
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<BluetoothLEDevice> FromBluetoothAddressAsync(ulong bluetoothAddress);
[Windows.Foundation.Metadata.RemoteAsync]
[Windows.Foundation.Metadata.Overload("FromBluetoothAddressAsync")]
public static IAsyncOperation<BluetoothLEDevice> FromBluetoothAddressAsync(ulong bluetoothAddress);
function fromBluetoothAddressAsync(bluetoothAddress)
Public Shared Function FromBluetoothAddressAsync (bluetoothAddress As ULong) As IAsyncOperation(Of BluetoothLEDevice)

Parameters

bluetoothAddress
UInt64

unsigned long long

uint64_t

A BluetoothAddress value containing the 64-bit address of the peer Bluetooth LE device.

Returns

Returns an object representing an asynchronous operation. When that object completes, it contains a BluetoothLEDevice object representing the peer Bluetooth LE device with the given address.

Important

The returned BluetoothLEDevice is set to null if FromBluetoothAddressAsync can't find the device identified by bluetoothAddress. Specifically, if the device isn't paired and it isn't found in the system cache. You can populate the cache for a non-paired device using either the LE advertisement watcher APIs (BluetoothLEAdvertisementWatcher) or the device enumeration APIs (GetDeviceSelectorFromPairingState) to scan for the Bluetooth devices before the FromBluetoothAddressAsync can be successfully used.

Attributes

Windows requirements

App capabilities
bluetooth

Remarks

Creating a BluetoothLEDevice object by calling this method alone doesn't (necessarily) initiate a connection. To initiate a connection, set GattSession.MaintainConnection to true, or call an uncached service discovery method on BluetoothLEDevice, or perform a read/write operation against the device.

  • If GattSession.MaintainConnection is set to true, then the system waits indefinitely for a connection, and it will connect when the device is available. There's nothing for your application to wait on, since GattSession.MaintainConnection is a property.
  • For service discovery and read/write operations in GATT, the system waits a finite but variable time. Anything from instantaneous to a matter of minutes. Factors include the traffic on the stack, and how queued up the request is. If there are no other pending request, and the remote device is unreachable, then the system will wait for 7 seconds before it times out. If there are other pending requests, then each of the requests in the queue can take 7 seconds to process, so the further yours is toward the back of the queue, the longer you'll wait.

You can't cancel the connection process.

See also

Applies to

FromBluetoothAddressAsync(UInt64, BluetoothAddressType)

Returns a BluetoothLEDevice object representing the peer device with the given address and address type. See Remarks (in this member topic).

public:
 static IAsyncOperation<BluetoothLEDevice ^> ^ FromBluetoothAddressAsync(unsigned long long bluetoothAddress, BluetoothAddressType bluetoothAddressType);
/// [Windows.Foundation.Metadata.Overload("FromBluetoothAddressWithBluetoothAddressTypeAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<BluetoothLEDevice> FromBluetoothAddressAsync(uint64_t const& bluetoothAddress, BluetoothAddressType const& bluetoothAddressType);
[Windows.Foundation.Metadata.Overload("FromBluetoothAddressWithBluetoothAddressTypeAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<BluetoothLEDevice> FromBluetoothAddressAsync(ulong bluetoothAddress, BluetoothAddressType bluetoothAddressType);
function fromBluetoothAddressAsync(bluetoothAddress, bluetoothAddressType)
Public Shared Function FromBluetoothAddressAsync (bluetoothAddress As ULong, bluetoothAddressType As BluetoothAddressType) As IAsyncOperation(Of BluetoothLEDevice)

Parameters

bluetoothAddress
UInt64

unsigned long long

uint64_t

A BluetoothAddress value containing the 64-bit address of the peer Bluetooth LE device.

bluetoothAddressType
BluetoothAddressType

A BluetoothAddressType value containing the address type of the peer Bluetooth LE device.

Returns

Returns an object representing an asynchronous operation. When that object completes, it contains a BluetoothLEDevice object representing the peer device with the given address and address type.

Important

The returned BluetoothLEDevice is set to null if FromBluetoothAddressAsync can't find the device identified by bluetoothAddress. Specifically, if the device isn't paired and it isn't found in the system cache. You can populate the cache for a non-paired device using either the LE advertisement watcher APIs (BluetoothLEAdvertisementWatcher) or the device enumeration APIs (GetDeviceSelectorFromPairingState) to scan for the Bluetooth devices before the FromBluetoothAddressAsync can be successfully used.

Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10586.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced in v2.0)
App capabilities
bluetooth

Remarks

Creating a BluetoothLEDevice object by calling this method alone doesn't (necessarily) initiate a connection. To initiate a connection, set GattSession.MaintainConnection to true, or call an uncached service discovery method on BluetoothLEDevice, or perform a read/write operation against the device.

  • If GattSession.MaintainConnection is set to true, then the system waits indefinitely for a connection, and it will connect when the device is available. There's nothing for your application to wait on, since GattSession.MaintainConnection is a property.
  • For service discovery and read/write operations in GATT, the system waits a finite but variable time. Anything from instantaneous to a matter of minutes. Factors include the traffic on the stack, and how queued up the request is. If there are no other pending request, and the remote device is unreachable, then the system will wait for 7 seconds before it times out. If there are other pending requests, then each of the requests in the queue can take 7 seconds to process, so the further yours is toward the back of the queue, the longer you'll wait.

Currently, you can't cancel the connection process.

See also

Applies to