InternalClient Class
- java.
lang. Object - com.
microsoft. azure. sdk. iot. device. InternalClient
- com.
public class InternalClient
Method Summary
Methods inherited from java.lang.Object
Method Details
close
public void close()
Throws:
closeNow
public void closeNow()
Throws:
getConfig
public DeviceClientConfig getConfig()
Getter for the device client config.
Returns:
getProductInfo
public ProductInfo getProductInfo()
isMultiplexed
public boolean isMultiplexed()
Returns if this client is or ever was registered to a MultiplexingClient instance. Device clients that were cannot be used in non-multiplexed connections. Device clients that aren't registered to any multiplexing client will still return true.
Returns:
open
public void open()
Throws:
registerConnectionStatusChangeCallback
public void 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
Parameters:
null
.
Throws:
sendEventAsync
public void sendEventAsync(Message message, IotHubEventCallback callback, Object callbackContext)
Asynchronously sends an event message to the IoT Hub.
Parameters:
null
.
null
if no callback is provided.
sendEventBatchAsync
public void sendEventBatchAsync(List
Asynchronously sends a batch of messages to the IoT Hub HTTPS messages will be sent in a single batch and MQTT and AMQP messages will be sent individually. In case of HTTPS, This API call is an all-or-nothing single HTTPS message and the callback will be triggered only once. Maximum payload size for HTTPS is 255KB
Parameters:
null
.
null
if no callback is provided.
sendReportedProperties
public void sendReportedProperties(ReportedPropertiesParameters reportedPropertiesParameters)
Sends reported properties
Parameters:
Throws:
sendReportedProperties
public void sendReportedProperties(Set
Sends reported properties
Parameters:
null
.
Throws:
sendReportedProperties
public void sendReportedProperties(Set
Sends reported properties
Parameters:
null
.
Throws:
sendReportedProperties
public void sendReportedProperties(Set
Sends reported properties
Parameters:
null
.
null
it will fall back to sendReportedProperties(Set<DeviceTwin.Property> reportedProperties, int version).
Throws:
setAsMultiplexed
protected void setAsMultiplexed()
setOperationTimeout
public void setOperationTimeout(long timeout)
Set the length of time, in milliseconds, that any given operation will expire in. These operations include reconnecting upon a connection drop and sending a message.
Parameters:
Throws:
setOption
public void setOption(String optionName, Object value)
Sets a runtime option identified by parameter optionName
to value
. The options that can be set via this API are: - SetMinimumPollingInterval - this option is applicable only when the transport configured with this client is HTTP. This option specifies the interval in milliseconds between calls to the service checking for availability of new messages. The value is expected to be of type long
. - SetSendInterval - this option is applicable to all protocols. This value sets the period (in milliseconds) that this SDK spawns threads to send queued messages. Even if no message is queued, this thread will be spawned. - SetReceiveInterval - this option is applicable to all protocols in case of HTTPS protocol, this option acts the same as SetMinimumPollingInterval
in case of MQTT and AMQP protocols, this option specifies the interval in milliseconds between spawning a thread that dequeues a message from the SDK's queue of received messages. - SetCertificatePath - this option is applicable only when the transport configured with this client is AMQP. This option specifies the path to the certificate used to verify peer. The value is expected to be of type String
. - SetSASTokenExpiryTime - this option is applicable for HTTP/ AMQP/MQTT. This option specifies the interval in seconds after which SASToken expires. If the transport is already open then setting this option will restart the transport with the updated expiry time, and will use that expiry time length for all subsequently generated sas tokens. The value is expected to be of type long
. - SetHttpsReadTimeout - this option is applicable for HTTPS. This option specifies the read timeout in milliseconds per https request made by this client. By default, this value is 4 minutes. The value is expected to be of type int
. - SetHttpsConnectTimeout - this option is applicable for HTTPS. This option specifies the connect timeout in milliseconds per https request made by this client. By default, this value is 0 (no connect timeout). The value is expected to be of type int
. - SetAmqpOpenAuthenticationSessionTimeout - this option is applicable for AMQP with SAS token authentication. This option specifies the timeout in seconds to wait to open the authentication session. By default, this value is 20 seconds. The value is expected to be of type int
. - SetAmqpOpenDeviceSessionsTimeout - this option is applicable for AMQP. This option specifies the timeout in seconds to open the device sessions. By default, this value is 60 seconds. The value is expected to be of type int
.
Parameters:
setProxySettings
public void setProxySettings(ProxySettings proxySettings)
Set the proxy settings for this client to connect through. If null then any previous settings will be erased
Parameters:
setRetryPolicy
public void setRetryPolicy(RetryPolicy retryPolicy)
Sets the given retry policy on the underlying transport See more details about the default retry policy and about using custom retry policies here
Parameters:
subscribeToDesiredProperties
public void subscribeToDesiredProperties(Map
Subscribes to desired properties. This client will receive a callback each time a desired property is updated. That callback will either contain the full desired properties set, or only the updated desired property depending on how the desired property was changed. IoT Hub supports a PUT and a PATCH on the twin. The PUT will cause this device client to receive the full desired properties set, and the PATCH will cause this device client to only receive the updated desired properties. Similarly, the version of each desired property will be incremented from a PUT call, and only the actually updated desired property will have its version incremented from a PATCH call. The java service client library uses the PATCH call when updated desired properties, but it builds the patch such that all properties are included in the patch. As a result, the device side will receive full twin updates, not partial updates. See PUT and PATCH
Parameters:
null
.
Throws:
subscribeToTwinDesiredProperties
public void subscribeToTwinDesiredProperties(Map
Subscribes to desired properties
Parameters:
null
.
Throws: