public class IoTCClient extends Object implements IIoTCClient
| Constructor and Description |
|---|
IoTCClient(String id,
String scopeId,
IOTC_CONNECT authenticationType,
Object options) |
IoTCClient(String id,
String scopeId,
IOTC_CONNECT authenticationType,
Object options,
ILogger logger) |
| Modifier and Type | Method and Description |
|---|---|
void |
Connect()
Connect device.
|
void |
Disconnect(IoTCCallback callback)
Disconnect device.
|
void |
on(IOTC_EVENTS event,
IoTCCallback callback)
Listen to events.
|
void |
SendEvent(Object payload,
IoTCCallback callback)
Send events
|
void |
SendProperty(Object payload,
IoTCCallback callback)
Send update values to properties.
|
void |
SendState(Object payload,
IoTCCallback callback)
Send a state message
|
void |
SendTelemetry(Object payload,
IoTCCallback callback)
Send a telemetry message.
|
void |
SetGlobalEndpoint(String endpoint)
Set DPS global endpoint.
|
void |
SetLogging(IOTC_LOGGING logLevel)
Set logging level (FULL, API_ONLY, DISABLED).
|
void |
SetProtocol(IOTC_PROTOCOL transport)
Set connection protocol (MQTT, AMQP, HTTPS).
|
void |
SetProxy(HTTP_PROXY_OPTIONS options)
Set network proxy Must be called before Connect().
|
public IoTCClient(String id, String scopeId, IOTC_CONNECT authenticationType, Object options)
public IoTCClient(String id, String scopeId, IOTC_CONNECT authenticationType, Object options, ILogger logger)
public void SetLogging(IOTC_LOGGING logLevel)
IIoTCClientSetLogging in interface IIoTCClientlogLevel - the logger to setpublic void SetProtocol(IOTC_PROTOCOL transport)
IIoTCClientSetProtocol in interface IIoTCClienttransport - Trasport to set. Default: MQTTpublic void SetGlobalEndpoint(String endpoint)
IIoTCClientSetGlobalEndpoint in interface IIoTCClientendpoint - Endpoint of DPS server. Default:
"global.azure-devices-provisioning.net"public void SetProxy(HTTP_PROXY_OPTIONS options)
IIoTCClientSetProxy in interface IIoTCClientoptions - Proxy optionspublic void Disconnect(IoTCCallback callback) throws IoTCentralException
IIoTCClientDisconnect in interface IIoTCClientcallback - Callback executing when device successfully disconnect.IoTCentralException - if disconnection failspublic void Connect()
throws IoTCentralException
IIoTCClientConnect in interface IIoTCClientIoTCentralException - if connection failspublic void SendTelemetry(Object payload, IoTCCallback callback)
IIoTCClientSendTelemetry in interface IIoTCClientpayload - The telemetry object. Can include multiple values in a
flatten object. It can be a map, a POJO or a JSON stringcallback - The callback to execute when message is delivered to the hubpublic void SendState(Object payload, IoTCCallback callback)
IIoTCClientSendState in interface IIoTCClientpayload - The state object. Can include multiple values in a flatten
object. It can be a map, a POJO or a JSON stringcallback - The callback to execute when message is delivered to the hubpublic void SendEvent(Object payload, IoTCCallback callback)
IIoTCClientSendEvent in interface IIoTCClientpayload - The event object. Can include multiple events in a flatten
object. It can be a map, a POJO or a JSON stringcallback - The callback to execute when message is delivered to the hubpublic void SendProperty(Object payload, IoTCCallback callback) throws IoTCentralException
IIoTCClientSendProperty in interface IIoTCClientpayload - The property object. Can include multiple values in a flatten
object. It can be a map, a POJO or a JSON string. If property
is sent in the form {propertyName:{value:"value"}} and
propertyName is the name of a command, then it sends updates
to specific command tile in IoTCentral( e.g. command
progress)callback - The callback to execute when message is delivered to the hubIoTCentralException - if connection is droppedpublic void on(IOTC_EVENTS event, IoTCCallback callback)
IIoTCClienton in interface IIoTCClientevent - The event to listen to.callback - The callback to execute when the event is triggeredCopyright © 2019. All rights reserved.