ZSDK_API
1.5.1049
|
A class used to obtain the status of a Zebra printer. More...
#import <PrinterStatus.h>
Instance Methods | |
(id) | - init |
Initializes a new instance of the PrinterStatus class that can be used to determine the status of a printer. | |
Properties | |
BOOL | isReadyToPrint |
YES if the printer reports back that it is ready to print. | |
BOOL | isHeadOpen |
YES if the head is open. | |
BOOL | isHeadCold |
YES if the head is cold. | |
BOOL | isHeadTooHot |
YES if the head is too hot. | |
BOOL | isPaperOut |
YES if the paper is out. | |
BOOL | isRibbonOut |
YES if the ribbon is out. | |
BOOL | isReceiveBufferFull |
YES if the receive buffer is full. | |
BOOL | isPaused |
YES if the printer is paused. | |
NSInteger | labelLengthInDots |
The length of the label in dots. | |
NSInteger | numberOfFormatsInReceiveBuffer |
The number of formats currently in the receive buffer of the printer. | |
NSInteger | labelsRemainingInBatch |
The number of labels remaining in the batch. | |
BOOL | isPartialFormatInProgress |
YES if there is a partial format in progress. | |
ZplPrintMode | printMode |
The print mode. | |
A class used to obtain the status of a Zebra printer.
Get the current status of a printer. @code
#import "TcpPrinterConnection.h" #import "ZebraPrinterFactory.h" #import "ZebraPrinter.h" #import "PrinterStatus.h" #import <UIKit/UIKit.h>
TcpPrinterConnection *zebraPrinterConnection = [[TcpPrinterConnection alloc] initWithAddress:"192.168.1.100" andWithPort:9100]; BOOL success = [zebraPrinterConnection open]; NSError *error = nil; id<ZebraPrinter, NSObject> printer = [ZebraPrinterFactory getInstance:zebraPrinterConnection error:&error];
PrinterStatus *printerStatus = [printer getCurrentStatus:&error]; if (printerStatus.isReadyToPrint) { NSLog("Ready To Print"); } else if (printerStatus.isPaused) { NSLog("Cannot Print because the printer is paused."); } else if (printerStatus.isHeadOpen) { NSLog("Cannot Print because the printer head is open."); } else if (printerStatus.isPaperOut) { NSLog("Cannot Print because the paper is out."); } else { NSLog("Cannot Print."); }
if (error != nil || printer == nil || success == NO) { UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:"Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [errorAlert show]; [errorAlert release]; }
- (id) init |
Initializes a new instance of the PrinterStatus class that can be used to determine the status of a printer.
Note: this will only query the printer's status upon creation. If the status needs to be updated see:
getCurrentStatus: (ZebraPrinter-p)
|
readwriteatomicassign |
YES
if the head is cold.
For CPCL printers this is always NO
.
|
readwriteatomicassign |
YES
if the head is too hot.
For CPCL printers this is always NO
.
|
readwriteatomicassign |
YES
if there is a partial format in progress.
For CPCL printers this is always NO
.
|
readwriteatomicassign |
YES
if the printer is paused.
For CPCL printers this is always NO
.
|
readwriteatomicassign |
YES
if the receive buffer is full.
For CPCL printers this is always NO
.
|
readwriteatomicassign |
The length of the label in dots.
For CPCL printers this is always 0.
|
readwriteatomicassign |
The number of labels remaining in the batch.
For CPCL printers this is always 0.
|
readwriteatomicassign |
The number of formats currently in the receive buffer of the printer.
For CPCL printers this is always 0.
|
readwriteatomicassign |
The print mode.
For CPCL printers this is always ZPL_PRINT_MODE_UNKNOWN