update link os

This commit is contained in:
Evan Moore 2020-02-13 12:04:03 -05:00
parent e9949500fb
commit 0c31f5a766
9 changed files with 126 additions and 9 deletions

View File

@ -2,6 +2,7 @@
A Cordova plugin for Zebra CPCL printers for both iOS and Android with Ionic 3 bindings. This plugin only supports Zebra models that use CPCL printing. Feel free to contribute to this project if you need to support other methods of printing. It has only been tested with Zebra QLn320 printers. Let me know if you use if sucessfully with others.
Also this now requires a minimum of Cordova 9 and cordova-ios 5.0.
Current version of link_os_sdk is 1.5.1049
Get from npm
```

View File

@ -1,6 +1,6 @@
{
"name": "ca-cleversolutions-zebraprinter",
"version": "0.0.4",
"version": "0.0.5",
"description": "Zebra Printer Cordova Plugin for iOS and Android",
"cordova": {
"id": "ca-cleversolutions-zebraprinter",

View File

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<plugin id="ca-cleversolutions-zebraprinter" version="0.0.3"
<plugin id="ca-cleversolutions-zebraprinter" version="0.0.5"
xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<name>ZebraPrinter</name>

BIN
src/.DS_Store vendored

Binary file not shown.

View File

@ -0,0 +1,25 @@
/**********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The information contained herein is the confidential and the exclusive property of
* ZIH Corp. This document, and the information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose without the express
* written consent of ZIH Corp.
*
* Copyright ZIH Corp. 2012
*
* ALL RIGHTS RESERVED
***********************************************/
@protocol ResponseValidator
/**
* Provide a method to determine whether a response from the printer is a complete response.
*
* @param input string to be validated
* @return true if the string is a complete response
*/
-(BOOL)isResponseComplete:(NSData *)data;
@end

View File

@ -112,7 +112,7 @@
@interface TcpPrinterConnection : NSObject<ZebraPrinterConnection> {
@private NSString *ipAddress;
@private NSInteger port;
@private NSInteger maxTimetouForRead;
@private NSInteger maxTimeoutForRead;
@private NSInteger timeToWaitForMoreData;
@private NSInteger maxTimeoutForOpen;
@private BOOL m_isConnected;

View File

@ -11,6 +11,7 @@
* ALL RIGHTS RESERVED
***********************************************/
#import "ResponseValidator.h"
/**
* A connection to a Zebra printer.
@ -38,6 +39,20 @@
*/
- (NSInteger) getTimeToWaitForMoreData;
/**
* Set the maximum time, in milliseconds, to wait for any data to be received
*
* @param paramMaxTimeoutForRead the maximum time, in milliseconds, to wait for any data to be received.
*/
-(void) setMaxTimeoutForRead:(NSInteger) paramMaxTimeoutForRead;
/**
* Set the maximum time, in milliseconds, to wait in-between reads after the initial read.
*
* @param paramMimeToWaitForMoreData the maximum time, in milliseconds, to wait in-between reads after the initial read.
*/
-(void) setTimeToWaitForMoreData:(NSInteger) paramMimeToWaitForMoreData;
/**
* Returns <c>YES</c> if the connection is open.
*
@ -63,21 +78,59 @@
/**
* Writes the number of bytes from <c>data</c> to the connection. The connection must be
* open before this method is called. If ZebraPrinterConnection::write:error: is called when a connection is closed, -1 is returned.
*
*
* @param data The data.
* @param error Will be set to the error that occured.
* @return The number of bytes written or -1 if an error occurred.
*/
- (NSInteger) write:(NSData *)data error:(NSError **)error;
/**
* Writes <c>length</c> bytes from <c>data</c> starting at <c>offset</c>. T. The connection must be
* open before this method is called. If ZebraPrinterConnection::write:error: is called when a connection is closed, -1 is returned.
*
* @param data The data.
* @param error Will be set to the error that occured.
* @return 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 all available bytes from the data source to the connection. The connection must be
* open before this method is called. If ZebraPrinterConnection::write:error: is called when a connection is closed, -1 is returned.
*
* @param data The data.
* @param error Will be set to the error that occured.
* @return The number of bytes written or -1 if an error occurred.
*/
- (NSInteger) writeStream:(NSInputStream *)dataSource error:(NSError **)error;
/**
* Reads all the available data from the connection. This call is non-blocking.
*
*
* @param error Will be set to the error that occured.
* @return The bytes read from the connection or <c>nil</c> if an error occurred.
*/
- (NSData *)read: (NSError**)error;
/**
* Reads all the available data from the connection and write it to <c>destinationStream</c>. This call is non-blocking.
*
* @param destinationStream Output stream to recive the data read from the connection.
* @param error Will be set to the error that occured.
* @return The bytes read from the connection or <c>nil</c> if an error occurred.
*/
- (void)read:(NSOutputStream *)destinationStream error:(NSError **)error;
/**
* Return a human-readable description of the connection.
*
* @return a human-readable description of the connection.
*/
- (NSString *)getSimpleConnectionName;
/**
* Returns <c>YES</c> if at least one byte is available for reading from this connection.
*
@ -93,6 +146,48 @@
*/
- (void) waitForData: (NSInteger)maxTimeout;
/**
* Sends <c>data</c> and returns the response data. The software returns immediately if the data
* received contains <c>terminator</c>. The connection must be open before this method is called. If
* <c>sendAndWaitForResponse</c> is called when a connection is closed, a <c>ConnectionException</c> is
* thrown.
*
* @param data byte array of data to send
* @param 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
* <c>null</c> if no validator is desired.
* @param error Will be set to the error that occured.
* @return received data
*/
-(NSData*) sendAndWaitForResponse:(NSData*)data
withResponseValidator:(id<ResponseValidator,NSObject>) validator
withError:(NSError **)error;
/**
* Sends <c>data</c> and returns the response data. The software returns immediately if the response data
* received contains <c>terminator</c>. The connection must be open before this method is called. If
* <c>sendAndWaitForResponse</c> is called when a connection is closed, a <c>ConnectionException</c> is
* thrown.
*
* @param data byte array of data to send
* @param 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.
* @param timeToWaitForMoreData After the initial response, if no data is received for this period of time, the
* input is considered complete and the method returns.
* @param 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
* <c>null</c> if no validator is desired.
* @param error Will be set to the error that occured.
* @return received data
*/
-(NSData*) sendAndWaitForResponse:(NSData*)data
withMaxTimeoutForRead:(NSInteger) maxTimeoutForRead
andWithTimeToWaitForMoreData:(NSInteger) timeToWaitForMoreData
withResponseValidator:(id<ResponseValidator,NSObject>) validator
andWithError:(NSError **)error;
@end
@ -116,10 +211,6 @@
* <li>As a best pracitce, Zebra recommends not making calls to our API from the GUI thread. Use <a href="http://developer.apple.com/library/ios/#documentation/Performance/Reference/GCD_libdispatch_Ref/Reference/reference.html">Grand Central Dispatch</a> to accomplish this.</li>
* <li>Only Mobile printers are available with built-in magnetic card readers</li>
* <li>Each ZebraPrinterConnection object should only be used on a single thread</li>
* <li>In iOS 9, a new Build Variant Enable Bitcode was introduced.
This variant is initially set to Yes which may cause any project using the ZSDK_API
to not build properly.<br><ul><li>To change this, go into xCode > Build Settings > Build Options
and set Enable Bitcode to No for the project to be exported.</li></ul></li>
* </ol>
*
* <b>Project Settings and Configuration</b>

0
src/ios/ZebraPrinter/lib/include/ZplPrintMode.h Executable file → Normal file
View File