public interface DeviceControlApi
Modifier and Type | Method and Description |
---|---|
OperationRepresentation |
create(OperationRepresentation operation)
Creates operation in the platform.
|
Subscriber<com.cumulocity.model.idtype.GId,OperationRepresentation> |
getNotificationsSubscriber()
Gets the notifications subscriber, which allows to receive newly created operations for agent.
|
OperationRepresentation |
getOperation(com.cumulocity.model.idtype.GId gid)
Gets operation by id
|
OperationCollection |
getOperations()
Gets the all the operation in the platform
|
OperationCollection |
getOperationsByFilter(OperationFilter filter)
Gets the operations from the platform based on specified filter.
|
OperationRepresentation |
update(OperationRepresentation operation)
Updates operation in the platform.
|
Future |
updateAsync(OperationRepresentation operation)
Updates operation in the platform.
|
OperationRepresentation getOperation(com.cumulocity.model.idtype.GId gid) throws SDKException
gid
- id of the operation to search forSDKException
- if the operation is not found or if the query failedOperationRepresentation create(OperationRepresentation operation) throws SDKException
operation
- operation to be createdSDKException
- if the operation could not be createdOperationRepresentation update(OperationRepresentation operation) throws SDKException
operation
- to be updatedSDKException
- if the operation could not be updatedFuture updateAsync(OperationRepresentation operation) throws SDKException
operation
- to be updatedSDKException
- if the operation could not be updatedOperationCollection getOperations() throws SDKException
SDKException
- if the query failedOperationCollection getOperationsByFilter(OperationFilter filter) throws SDKException
status
, deviceId
, agentId
]
and [deviceId
, agentId
] are not supported.
currently not supported.filter
- the filter criteria(s)SDKException
- if the query failedIllegalArgumentException
- in case of queries based on [status
, deviceId
, agentId
] or [deviceId
, agentId
]Subscriber<com.cumulocity.model.idtype.GId,OperationRepresentation> getNotificationsSubscriber() throws SDKException
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
}
});
SDKException
- when subscriber creation failCopyright © 2020 (C) Cumulocity GmbH. All rights reserved.