DeviceMethod.invoke(String deviceId, String methodName, Long responseTimeoutInSeconds, Long connectTimeoutInSeconds, Object payload) Method

Definition

Directly invokes a method on the device and return its result.

public synchronized MethodResult invoke(String deviceId, String methodName, Long responseTimeoutInSeconds, Long connectTimeoutInSeconds, Object payload)
Parameters
deviceId
String

is the device identification.

methodName
String

is the name of the method that shall be invoked on the device.

responseTimeoutInSeconds
Long

is the maximum waiting time for a response from the device in seconds.

connectTimeoutInSeconds
Long

is the maximum waiting time for a response from the connection in seconds.

payload
Object

is the the method parameter

Returns
synchronized MethodResult

the status and payload resulted from the method invoke

Exceptions
IotHubException

This exception is thrown if the response verification failed

IOException

This exception is thrown if the IO operation failed