package org.hwo.pulscounter.ui; import org.hwo.pulscounter.ExportSetting; import org.hwo.pulscounter.PulsCounterApplication; import org.hwo.pulscounter.PulsCounterApplicationListener; import org.hwo.servicelink.exceptions.*; import static org.hwo.logging.Logging.*; import static org.hwo.logging.LogLevel.*; public class BatchRunner implements PulsCounterApplicationListener{ private PulsCounterApplication pulsCounterApplication; public BatchRunner(PulsCounterApplication pulsCounterApplication){ this.pulsCounterApplication = pulsCounterApplication; pulsCounterApplication.addPulsCounterApplicationListener(this); try { run(); } catch (Exception e){ log(e); } pulsCounterApplication.notifyUiIsFinished(true); } public void run(){ pulsCounterApplication.getInterfaces().get(0).checkRealTimeClock(); for (String cmd: pulsCounterApplication.getBatchCommands()){ String[] tokens = cmd.split(":"); switch (tokens[0]){ case "output": String[] s = tokens[1].split("="); int outputno = Integer.decode(s[0]); int state = Integer.decode(s[1]); int outputs = pulsCounterApplication.getInterfaces().get(0).getOutputs(); if (state != 0){ outputs |= (1<