InternalClient.registerConnectionStatusChangeCallback(IotHubConnectionStatusChangeCallback callback, Object callbackContext) 方法

定义

Registers a callback to be executed when the connection status of the device changes. The callback will be fired with a status and a reason why the device's status changed. When the callback is fired, the provided context will be provided alongside the status and reason.

Note that the thread used to deliver this callback should not be used to call open()/closeNow() on the client that this callback belongs to. All open()/closeNow() operations should be done on a separate thread

public void registerConnectionStatusChangeCallback(IotHubConnectionStatusChangeCallback callback, Object callbackContext)

参数

callback
IotHubConnectionStatusChangeCallback

The callback to be fired when the connection status of the device changes. Can be null to unset this listener as long as the provided callbackContext is also null.

callbackContext
Object

a context to be passed to the callback. Can benull 

</code> . </p>

例外

IllegalArgumentException

if provided callback is null

适用于