ZSDK_API  1.5.1049
 All Classes Functions Enumerations Enumerator Properties Pages
PrinterStatusMessages Class Reference

This class is used to acquire a human readable string of the current errors/warnings stored in a PrinterStatus instance. More...

#import <PrinterStatusMessages.h>

Inheritance diagram for PrinterStatusMessages:

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.
 

Detailed Description

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];

Method Documentation

- (NSArray *) 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.
+ (NSString*) HEAD_OPEN_MSG

Message to indicate the head is open.

Returns
A message to indicate the head is open.
+ (NSString*) HEAD_TOO_HOT_MSG

Message to indicate the head is too hot.

Returns
A 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

Parameters
aPrinterStatusAn 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.

Returns
A message to indicate the paper is out.
+ (NSString*) PAUSE_MSG

Message to indicate printer is paused.

Returns
A message to indicate printer is paused.
+ (NSString*) RECEIVE_BUFFER_FULL_MSG

Message to indicate the receive buffer is full.

Returns
A message to indicate the receive buffer is full.
+ (NSString*) RIBBON_OUT_MSG

Message to indicate the ribbon is out.

Returns
A message to indicate the ribbon is out.

The documentation for this class was generated from the following file: