A connection to a Zebra printer.  
 More...
#import <ZebraPrinterConnection.h>
A connection to a Zebra printer. 
 
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. 
 
 
 
      
        
          | - (NSString *) getSimpleConnectionName  | 
           | 
           | 
           | 
        
      
 
Return a human-readable description of the connection. 
- Returns
 - a human-readable description of the connection. 
 
 
 
      
        
          | - (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. 
 
 
Returns YES if the connection is open. 
- Returns
 YES if this connection is 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
 - 
  
    | error | Will be set to the error that occured.  | 
  
   
- Returns
 - The bytes read from the connection or 
nil if an error occurred.  
 
 
      
        
          | - (void) read:  | 
           | 
          (NSOutputStream *)  | 
          destinationStream | 
        
        
          | error: | 
           | 
          (NSError **)  | 
          error  | 
        
        
           | 
           | 
           |  | 
        
      
 
Reads all the available data from the connection and write it to destinationStream. 
This call is non-blocking.
- Parameters
 - 
  
    | destinationStream | Output stream to recive the data read from the connection.  | 
    | error | Will be set to the error that occured.  | 
  
   
- Returns
 - The bytes read from the connection or 
nil if an error occurred.  
 
 
      
        
          | - (NSData*) sendAndWaitForResponse:  | 
           | 
          (NSData *)  | 
          data | 
        
        
          | withMaxTimeoutForRead: | 
           | 
          (NSInteger)  | 
          maxTimeoutForRead | 
        
        
          | andWithTimeToWaitForMoreData: | 
           | 
          (NSInteger)  | 
          timeToWaitForMoreData | 
        
        
          | withResponseValidator: | 
           | 
          (id< ResponseValidator, NSObject >)  | 
          validator | 
        
        
          | andWithError: | 
           | 
          (NSError **)  | 
          error  | 
        
        
           | 
           | 
           |  | 
        
      
 
Sends data and returns the response data. 
The software returns immediately if the response data received contains terminator. The connection must be open before this method is called. If sendAndWaitForResponse is called when a connection is closed, a ConnectionException is thrown.
- Parameters
 - 
  
    | data | byte array of data to send  | 
    | maxTimeoutForRead | The maximum time, in milliseconds, to wait for the initial response to be received. If no data is received during this time, the function returns a zero length array.  | 
    | timeToWaitForMoreData | After the initial response, if no data is received for this period of time, the input is considered complete and the method returns.  | 
    | validator | If the response is valid, the input is considered complete and the method returns. May be used to avoid waiting for more data when the response is always terminated with a known string. Use null if no validator is desired.  | 
    | error | Will be set to the error that occured.  | 
  
   
- Returns
 - received data 
 
 
 
      
        
          | - (NSData*) sendAndWaitForResponse:  | 
           | 
          (NSData *)  | 
          data | 
        
        
          | withResponseValidator: | 
           | 
          (id< ResponseValidator, NSObject >)  | 
          validator | 
        
        
          | withError: | 
           | 
          (NSError **)  | 
          error  | 
        
        
           | 
           | 
           |  | 
        
      
 
Sends data and returns the response data. 
The software returns immediately if the data received contains terminator. The connection must be open before this method is called. If sendAndWaitForResponse is called when a connection is closed, a ConnectionException is thrown.
- Parameters
 - 
  
    | data | byte array of data to send  | 
    | validator | If the response is valid, the input is considered complete and the method returns. May be used to avoid waiting for more data when the response is always terminated with a known string. Use null if no validator is desired.  | 
    | error | Will be set to the error that occured.  | 
  
   
- Returns
 - received data 
 
 
 
      
        
          | - (void) setMaxTimeoutForRead:  | 
           | 
          (NSInteger)  | 
          paramMaxTimeoutForRead | 
           | 
        
      
 
Set the maximum time, in milliseconds, to wait for any data to be received. 
- Parameters
 - 
  
    | paramMaxTimeoutForRead | the maximum time, in milliseconds, to wait for any data to be received.  | 
  
   
 
 
      
        
          | - (void) setTimeToWaitForMoreData:  | 
           | 
          (NSInteger)  | 
          paramMimeToWaitForMoreData | 
           | 
        
      
 
Set the maximum time, in milliseconds, to wait in-between reads after the initial read. 
- Parameters
 - 
  
    | paramMimeToWaitForMoreData | the maximum time, in milliseconds, to wait in-between reads after the initial read.  | 
  
   
 
 
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
 - 
  
    | maxTimeout | Maximum 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
 - 
  
    | data | The data.  | 
    | error | Will be set to the error that occured.  | 
  
   
- Returns
 - The number of bytes written or -1 if an error occurred. 
 
 
 
      
        
          | - (NSInteger) write:  | 
           | 
          (NSData *)  | 
          data | 
        
        
          | withOffset: | 
           | 
          (NSInteger)  | 
          offset | 
        
        
          | andWithLength: | 
           | 
          (NSInteger)  | 
          length | 
        
        
          | error: | 
           | 
          (NSError **)  | 
          error  | 
        
        
           | 
           | 
           |  | 
        
      
 
Writes length bytes from data starting at offset. 
T. The connection must be open before this method is called. If write:error: is called when a connection is closed, -1 is returned.
- Parameters
 - 
  
    | data | The data.  | 
    | error | Will be set to the error that occured.  | 
  
   
- Returns
 - The number of bytes written or -1 if an error occurred. 
 
 
 
      
        
          | - (NSInteger) writeStream:  | 
           | 
          (NSInputStream *)  | 
          dataSource | 
        
        
          | error: | 
           | 
          (NSError **)  | 
          error  | 
        
        
           | 
           | 
           |  | 
        
      
 
Writes all available bytes from the data source 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
 - 
  
    | data | The data.  | 
    | error | Will 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: