RfcommDeviceService.FromIdAsync(String) 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.
Gets an RfcommDeviceService object from a DeviceInformation Id for an RFCOMM service instance.
public:
static IAsyncOperation<RfcommDeviceService ^> ^ FromIdAsync(Platform::String ^ deviceId);
/// [Windows.Foundation.Metadata.RemoteAsync]
static IAsyncOperation<RfcommDeviceService> FromIdAsync(winrt::hstring const& deviceId);
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<RfcommDeviceService> FromIdAsync(string deviceId);
function fromIdAsync(deviceId)
Public Shared Function FromIdAsync (deviceId As String) As IAsyncOperation(Of RfcommDeviceService)
Parameters
- deviceId
-
String
Platform::String
winrt::hstring
The DeviceInformation Id that identifies the RFCOMM service instance. This id can be retrieved from Windows.Devices.Enumeration.
Returns
The RfcommDeviceService object that represents the RFCOMM service instance.
- 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.
Warning
If the device acting as the RFCOMM server does not have the correct channel registered in its manifest, this method throws an exception when called on the device acting as the RFCOMM client.