ZSDK_API  1.4.957
 All Classes Functions Enumerations Enumerator Properties Pages
<ZebraPrinterConnection> Protocol Referenceabstract

A connection to a Zebra printer. More...

#import <ZebraPrinterConnection.h>

Inheritance diagram for <ZebraPrinterConnection>:
MfiBtPrinterConnection TcpPrinterConnection

Instance Methods

(NSString *) - toString
 See the classes which implement this method for the format of the description string.
 
(NSInteger) - getMaxTimeoutForRead
 Returns the maximum time, in milliseconds, to wait for any data to be received.
 
(NSInteger) - getTimeToWaitForMoreData
 Returns the maximum time, in milliseconds, to wait between reads after the initial read.
 
(BOOL) - isConnected
 Returns YES if the connection is open.
 
(BOOL) - open
 Opens the connection to a device.
 
(void) - close
 Closes this connection and releases any system resources associated with the connection.
 
(NSInteger) - write:error:
 Writes the number of bytes from data to the connection.
 
(NSData *) - read:
 Reads all the available data from the connection.
 
(BOOL) - hasBytesAvailable
 Returns YES if at least one byte is available for reading from this connection.
 
(void) - waitForData:
 Causes the currently executing thread to sleep until hasBytesAvailable equals YES, or for a maximum of maxTimeout milliseconds.
 

Detailed Description

A connection to a Zebra printer.

Method Documentation

- (void) close

Closes this connection and releases any system resources associated with the connection.

If the connection is already closed then invoking this method has no effect.

- (NSInteger) getMaxTimeoutForRead

Returns the maximum time, in milliseconds, to wait for any data to be received.

Returns
The maximum time, in milliseconds, to wait for any data to be received.
- (NSInteger) getTimeToWaitForMoreData

Returns the maximum time, in milliseconds, to wait between reads after the initial read.

Returns
The maximum time, in milliseconds, to wait between reads after the initial read.
- (BOOL) hasBytesAvailable

Returns YES if at least one byte is available for reading from this connection.

Returns
YES if there is data avaiilable.
- (BOOL) isConnected

Returns YES if the connection is open.

Returns
YES if this connection is open.
- (BOOL) open

Opens the connection to a device.

If the open method is called on an open connection this call is ignored. When a handle to the connection is no longer needed, call close to free up system resources.

Returns
NO if the connection cannot be established.
- (NSData *) read: (NSError **)  error

Reads all the available data from the connection.

This call is non-blocking.

Parameters
errorWill be set to the error that occured.
Returns
The bytes read from the connection or nil if an error occurred.
- (NSString *) toString

See the classes which implement this method for the format of the description string.

Returns
The connection description string.
- (void) waitForData: (NSInteger)  maxTimeout

Causes the currently executing thread to sleep until hasBytesAvailable equals YES, or for a maximum of maxTimeout milliseconds.

Parameters
maxTimeoutMaximum time in milliseconds to wait for an initial response from the printer.
- (NSInteger) write: (NSData *)  data
error: (NSError **)  error 

Writes the number of bytes from data to the connection.

The connection must be open before this method is called. If write:error: is called when a connection is closed, -1 is returned.

Parameters
dataThe data.
errorWill be set to the error that occured.
Returns
The number of bytes written or -1 if an error occurred.

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