ZSDK_API
1.4.957
|
This class is used to acquire a human readable string of the current errors/warnings stored in a PrinterStatus
instance.
More...
#import <PrinterStatusMessages.h>
Instance Methods | |
(id) | - initWithPrinterStatus: |
Used to acquire a human readable string of the current errors/warnings stored in aPrinterStatus | |
(NSArray *) | - getStatusMessage |
Used to acquire a human readable string of the current errors/warnings passed to this instance. | |
Class Methods | |
(NSString *) | + HEAD_OPEN_MSG |
Message to indicate the head is open. | |
(NSString *) | + HEAD_TOO_HOT_MSG |
Message to indicate the head is too hot. | |
(NSString *) | + PAPER_OUT_MSG |
Message to indicate the paper is out. | |
(NSString *) | + RIBBON_OUT_MSG |
Message to indicate the ribbon is out. | |
(NSString *) | + RECEIVE_BUFFER_FULL_MSG |
Message to indicate the receive buffer is full. | |
(NSString *) | + PAUSE_MSG |
Message to indicate printer is paused. | |
This class is used to acquire a human readable string of the current errors/warnings stored in a PrinterStatus
instance.
Get a string array of the current errors and warnings. @code
#import "TcpPrinterConnection.h" #import "ZebraPrinter.h" #import "ZebraPrinterFactory.h" #import "PrinterStatusMessages.h" #import <UIKit/UIKit.h>
TcpPrinterConnection *zebraPrinterConnection = [[TcpPrinterConnection alloc] initWithAddress:"192.168.1.100" andWithPort:6101]; BOOL success = [zebraPrinterConnection open]; NSError *error = nil; id<ZebraPrinter,NSObject> printer = [ZebraPrinterFactory getInstance:zebraPrinterConnection error:&error];
PrinterStatus printerStatus = [printer getCurrentStatus:&error]; NSString status = nil;
if (printerStatus.isReadyToPrint) { status = "Ready To Print"; } else { PrinterStatusMessages *statusMessage = [[PrinterStatusMessages alloc]initWithPrinterStatus:printerStatus]; NSArray *statusMessages = [statusMessage getStatusMessage]; NSMutableString *joinedStatusMessage = [[NSMutableString alloc] initWithFormat:""]; for (NSUInteger i = 0; i < [statusMessages count]; i++) { [joinedStatusMessage appendFormat:"%@;", [statusMessages objectAtIndex:i]]; } status = [[NSString alloc] initWithFormat:"Cannot Print: %", joinedStatusMessage]; [joinedStatusMessage release]; [statusMessage release]; }
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]; }
[zebraPrinterConnection release];
- (NSArray *) getStatusMessage |
Used to acquire a human readable string of the current errors/warnings passed to this instance.
+ (NSString*) HEAD_OPEN_MSG |
Message to indicate the head is open.
+ (NSString*) HEAD_TOO_HOT_MSG |
Message to indicate the head is too hot.
- (id) initWithPrinterStatus: | (PrinterStatus *) | aPrinterStatus |
Used to acquire a human readable string of the current errors/warnings stored in aPrinterStatus
aPrinterStatus | An instance of PrinterStatus that will be used to acquire the human readable string of warnings/errors stored in aPrinterStatus . |
+ (NSString*) PAPER_OUT_MSG |
Message to indicate the paper is out.
+ (NSString*) PAUSE_MSG |
Message to indicate printer is paused.
+ (NSString*) RECEIVE_BUFFER_FULL_MSG |
Message to indicate the receive buffer is full.
+ (NSString*) RIBBON_OUT_MSG |
Message to indicate the ribbon is out.