次の方法で共有


DeviceMethod Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.device.DeviceTwin.DeviceMethod

public final class DeviceMethod

Constructor Summary

Constructor Description
DeviceMethod(DeviceIO deviceIO, DeviceClientConfig config, IotHubEventCallback deviceMethodStatusCallback, Object deviceMethodStatusCallbackContext)

This constructor creates an instance of device method class which helps facilitate the interation for device methods between the user and IotHub.

Method Summary

Modifier and Type Method and Description
void subscribeToDeviceMethod(DeviceTwin.DeviceMethodCallback deviceMethodCallback, Object deviceMethodCallbackContext)

A method which subscribes to receive device method invocation for the user with the IotHub.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

DeviceMethod

public DeviceMethod(DeviceIO deviceIO, DeviceClientConfig config, IotHubEventCallback deviceMethodStatusCallback, Object deviceMethodStatusCallbackContext)

This constructor creates an instance of device method class which helps facilitate the interation for device methods between the user and IotHub.

Parameters:

deviceIO - Device client object for this connection instance for the device. Cannot be null
config - Device client configuration Cannot be null
deviceMethodStatusCallback - Callback to provide status for device method state with IotHub. Cannot be null.
deviceMethodStatusCallbackContext - Context to be passed when device method status is invoked. Can be null

Throws:

java.lang.IllegalArgumentException - This exception is thrown if either deviceIO or config or deviceMethodStatusCallback are null

Method Details

subscribeToDeviceMethod

public void subscribeToDeviceMethod(DeviceTwin.DeviceMethodCallback deviceMethodCallback, Object deviceMethodCallbackContext)

A method which subscribes to receive device method invocation for the user with the IotHub.

Parameters:

deviceMethodCallback - Callback where upon receiving the request the invoke a method shall be triggered.
deviceMethodCallbackContext - Context to be passed on when invoking the callback.

Throws:

java.lang.IllegalArgumentException - This exception is thrown when deviceMethodCallback is provided null.

Applies to