package com.northglass.service.machine;
|
|
import com.northglass.constants.StateConstants.ConnectState;
|
import com.northglass.constants.StateConstants.MachineState;
|
import com.northglass.entity.Machine;
|
|
public abstract class MachineService {
|
|
public static String getConnectStateHtml(String state) {
|
StringBuffer html = new StringBuffer();
|
|
if (ConnectState.NO_CONNECT.equals(state)) {
|
html.append("<span class='label'>").append(state).append("</span>");
|
}
|
else if (ConnectState.CONNECTING.equals(state)) {
|
html.append("<span class='label label-warning'>").append(state).append("</span>");
|
}
|
else if (ConnectState.CONNECTED.equals(state)) {
|
html.append("<span class='label label-success'>").append(state).append("</span>");
|
}
|
|
return html.toString();
|
}
|
|
public static String getMachineStateHtml(String state) {
|
StringBuffer html = new StringBuffer();
|
|
if (MachineState.IN_WORK.equals(state)) {
|
html.append("<span class='label label-success'>").append(state).append("</span>");
|
}
|
else if (MachineState.STOPPED.equals(state)) {
|
html.append("<span class='label'>").append(state).append("</span>");
|
}
|
else if (MachineState.WARNING.equals(state)) {
|
html.append("<span class='label label-warning'>").append(state).append("</span>");
|
}
|
else if (MachineState.SERIOUS_WARNING.equals(state)) {
|
html.append("<span class='label label-important'>").append(state).append("</span>");
|
}
|
|
return html.toString();
|
}
|
|
public abstract void setConnectState(Machine machine, String connectState);
|
|
public abstract void resetState();
|
|
public abstract void connect();
|
|
public abstract String generateReturnMessage(String sendMessageHex, Machine machine);
|
}
|