org.bidib.wizard.api.model.function.MacroFunction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bidibwizard-api Show documentation
Show all versions of bidibwizard-api Show documentation
jBiDiB BiDiB Wizard API POM
package org.bidib.wizard.api.model.function;
import org.bidib.jbidibc.exchange.lcmacro.LcMacroPointType;
import org.bidib.jbidibc.exchange.lcmacro.MacroActionPoint;
import org.bidib.jbidibc.exchange.lcmacro.MacroActionType;
import org.bidib.jbidibc.exchange.lcmacro.MacroOperationType;
import org.bidib.wizard.model.status.MacroStatus;
public class MacroFunction extends SystemFunction {
private int macroId;
public MacroFunction() {
this(MacroStatus.START);
}
public MacroFunction(MacroStatus action) {
this(action, 0);
}
public MacroFunction(MacroStatus action, int macroId) {
super(action, KEY_MACRO);
this.macroId = macroId;
}
public int getMacroId() {
return macroId;
}
public void setMacroId(int macroId) {
this.macroId = macroId;
}
public String getDebugString() {
return getAction().name().substring(0, 1) + getAction().name().substring(1).toLowerCase() + "Macro " + macroId;
}
@Override
public LcMacroPointType toLcMacroPoint() {
MacroActionPoint macroActionPoint = new MacroActionPoint();
MacroActionType macroActionType = new MacroActionType();
macroActionType.setMacroNumber(getMacroId());
macroActionType.setOperation(MacroOperationType.fromValue(getAction().name()));
macroActionPoint.setMacroActionType(macroActionType);
return macroActionPoint;
}
}