Interface IStreamingControlInterface
- All Superinterfaces:
IEventProducer
- All Known Subinterfaces:
IStreamingControlInterfaceWithResult
Interface for all taskable components using SWE Common model to describe structure and encoding of commands they accept (e.g. actuators, processes...)
It is the responsibility of the implementation to report task status when commands are processed asynchronously. In particular, special care must be taken to avoid missing status updates in case of disconnections from the actual taskable system.- Since:
- Mar 23, 2017
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault CompletableFuture<Void>
cancelCommand
(BigId cmdID) Cancels an existing command/task.Retrieves description of command message Note that this can be a choice of multiple messagesdefault DataEncoding
getName()
Gets the interface name.Allows by-reference access to parent moduleboolean
Checks if this interface is enabledsubmitCommand
(ICommandData command) Submit the provided command to the receiving system.default CompletableFuture<Void>
updateCommand
(ICommandData command) Update an existing command/task.void
validateCommand
(ICommandData command) Validates the command parameters synchronously.Methods inherited from interface org.sensorhub.api.event.IEventProducer
registerListener, unregisterListener
-
Field Details
-
ERROR_NO_UPDATE
- See Also:
-
ERROR_NO_CANCEL
- See Also:
-
-
Method Details
-
getParentProducer
ICommandReceiver getParentProducer()Allows by-reference access to parent module- Returns:
- parent module instance
-
getName
String getName()Gets the interface name.- Returns:
- name of this control interface
-
isEnabled
boolean isEnabled()Checks if this interface is enabled- Returns:
- true if interface is enabled, false otherwise
-
getCommandDescription
DataComponent getCommandDescription()Retrieves description of command message Note that this can be a choice of multiple messages- Returns:
- Data component containing message structure
-
getCommandEncoding
- Returns:
- The recommended encoding for the command parameters
-
validateCommand
Validates the command parameters synchronously. This is called before the command is submitted for execution (it is used to avoid persisting invalid commands on the sensor hub).- Parameters:
command
-- Throws:
CommandException
- if the command is invalid
-
submitCommand
Submit the provided command to the receiving system.If a command is executed or rejected immediately, the status report returned by the future will have a final status code such as
COMPLETED
,REJECTED
, orFAILED
, and no further status reports are to be expected from the event channel.If a command is scheduled to be executed later or takes longer to execute, the initial status report returned by the future will have a non-final status code and must include a task ID. Subsequent reports are then sent via the dedicated event channel, using the same task ID, to provide status updates to the caller.
The future should only complete exceptionally if there is an unexpected error. All errors associated to the processing of the command by the receiver system should be reported via a status object instead.
- Parameters:
command
- Command data (with ID set)- Returns:
- A future that will be completed normally when the system is ready to receive the next command. Note that the command may not be fully executed or may not even be accepted at this point. In all cases, a valid status object must be returned by the future.
-
updateCommand
Update an existing command/task.- Parameters:
command
- New command (with ID set)- Returns:
- A future that will complete normally if the update is accepted or exceptionally if the update is rejected early.
-
cancelCommand
Cancels an existing command/task.- Parameters:
cmdID
- The ID of the command to be canceled (as provided in the initial command submit)- Returns:
- A future that will complete normally if the cancellation is accepted or exceptionally if the task cannot be canceled.
-