public class DeviceControlApiImpl extends Object implements DeviceControlApi
Constructor and Description |
---|
DeviceControlApiImpl(PlatformParameters parameters,
RestConnector restConnector,
UrlProcessor urlProcessor,
DeviceControlRepresentation deviceControlRepresentation,
int pageSize) |
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.
|
public DeviceControlApiImpl(PlatformParameters parameters, RestConnector restConnector, UrlProcessor urlProcessor, DeviceControlRepresentation deviceControlRepresentation, int pageSize)
public OperationRepresentation getOperation(com.cumulocity.model.idtype.GId gid) throws SDKException
DeviceControlApi
getOperation
in interface DeviceControlApi
gid
- id of the operation to search forSDKException
- if the operation is not found or if the query failedpublic OperationCollection getOperations() throws SDKException
DeviceControlApi
getOperations
in interface DeviceControlApi
SDKException
- if the query failedpublic OperationRepresentation create(OperationRepresentation operation) throws SDKException
DeviceControlApi
create
in interface DeviceControlApi
operation
- operation to be createdSDKException
- if the operation could not be createdpublic OperationRepresentation update(OperationRepresentation operation) throws SDKException
DeviceControlApi
update
in interface DeviceControlApi
operation
- to be updatedSDKException
- if the operation could not be updatedpublic Future updateAsync(OperationRepresentation operation) throws SDKException
DeviceControlApi
updateAsync
in interface DeviceControlApi
operation
- to be updatedSDKException
- if the operation could not be updatedpublic OperationCollection getOperationsByFilter(OperationFilter filter) throws SDKException
DeviceControlApi
status
, deviceId
, agentId
]
and [deviceId
, agentId
] are not supported.
currently not supported.getOperationsByFilter
in interface DeviceControlApi
filter
- the filter criteria(s)SDKException
- if the query failedpublic Subscriber<com.cumulocity.model.idtype.GId,OperationRepresentation> getNotificationsSubscriber() throws SDKException
DeviceControlApi
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
}
});
getNotificationsSubscriber
in interface DeviceControlApi
SDKException
- when subscriber creation failCopyright © 2020 (C) Cumulocity GmbH. All rights reserved.