}
}
+ public String toString() {
+ StringBuffer result = new StringBuffer();
+ for (int i = 0; i < commandBytes.length; i++) {
+ result.append(Integer.toHexString(commandBytes[i] & 0xFF));
+ if (i < commandBytes.length - 1);
+ result.append(", ");
+ }
+ return result.toString();
+ }
+
public byte[] getCommandBytes() {
if (commandBytes == null)
throw new RuntimeException("No Command configured yet.");
}
protected void apply() {
- LogMediator.getInstance().log("Sende " + command.getText());
- answers.append(++commandCounter + ": " + command.getText() + "\n");
+ Command cmd;
+ String commandText = command.getText();
+ try {
+ cmd = new Command(commandText);
+ } catch (RuntimeException e) {
+ LogMediator.getInstance().log("Kann \"" + commandText + "\" nicht in Command wandeln.");
+ return;
+ }
+ LogMediator.getInstance().log("Sende " + cmd);
+ answers.append(++commandCounter + ": " + cmd + "\n");
command.setText("");
}
public void setHostConfig(HostConfig hostConfig);
public HostConfig getHostConfig();
+
+ public byte[] sendCommand(Command command);
}
\ No newline at end of file
return hostConfig;
}
+ public byte[] sendCommand(Command command) {
+ LogMediator.getInstance().log("Send Command: " + command.toString());
+ return command.getCommandBytes();
+ }
+
}