public interface CommandInterpreter extends VersionableService
COMMAND_TYPE defines the command type(s) this
service is registered to interpret (see Command.getType()).
The specified command type(s) could be custom defined as well as types of the system-defined control unit
commands, i.e. ControlUnitCommand and
ControlUnitInstanceCommand.
To provide control unit commands interpretation, the interpreters must additionally declare the control unit
type(s) and list(s) of control unit actions for which they are capable to execute.
ControlConstants.TYPE
with value of String or String[] specifying the control unit type(s).
CONTROL_UNIT_ACTIONS
with value of String[] or Dictionary with key value pairs: String -> String[].
The value could be given as String[] if there is only one control unit type declared, and thus will
specify list of control unit actions of the given control unit type.
The value could be given as Dictionary with key values specifying control unit types and respective
list of control unit actions for that cu type.
For declared control unit types that there isn't declared list of actions, it is considered that the interpreter is
capable to execute all actions within the control unit type.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
COMMAND_TYPE
The key of the registration property specifying command types, which this service must be registered with.
|
static java.lang.String |
CONTROL_UNIT_ACTIONS
The key of the registration property specifying list of control unit actions in case this interpreter is registered
for control unit commands.
|
static java.lang.String |
serviceVersion
Current service version is 1.0.0;
|
| Modifier and Type | Method and Description |
|---|---|
void |
executeCommand(java.lang.String deviceType,
java.lang.String deviceId,
Command command,
ControlUnitFilter filter,
InterpretationResult result)
Invoked by mPRM operation execution system to execute custom defined command on a device.
|
java.lang.String[] |
getTargetDeviceTypes(java.lang.String commandType)
Returns target device types for which the given command is applicable.
|
void |
init(OperationManagementContext system)
Invoked by the system with the very registration of this interpreter to grant him interface to
operation management system functionality.
|
getServiceVersionstatic final java.lang.String serviceVersion
static final java.lang.String COMMAND_TYPE
static final java.lang.String CONTROL_UNIT_ACTIONS
void init(OperationManagementContext system)
system - OperationManagementContext instance.void executeCommand(java.lang.String deviceType,
java.lang.String deviceId,
Command command,
ControlUnitFilter filter,
InterpretationResult result)
OperationManagementContext.getControlUnits(String, String, String, ControlUnitFilter)
or
OperationManagementContext.match(ControlUnitID, ControlUnitFilter)
methods of the supplied OperationManagementContext.
When action execution is finished, the execution result should be applied in the
InterpretationResult argument. If action execution is not possible at the moment, there should
not be applied error result in the InterpretationResult argument, but the provider may call the
OperationManagementContext.forcePendingCommands(String, String)
method when it is the opportune moment to execute the pending commands on this device. Calling of
forcePendingCommands will make the system to invoke again this method for all not executed commands
for this control unit type in the scope of the given device.
In addition, the invocation result may not be applied in the InterpretationResult argument, but
the provider may obtain an equal InterpretationResylt instance by calling the
OperationManagementContext.createInterpretationResult(String, String, String, String)
if it is not convenient to keep this argument until the underlying execution is finished.deviceType - type of target device over which the command to be executed.deviceId - id of target device over which the command to be executed.command - the command object. The type of object will be the same as
the service registration property with key COMMAND_TYPE.filter - control unit filter.result - implementations can put the result of command executions in this parameterjava.lang.String[] getTargetDeviceTypes(java.lang.String commandType)
commandType - command type.Copyright © 2019 Bosch Software Innovations GmbH. All Rights Reserved.