public interface Device
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
attribute(java.lang.String attributePath)
Return the attribute object with the given attribute path or null if not found.
|
java.util.List<Attribute> |
attributes()
Return all device attributes.
|
void |
deleteAttribute(java.lang.String attributePath)
Deletes the attribute with the specified attribute path.
|
void |
deleteAttributes()
Deletes the entity's attributes.
|
java.lang.String |
deviceId()
Return device identifier as string <namespace>:<id>
|
void |
exec(java.lang.String featureId,
java.lang.String operationId,
java.lang.Object args,
AsyncResult result)
Used to build asynchronous programming through Continuation Passing Style.
|
Feature |
feature(java.lang.String featureId)
Return a feature with a given id or null.
|
java.util.List<Feature> |
features()
Return device features.
|
java.util.List<Feature> |
features(DefinitionFilter filter)
Return all the features that satisfy a given filter or null if not found.
|
java.util.List<Feature> |
features(java.lang.String namespace,
java.lang.String name)
Return all the features with a given namespace and feature name.
|
java.util.List<Feature> |
features(java.lang.String namespace,
java.lang.String name,
java.lang.String version)
Return all the features with a given namespace, feature name and version.
|
java.lang.String |
gatewayId()
Return gateway id.
|
Identifier |
identifier()
Return device identifier
|
void |
message(java.lang.String subject,
java.lang.String payload)
Send opaque message.
|
void |
message(java.lang.String featureId,
java.lang.String subject,
java.lang.String payload)
Send opaque message.
|
void |
request(java.lang.String subject,
java.lang.String payload,
AsyncResult result)
Send opaque message with response
|
void |
request(java.lang.String featureId,
java.lang.String subject,
java.lang.String payload,
AsyncResult result)
Send opaque message with response
|
<T> void |
setAttribute(Attribute<T> attribute)
Sets the device's attribute to the specified value.
|
void |
setAttributes(java.util.List<Attribute<?>> attributes)
Replace all the device's attributes to the specified value.
|
<T> void |
upsertAttribute(Attribute<T> attribute)
Deprecated.
preferable way is to use
setAttribute(Attribute) |
void |
upsertAttributes(java.util.List<Attribute<?>> attributes)
Deprecated.
preferable way is to use
setAttributes(List) |
Identifier identifier()
java.lang.String deviceId()
java.lang.String gatewayId()
java.util.List<Attribute> attributes()
java.lang.Object attribute(java.lang.String attributePath)
attributePath
- the searched attribute with a given path.<T> void upsertAttribute(Attribute<T> attribute)
setAttribute(Attribute)
attribute
- attribute to be added or updated<T> void setAttribute(Attribute<T> attribute)
attribute
- attribute to be added or updated@Deprecated void upsertAttributes(java.util.List<Attribute<?>> attributes)
setAttributes(List)
attributes
- attributes to be added or updatedvoid setAttributes(java.util.List<Attribute<?>> attributes)
attributes
- attributes to be setvoid deleteAttribute(java.lang.String attributePath)
attributePath
- the path of the attribute to deletevoid deleteAttributes()
java.util.List<Feature> features()
java.util.List<Feature> features(DefinitionFilter filter)
filter
- should not be null.java.util.List<Feature> features(java.lang.String namespace, java.lang.String name)
namespace
- feature namespace.name
- feature name.java.util.List<Feature> features(java.lang.String namespace, java.lang.String name, java.lang.String version)
namespace
- feature namespace.name
- feature name.version
- feature version.features(DefinitionFilter)
Feature feature(java.lang.String featureId)
featureId
- feature id.void exec(java.lang.String featureId, java.lang.String operationId, java.lang.Object args, AsyncResult result)
featureId
- feature id.operationId
- operation id.args
- needed operation parameters.result
- This parameter is about to be skipped in groovy scripts, it only indicates
the method is asynchronous. As for every asynchronous method, the script writers
can optionally pass a groovy.lang.Closure
as last argument that could
consume the asynchronous method result or simply be run after the asynchronous completion.
Closure postAction = {result, error -> ...}
void message(java.lang.String subject, java.lang.String payload)
subject
- message subjectpayload
- payloadvoid message(java.lang.String featureId, java.lang.String subject, java.lang.String payload)
featureId
- feature idsubject
- message subjectpayload
- payloadvoid request(java.lang.String subject, java.lang.String payload, AsyncResult result)
subject
- message subjectpayload
- payloadresult
- This parameter is about to be skipped in groovy scripts, it only indicates
the method is asynchronous. As for every asynchronous method, the script writers
can optionally pass a groovy.lang.Closure
as last argument that could
consume the asynchronous method result or simply be run after the asynchronous completion.
Closure postAction = {result, error -> ...}
void request(java.lang.String featureId, java.lang.String subject, java.lang.String payload, AsyncResult result)
featureId
- feature idsubject
- message subjectpayload
- payloadresult
- This parameter is about to be skipped in groovy scripts, it only indicates
the method is asynchronous. As for every asynchronous method, the script writers
can optionally pass a groovy.lang.Closure
as last argument that could
consume the asynchronous method result or simply be run after the asynchronous completion.
Closure postAction = {result, error -> ...}