다음을 통해 공유


ServiceClient.InvokeDeviceMethodAsync Method

Definition

Overloads

InvokeDeviceMethodAsync(String, CloudToDeviceMethod, CancellationToken)

Interactively invokes a method on a device. Additional 15s is added to the timeout in cloudToDeviceMethod to account for time taken to wire a request

InvokeDeviceMethodAsync(String, String, CloudToDeviceMethod, CancellationToken)

Interactively invokes a method on a module.

InvokeDeviceMethodAsync(String, CloudToDeviceMethod, CancellationToken)

Interactively invokes a method on a device. Additional 15s is added to the timeout in cloudToDeviceMethod to account for time taken to wire a request

public virtual System.Threading.Tasks.Task<Microsoft.Azure.Devices.CloudToDeviceMethodResult> InvokeDeviceMethodAsync (string deviceId, Microsoft.Azure.Devices.CloudToDeviceMethod cloudToDeviceMethod, System.Threading.CancellationToken cancellationToken = default);
abstract member InvokeDeviceMethodAsync : string * Microsoft.Azure.Devices.CloudToDeviceMethod * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.CloudToDeviceMethodResult>
override this.InvokeDeviceMethodAsync : string * Microsoft.Azure.Devices.CloudToDeviceMethod * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.CloudToDeviceMethodResult>
Public Overridable Function InvokeDeviceMethodAsync (deviceId As String, cloudToDeviceMethod As CloudToDeviceMethod, Optional cancellationToken As CancellationToken = Nothing) As Task(Of CloudToDeviceMethodResult)

Parameters

deviceId
String

The device identifier for the target device.

cloudToDeviceMethod
CloudToDeviceMethod

Parameters to execute a direct method on the device.

cancellationToken
CancellationToken

A cancellation token to cancel the operation.

Returns

The CloudToDeviceMethodResult.

Exceptions

When cloudToDeviceMethod is null.

Applies to

InvokeDeviceMethodAsync(String, String, CloudToDeviceMethod, CancellationToken)

Interactively invokes a method on a module.

public virtual System.Threading.Tasks.Task<Microsoft.Azure.Devices.CloudToDeviceMethodResult> InvokeDeviceMethodAsync (string deviceId, string moduleId, Microsoft.Azure.Devices.CloudToDeviceMethod cloudToDeviceMethod, System.Threading.CancellationToken cancellationToken = default);
abstract member InvokeDeviceMethodAsync : string * string * Microsoft.Azure.Devices.CloudToDeviceMethod * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.CloudToDeviceMethodResult>
override this.InvokeDeviceMethodAsync : string * string * Microsoft.Azure.Devices.CloudToDeviceMethod * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.CloudToDeviceMethodResult>
Public Overridable Function InvokeDeviceMethodAsync (deviceId As String, moduleId As String, cloudToDeviceMethod As CloudToDeviceMethod, Optional cancellationToken As CancellationToken = Nothing) As Task(Of CloudToDeviceMethodResult)

Parameters

deviceId
String

The device identifier for the target device.

moduleId
String

The module identifier for the target module.

cloudToDeviceMethod
CloudToDeviceMethod

Parameters to execute a direct method on the module.

cancellationToken
CancellationToken

A cancellation token to cancel the operation.

Returns

The CloudToDeviceMethodResult.

Exceptions

When cloudToDeviceMethod is null.

Applies to