public interface IotDevice extends TopologyElement
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CMD_FORMAT
Command format key.
|
static java.lang.String |
CMD_ID
Command identifier key.
|
static java.lang.String |
CMD_PAYLOAD
Command payload key.
|
static java.lang.String |
CMD_TS
Command timestamp (in milliseconds) key.
|
static java.lang.String |
RESERVED_ID_PREFIX
Device event and command identifiers starting with "edgent" are reserved for use by Edgent.
|
Modifier and Type | Method and Description |
---|---|
TStream<com.google.gson.JsonObject> |
commands(java.lang.String... commands)
Create a stream of device commands as JSON objects.
|
TSink<com.google.gson.JsonObject> |
events(TStream<com.google.gson.JsonObject> stream,
Function<com.google.gson.JsonObject,java.lang.String> eventId,
UnaryOperator<com.google.gson.JsonObject> payload,
Function<com.google.gson.JsonObject,java.lang.Integer> qos)
Publish a stream's tuples as device events.
|
TSink<com.google.gson.JsonObject> |
events(TStream<com.google.gson.JsonObject> stream,
java.lang.String eventId,
int qos)
Publish a stream's tuples as device events.
|
topology
static final java.lang.String RESERVED_ID_PREFIX
static final java.lang.String CMD_ID
commands(String...)
,
Constant Field Valuesstatic final java.lang.String CMD_TS
commands(String...)
,
Constant Field Valuesstatic final java.lang.String CMD_FORMAT
commands(String...)
,
Constant Field Valuesstatic final java.lang.String CMD_PAYLOAD
json
then
the key's value will be a JsonObject
,
otherwise a String
.
Key is "payload".commands(String...)
,
Constant Field ValuesTSink<com.google.gson.JsonObject> events(TStream<com.google.gson.JsonObject> stream, Function<com.google.gson.JsonObject,java.lang.String> eventId, UnaryOperator<com.google.gson.JsonObject> payload, Function<com.google.gson.JsonObject,java.lang.Integer> qos)
Each tuple is published as a device event with the supplied functions providing the event identifier, payload and QoS. The event identifier and QoS can be generated based upon the tuple.
stream
- Stream to be published.eventId
- function to supply the event identifier.payload
- function to supply the event's payload.qos
- function to supply the event's delivery Quality of Service.TSink<com.google.gson.JsonObject> events(TStream<com.google.gson.JsonObject> stream, java.lang.String eventId, int qos)
Each tuple is published as a device event with fixed event identifier and QoS.
stream
- Stream to be published.eventId
- Event identifier.qos
- Event's delivery Quality of Service.TStream<com.google.gson.JsonObject> commands(java.lang.String... commands)
commands
will result in a tuple
on the stream. The JSON object has these keys:
commands
- Command identifiers to include. If no command identifiers are provided then the
stream will contain all device commands.Copyright © 2016 The Apache Software Foundation. All Rights Reserved - bbe71fa-20161201-1641