All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bidib.wizard.api.model.function.MacroFunction Maven / Gradle / Ivy

There is a newer version: 2.0.25
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy