Search in sources :

Example 1 with ActionArgumentValue

use of org.teleal.cling.model.action.ActionArgumentValue in project openhab1-addons by openhab.

the class SonosZonePlayer method executeActionInvocation.

protected void executeActionInvocation(ActionInvocation invocation) {
    if (invocation != null) {
        new ActionCallback.Default(invocation, upnpService.getControlPoint()).run();
        ActionException anException = invocation.getFailure();
        if (anException != null && anException.getMessage() != null) {
            logger.warn(anException.getMessage());
        }
        Map<String, ActionArgumentValue> result = invocation.getOutputMap();
        Map<String, StateVariableValue> mapToProcess = new HashMap<String, StateVariableValue>();
        if (result != null) {
            // only process the variables that have changed value
            for (String variable : result.keySet()) {
                ActionArgumentValue newArgument = result.get(variable);
                StateVariable newVariable = new StateVariable(variable, new StateVariableTypeDetails(newArgument.getDatatype()));
                StateVariableValue newValue = new StateVariableValue(newVariable, newArgument.getValue());
                if (isUpdatedValue(variable, newValue)) {
                    mapToProcess.put(variable, newValue);
                }
            }
            stateMap.putAll(mapToProcess);
            sonosBinding.processVariableMap(device, mapToProcess);
        }
    }
}
Also used : StateVariableValue(org.teleal.cling.model.state.StateVariableValue) ActionCallback(org.teleal.cling.controlpoint.ActionCallback) HashMap(java.util.HashMap) StateVariable(org.teleal.cling.model.meta.StateVariable) StateVariableTypeDetails(org.teleal.cling.model.meta.StateVariableTypeDetails) ActionException(org.teleal.cling.model.action.ActionException) ActionArgumentValue(org.teleal.cling.model.action.ActionArgumentValue)

Aggregations

HashMap (java.util.HashMap)1 ActionCallback (org.teleal.cling.controlpoint.ActionCallback)1 ActionArgumentValue (org.teleal.cling.model.action.ActionArgumentValue)1 ActionException (org.teleal.cling.model.action.ActionException)1 StateVariable (org.teleal.cling.model.meta.StateVariable)1 StateVariableTypeDetails (org.teleal.cling.model.meta.StateVariableTypeDetails)1 StateVariableValue (org.teleal.cling.model.state.StateVariableValue)1