GattDeviceService.FromIdAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
FromIdAsync(String, GattSharingMode) |
Instantiates a new GattDeviceService object from the device ID. |
FromIdAsync(String) |
Instantiates a new GattDeviceService from the device ID. |
FromIdAsync(String, GattSharingMode)
Instantiates a new GattDeviceService object from the device ID.
public:
static IAsyncOperation<GattDeviceService ^> ^ FromIdAsync(Platform::String ^ deviceId, GattSharingMode sharingMode);
/// [Windows.Foundation.Metadata.Overload("FromIdWithSharingModeAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
static IAsyncOperation<GattDeviceService> FromIdAsync(winrt::hstring const& deviceId, GattSharingMode const& sharingMode);
[Windows.Foundation.Metadata.Overload("FromIdWithSharingModeAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<GattDeviceService> FromIdAsync(string deviceId, GattSharingMode sharingMode);
function fromIdAsync(deviceId, sharingMode)
Public Shared Function FromIdAsync (deviceId As String, sharingMode As GattSharingMode) As IAsyncOperation(Of GattDeviceService)
Parameters
- deviceId
-
String
Platform::String
winrt::hstring
The GATT device ID.
- sharingMode
- GattSharingMode
The sharing mode of the GATT device.
Returns
An asynchronous operation that completes with a GattDeviceService object.
- Attributes
Windows requirements
Device family |
Windows 10 Creators Update (introduced in 10.0.15063.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v4.0)
|
App capabilities |
bluetooth
|
Applies to
FromIdAsync(String)
Instantiates a new GattDeviceService from the device ID.
public:
static IAsyncOperation<GattDeviceService ^> ^ FromIdAsync(Platform::String ^ deviceId);
/// [Windows.Foundation.Metadata.RemoteAsync]
static IAsyncOperation<GattDeviceService> FromIdAsync(winrt::hstring const& deviceId);
/// [Windows.Foundation.Metadata.RemoteAsync]
/// [Windows.Foundation.Metadata.Overload("FromIdAsync")]
static IAsyncOperation<GattDeviceService> FromIdAsync(winrt::hstring const& deviceId);
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<GattDeviceService> FromIdAsync(string deviceId);
[Windows.Foundation.Metadata.RemoteAsync]
[Windows.Foundation.Metadata.Overload("FromIdAsync")]
public static IAsyncOperation<GattDeviceService> FromIdAsync(string deviceId);
function fromIdAsync(deviceId)
Public Shared Function FromIdAsync (deviceId As String) As IAsyncOperation(Of GattDeviceService)
Parameters
- deviceId
-
String
Platform::String
winrt::hstring
The GATT device ID.
Returns
The object for managing the asynchronous operation, which, upon completion, returns the newly instantiated GattDeviceService.
- Attributes
Windows requirements
App capabilities |
bluetooth
|
Remarks
The first time this method is invoked by a store app, it should be called from a UI thread in order to display the consent prompt. After the user has granted consent, the method can be invoked from any application thread.
If a store app has not declared the right capabilities or the user does not grant consent, the method returns a null object.
- For Universal Windows Platform (UWP) apps, use the bluetooth capability. For more info see App capability declarations.
- For Windows 8.x store apps, see How to specify device capabilities for Bluetooth (Windows) to declare the right capabilities.