DeviceMethod Class
- java.
lang. Object - com.
microsoft. azure. sdk. iot. service. devicetwin. DeviceMethod
- com.
public class DeviceMethod
DeviceMethod enables service client to directly invoke methods on various devices from service client.
Constructor Summary
Constructor | Description |
---|---|
DeviceMethod(String connectionString) |
Create a Device |
DeviceMethod(String hostName, AzureSasCredential azureSasCredential) |
Create a new Device |
DeviceMethod(String hostName, AzureSasCredential azureSasCredential, DeviceMethodClientOptions options) |
Create a new Device |
DeviceMethod(String hostName, TokenCredential credential) |
Create a new Device |
DeviceMethod(String hostName, TokenCredential credential, DeviceMethodClientOptions options) |
Create a new Device |
DeviceMethod(String connectionString, DeviceMethodClientOptions options) |
Create a Device |
Method Summary
Modifier and Type | Method and Description |
---|---|
static
Device |
createFromConnectionString(String connectionString)
Deprecated
because this method declares a thrown IOException even though it never throws an IOException. Users are recommended to use DeviceMethod(String connectionString) instead since it does not declare this exception even though it constructs the same Device
Create a Device |
static
Device |
createFromConnectionString(String connectionString, DeviceMethodClientOptions options)
Deprecated
because this method declares a thrown IOException even though it never throws an IOException. Users are recommended to use DeviceMethod(String connectionString, DeviceMethodClientOptions options) instead since it does not declare this exception even though it constructs the same Device
Create a Device |
synchronized
Method |
invoke(String deviceId, String methodName, Long responseTimeoutInSeconds, Long connectTimeoutInSeconds, Object payload)
Directly invokes a method on the device and return its result. |
synchronized
Method |
invoke(String deviceId, String moduleId, String methodName, Long responseTimeoutInSeconds, Long connectTimeoutInSeconds, Object payload)
Directly invokes a method on the module and return its result. |
Job |
scheduleDeviceMethod(String queryCondition, String methodName, Long responseTimeoutInSeconds, Long connectTimeoutInSeconds, Object payload, Date startTimeUtc, long maxExecutionTimeInSeconds)
Creates a new Job to invoke method on one or multiple devices. |
Methods inherited from java.lang.Object
Constructor Details
DeviceMethod
public DeviceMethod(String connectionString)
Create a DeviceMethod instance from the information in the connection string.
Parameters:
DeviceMethod
public DeviceMethod(String hostName, AzureSasCredential azureSasCredential)
Create a new DeviceMethod instance.
Parameters:
DeviceMethod
public DeviceMethod(String hostName, AzureSasCredential azureSasCredential, DeviceMethodClientOptions options)
Create a new DeviceMethod instance.
Parameters:
DeviceMethod
public DeviceMethod(String hostName, TokenCredential credential)
Create a new DeviceMethod instance.
Parameters:
DeviceMethod
public DeviceMethod(String hostName, TokenCredential credential, DeviceMethodClientOptions options)
Create a new DeviceMethod instance.
Parameters:
DeviceMethod
public DeviceMethod(String connectionString, DeviceMethodClientOptions options)
Create a DeviceMethod instance from the information in the connection string.
Parameters:
Method Details
createFromConnectionString
public static DeviceMethod createFromConnectionString(String connectionString)
Deprecated
Create a DeviceMethod instance from the information in the connection string.
Parameters:
Returns:
Throws:
createFromConnectionString
public static DeviceMethod createFromConnectionString(String connectionString, DeviceMethodClientOptions options)
Deprecated
Create a DeviceMethod instance from the information in the connection string.
Parameters:
Returns:
Throws:
invoke
public synchronized MethodResult invoke(String deviceId, String methodName, Long responseTimeoutInSeconds, Long connectTimeoutInSeconds, Object payload)
Directly invokes a method on the device and return its result.
Parameters:
Returns:
Throws:
invoke
public synchronized MethodResult invoke(String deviceId, String moduleId, String methodName, Long responseTimeoutInSeconds, Long connectTimeoutInSeconds, Object payload)
Directly invokes a method on the module and return its result.
Parameters:
Returns:
Throws:
scheduleDeviceMethod
public Job scheduleDeviceMethod(String queryCondition, String methodName, Long responseTimeoutInSeconds, Long connectTimeoutInSeconds, Object payload, Date startTimeUtc, long maxExecutionTimeInSeconds)
Creates a new Job to invoke method on one or multiple devices.
Parameters:
null
or empty.
null
.
null
.
null
.
Returns:
Throws:
Applies to
Azure SDK for Java