你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

ServiceClient.InvokeDeviceMethodAsync 方法

定义

重载

InvokeDeviceMethodAsync(String, CloudToDeviceMethod, CancellationToken)

以交互方式在设备上调用 方法。 cloudToDeviceMethod 中的超时时间增加了 15 秒,以考虑连接请求所花费的时间

InvokeDeviceMethodAsync(String, String, CloudToDeviceMethod, CancellationToken)

以交互方式调用模块上的方法。

InvokeDeviceMethodAsync(String, CloudToDeviceMethod, CancellationToken)

以交互方式在设备上调用 方法。 cloudToDeviceMethod 中的超时时间增加了 15 秒,以考虑连接请求所花费的时间

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)

参数

deviceId
String

目标设备的设备标识符。

cloudToDeviceMethod
CloudToDeviceMethod

用于在设备上执行直接方法的参数。

cancellationToken
CancellationToken

用于取消操作的取消标记。

返回

CloudToDeviceMethodResult

例外

cloudToDeviceMethod 为 NULL 时。

适用于

InvokeDeviceMethodAsync(String, String, CloudToDeviceMethod, CancellationToken)

以交互方式调用模块上的方法。

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)

参数

deviceId
String

目标设备的设备标识符。

moduleId
String

目标模块的模块标识符。

cloudToDeviceMethod
CloudToDeviceMethod

用于对模块执行直接方法的参数。

cancellationToken
CancellationToken

用于取消操作的取消标记。

返回

CloudToDeviceMethodResult

例外

cloudToDeviceMethod 为 NULL 时。

适用于