Interface DeviceControlApi
- All Known Implementing Classes:
DeviceControlApiImpl
public interface DeviceControlApi
API for creating, updating and retrieving operations from the platform.
-
Method Summary
Modifier and TypeMethodDescriptioncreate
(OperationRepresentation operation) Creates operation in the platform.Gets the notifications subscriber, which allows to receive newly created operations for agent.getOperation
(GId gid) Gets operation by idGets the all the operation in the platformgetOperationsByFilter
(OperationFilter filter) Gets the operations from the platform based on specified filter.update
(OperationRepresentation operation) Updates operation in the platform.updateAsync
(OperationRepresentation operation) Updates operation in the platform.
-
Method Details
-
getOperation
Gets operation by id- Parameters:
gid
- id of the operation to search for- Returns:
- the operation with the given id
- Throws:
SDKException
- if the operation is not found or if the query failed
-
create
Creates operation in the platform. The id of the operation must not be set, since it will be generated by the platform- Parameters:
operation
- operation to be created- Returns:
- the created operation with the generated id
- Throws:
SDKException
- if the operation could not be created
-
update
Updates operation in the platform. The operation to be updated is identified by the id within the given operation.- Parameters:
operation
- to be updated- Returns:
- the updated operation
- Throws:
SDKException
- if the operation could not be updated
-
updateAsync
Updates operation in the platform. Immediate response is available through the Future object. In case of lost connection, buffers data in persistence provider.- Parameters:
operation
- to be updated- Returns:
- the updated operation
- Throws:
SDKException
- if the operation could not be updated
-
getOperations
Gets the all the operation in the platform- Returns:
- collection of operations with paging functionality
- Throws:
SDKException
- if the query failed
-
getOperationsByFilter
Gets the operations from the platform based on specified filter. Queries based on [status
,deviceId
,agentId
] and [deviceId
,agentId
] are not supported. currently not supported.- Parameters:
filter
- the filter criteria(s)- Returns:
- collection of operations matched by the filter with paging functionality
- Throws:
SDKException
- if the query failedIllegalArgumentException
- in case of queries based on [status
,deviceId
,agentId
] or [deviceId
,agentId
]
-
getNotificationsSubscriber
Gets the notifications subscriber, which allows to receive newly created operations for agent.Example: final GId agentId = ... Subscriber<GId, OperationRepresentation> subscriber = deviceControlApi.getNotificationsSubscriber(); subscriber.subscribe( agentId , new SubscriptionListener<GId, OperationRepresentation>() { @Override public void onNotification(Subscription<GId> subscription, OperationRepresentation operation) { //process operation } @Override public void onError(Subscription<GId> subscription, Throwable ex) { // handle subscribe operation error } });
- Returns:
- subscriber
- Throws:
SDKException
- when subscriber creation fail
-