DeviceTwin Class

  • java.lang.Object

public class DeviceTwin implements MessageCallback

Constructor Summary

Constructor Description
DeviceTwin(InternalClient client)

Method Summary

Modifier and Type Method and Description
void getTwinAsync(GetTwinCorrelatingMessageCallback twinCallback, Object callbackContext)
IotHubMessageResult onCloudToDeviceMessageReceived(Message message, Object callbackContext)

Executes the callback. The callback should return a response that instructs an IoT Hub to COMPLETE, ABANDON, or REJECT the message.

If this callback throws an exception it will not complete the message and can cause the messages to build up on the IoT hub until they expire. This can prevent further message delivery until all messages are expired or completed from IoT hub.

void subscribeToDesiredPropertiesAsync(SubscriptionAcknowledgedCallback subscriptionAcknowledgedCallback, Object subscribeToDesiredPropertiesCallbackContext, DesiredPropertiesCallback desiredPropertiesCallback, Object desiredPropertiesUpdateCallbackContext)
void updateReportedPropertiesAsync(TwinCollection reportedProperties, ReportedPropertiesUpdateCorrelatingMessageCallback reportedPropertiesUpdateCorrelatingMessageCallback, Object callbackContext)

Constructor Details

DeviceTwin

public DeviceTwin(InternalClient client)

Parameters:

client

Method Details

getTwinAsync

public void getTwinAsync(GetTwinCorrelatingMessageCallback twinCallback, Object callbackContext)

Parameters:

twinCallback
callbackContext

onCloudToDeviceMessageReceived

public IotHubMessageResult onCloudToDeviceMessageReceived(Message message, Object callbackContext)

Executes the callback. The callback should return a response that instructs an IoT Hub to COMPLETE, ABANDON, or REJECT the message.

If this callback throws an exception it will not complete the message and can cause the messages to build up on the IoT hub until they expire. This can prevent further message delivery until all messages are expired or completed from IoT hub.

Overrides:

DeviceTwin.onCloudToDeviceMessageReceived(Message message, Object callbackContext)

Parameters:

message - the message.
callbackContext - a custom context given by the developer.

Returns:

whether the IoT Hub should COMPLETE, ABANDON, or REJECT the message.

subscribeToDesiredPropertiesAsync

public void subscribeToDesiredPropertiesAsync(SubscriptionAcknowledgedCallback subscriptionAcknowledgedCallback, Object subscribeToDesiredPropertiesCallbackContext, DesiredPropertiesCallback desiredPropertiesCallback, Object desiredPropertiesUpdateCallbackContext)

Parameters:

subscriptionAcknowledgedCallback
subscribeToDesiredPropertiesCallbackContext
desiredPropertiesCallback
desiredPropertiesUpdateCallbackContext

updateReportedPropertiesAsync

public void updateReportedPropertiesAsync(TwinCollection reportedProperties, ReportedPropertiesUpdateCorrelatingMessageCallback reportedPropertiesUpdateCorrelatingMessageCallback, Object callbackContext)

Parameters:

reportedProperties
reportedPropertiesUpdateCorrelatingMessageCallback
callbackContext

Applies to