public interface DeviceInventory
Modifier and Type | Method and Description |
---|---|
Device |
device(java.lang.String deviceId)
The device with a given id.
|
java.util.Iterator<Device> |
devices(Selector selector)
An iterator over all devices that satisfy the applied selector.
|
java.util.List<Device> |
devices(java.lang.String gatewayId,
Selector selector)
All devices which have the same gateway identifier and satisfy the applied selector.
|
int |
devicesCount(Selector selector)
Count the devices that satisfy the applied selector.
|
int |
devicesCount(java.lang.String gatewayId,
Selector selector)
Count the devices connected to a gateway which has a given id, which satisfy the applied selector.
|
void |
exec(java.lang.String deviceId,
java.lang.String featureId,
java.lang.String operationId,
java.lang.Object args,
AsyncResult result)
Used to build asynchronous programming through Continuation Passing Style.
|
Gateway |
gateway(java.lang.String gatewayId)
A gateway with a given id or null if not found.
|
java.util.Iterator<Gateway> |
gateways(Selector selector)
An iterator over all gateways that satisfy an applied selector.
|
int |
gatewaysCount(Selector selector)
Count the gateways that satisfy the applied selector.
|
boolean |
match(java.lang.String deviceId,
java.lang.String filter)
Check if the device identified by the given id matches the applied filter.
|
void |
message(java.lang.String deviceId,
java.lang.String subject,
java.lang.String payload)
Send opaque message.
|
void |
message(java.lang.String deviceId,
java.lang.String featureId,
java.lang.String subject,
java.lang.String payload)
Send opaque message.
|
void |
request(java.lang.String deviceId,
java.lang.String subject,
java.lang.String payload,
AsyncResult result)
Send opaque message with response
|
void |
request(java.lang.String deviceId,
java.lang.String featureId,
java.lang.String subject,
java.lang.String payload,
AsyncResult result)
Send opaque message with response
|
java.util.Iterator<Gateway> gateways(Selector selector)
selector
- a gateway selector.Gateway gateway(java.lang.String gatewayId)
gatewayId
- a gateway id.int gatewaysCount(Selector selector)
selector
- a selector.java.util.Iterator<Device> devices(Selector selector)
selector
- a device selector.java.util.List<Device> devices(java.lang.String gatewayId, Selector selector)
gatewayId
- a gateway identifier.selector
- a gateway selector.ScriptExecutionException
if an error occurs.Device device(java.lang.String deviceId)
deviceId
- a device identifier.ScriptExecutionException
if nothing was found.int devicesCount(Selector selector)
selector
- a selector.int devicesCount(java.lang.String gatewayId, Selector selector)
gatewayId
- a gateway identifier.selector
- a selector.ScriptExecutionException
if nothing was
found.boolean match(java.lang.String deviceId, java.lang.String filter)
deviceId
- the identifier of the device.filter
- the filter against which the device will be matched.void exec(java.lang.String deviceId, java.lang.String featureId, java.lang.String operationId, java.lang.Object args, AsyncResult result)
deviceId
- device idfeatureId
- feature idoperationId
- operation idargs
- arguments of the operationresult
- 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 deviceId, java.lang.String subject, java.lang.String payload)
deviceId
- deviceId idsubject
- message subjectpayload
- payloadvoid message(java.lang.String deviceId, java.lang.String featureId, java.lang.String subject, java.lang.String payload)
deviceId
- deviceId idfeatureId
- feature idsubject
- message subjectpayload
- payloadvoid request(java.lang.String deviceId, java.lang.String subject, java.lang.String payload, AsyncResult result)
deviceId
- deviceId 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 -> ...}
void request(java.lang.String deviceId, java.lang.String featureId, java.lang.String subject, java.lang.String payload, AsyncResult result)
deviceId
- deviceId idfeatureId
- 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 -> ...}