Package com.zebra.sdk.printer
Class PrinterStatusMessages
Object
com.zebra.sdk.printer.PrinterStatusMessages
This class is used to acquire a human readable string of the current errors/warnings stored in a
PrinterStatus instance.
package test.zebra.sdk.printer.examples;
import com.zebra.sdk.comm.Connection;
import com.zebra.sdk.comm.ConnectionException;
import com.zebra.sdk.comm.TcpConnection;
import com.zebra.sdk.printer.PrinterStatus;
import com.zebra.sdk.printer.PrinterStatusMessages;
import com.zebra.sdk.printer.ZebraPrinter;
import com.zebra.sdk.printer.ZebraPrinterFactory;
import com.zebra.sdk.printer.ZebraPrinterLanguageUnknownException;
public class PrinterStatusMessagesExample {
public static void main(String[] args) throws Exception {
Connection connection = new TcpConnection("192.168.1.100", TcpConnection.DEFAULT_ZPL_TCP_PORT);
try {
connection.open();
ZebraPrinter printer = ZebraPrinterFactory.getInstance(connection);
PrinterStatus printerStatus = printer.getCurrentStatus();
if (printerStatus.isReadyToPrint) {
System.out.println("Ready To Print");
} else {
PrinterStatusMessages statusMessage = new PrinterStatusMessages(printerStatus);
String[] statusMessages = statusMessage.getStatusMessage();
String joinedStatusMessage = "";
for (int i = 0; i < statusMessages.length; i++) {
joinedStatusMessage += statusMessages[i] + ";";
}
System.out.println("Cannot Print: " + joinedStatusMessage);
}
} catch (ConnectionException e) {
e.printStackTrace();
} catch (ZebraPrinterLanguageUnknownException e) {
e.printStackTrace();
} finally {
connection.close();
}
}
}
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringMessage to indicate the head is openstatic final StringMessage to indicate the head is too hotstatic final StringMessage to indicateprinterStatusis nullstatic final StringMessage to indicate the paper is outstatic final StringMessage to indicate printer is pausedstatic final StringMessage to indicate the receive buffer is fullstatic final StringMessage to indicate the ribbon is out -
Constructor Summary
ConstructorsConstructorDescriptionPrinterStatusMessages(PrinterStatus printerStatus) Used to acquire a human readable string of the current errors/warnings stored inprinterStatus -
Method Summary
Modifier and TypeMethodDescriptionString[]Used to acquire a human readable string of the current errors/warnings passed to this instance
-
Field Details
-
HEAD_OPEN_MSG
Message to indicate the head is open- See Also:
-
HEAD_TOO_HOT_MSG
Message to indicate the head is too hot- See Also:
-
PAPER_OUT_MSG
Message to indicate the paper is out- See Also:
-
RIBBON_OUT_MSG
Message to indicate the ribbon is out- See Also:
-
RECEIVE_BUFFER_FULL_MSG
Message to indicate the receive buffer is full- See Also:
-
PAUSE_MSG
Message to indicate printer is paused- See Also:
-
NULL_MSG
Message to indicateprinterStatusis null- See Also:
-
-
Constructor Details
-
PrinterStatusMessages
Used to acquire a human readable string of the current errors/warnings stored inprinterStatus- Parameters:
printerStatus- an instance ofPrinterStatusthat will be used to acquire the human readable string of warnings/errors stored inprinterStatus
-
-
Method Details
-
getStatusMessage
Used to acquire a human readable string of the current errors/warnings passed to this instance- Returns:
- a human readable string array of the current errors/warnings passed to this instance
-