From 0c31f5a7667e7681482be92760a37c1fd2bcc1a6 Mon Sep 17 00:00:00 2001 From: Evan Moore Date: Thu, 13 Feb 2020 12:04:03 -0500 Subject: [PATCH] update link os --- README.md | 1 + package.json | 2 +- plugin.xml | 2 +- src/.DS_Store | Bin 6148 -> 8196 bytes .../lib/include/ResponseValidator.h | 25 +++++ .../lib/include/TcpPrinterConnection.h | 2 +- .../lib/include/ZebraPrinterConnection.h | 103 +++++++++++++++++- .../ZebraPrinter/lib/include/ZplPrintMode.h | 0 src/ios/ZebraPrinter/lib/libZSDK_API.a | Bin 3667448 -> 3667448 bytes 9 files changed, 126 insertions(+), 9 deletions(-) create mode 100755 src/ios/ZebraPrinter/lib/include/ResponseValidator.h mode change 100755 => 100644 src/ios/ZebraPrinter/lib/include/ZplPrintMode.h diff --git a/README.md b/README.md index 3d2c2ca..6107aa5 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/package.json b/package.json index 3a89bb0..d523337 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/plugin.xml b/plugin.xml index 1cc1e45..ce4366f 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,5 +1,5 @@ - ZebraPrinter diff --git a/src/.DS_Store b/src/.DS_Store index 9bbddbf47d30f673480d3cb88d3ad9009af90e8e..7d4ec71ed1088b4a2ced17f5070af1c074e721b0 100644 GIT binary patch literal 8196 zcmeHMTWl3Y7@q&Mz%DE8w4z<)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~l#LP+o=z3oMrD)C)+8nW zow@(Y+i~(0`4Kt$7rBB=oeq`A)fn=0Db#bGrl0|uUMM(*tW{~!3c%xnMv delta 116 zcmZp1XfcprU|?W$DortDU=RQ@Ie-{MGjUEV6q~50$jH1gU^gQp^JX3aYsSfI#iKSh yq_He!=im@z2C4!A0d64S3evE#@H_Klei=uQi42Sk3@jj;31TEzY;!!%9A*GtAQ5!{ diff --git a/src/ios/ZebraPrinter/lib/include/ResponseValidator.h b/src/ios/ZebraPrinter/lib/include/ResponseValidator.h new file mode 100755 index 0000000..4d1308f --- /dev/null +++ b/src/ios/ZebraPrinter/lib/include/ResponseValidator.h @@ -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 diff --git a/src/ios/ZebraPrinter/lib/include/TcpPrinterConnection.h b/src/ios/ZebraPrinter/lib/include/TcpPrinterConnection.h index 46edbfc..081d905 100755 --- a/src/ios/ZebraPrinter/lib/include/TcpPrinterConnection.h +++ b/src/ios/ZebraPrinter/lib/include/TcpPrinterConnection.h @@ -112,7 +112,7 @@ @interface TcpPrinterConnection : NSObject { @private NSString *ipAddress; @private NSInteger port; - @private NSInteger maxTimetouForRead; + @private NSInteger maxTimeoutForRead; @private NSInteger timeToWaitForMoreData; @private NSInteger maxTimeoutForOpen; @private BOOL m_isConnected; diff --git a/src/ios/ZebraPrinter/lib/include/ZebraPrinterConnection.h b/src/ios/ZebraPrinter/lib/include/ZebraPrinterConnection.h index 00c2371..3b7dbfe 100755 --- a/src/ios/ZebraPrinter/lib/include/ZebraPrinterConnection.h +++ b/src/ios/ZebraPrinter/lib/include/ZebraPrinterConnection.h @@ -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 YES if the connection is open. * @@ -63,21 +78,59 @@ /** * Writes the number of bytes from data 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 length bytes from data starting at offset. 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 nil if an error occurred. */ - (NSData *)read: (NSError**)error; +/** + * Reads all the available data from the connection and write it to destinationStream. 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 nil 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 YES if at least one byte is available for reading from this connection. * @@ -93,6 +146,48 @@ */ - (void) waitForData: (NSInteger)maxTimeout; +/** + * 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. + * + * @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 + * null if no validator is desired. + * @param error Will be set to the error that occured. + * @return received data + */ + +-(NSData*) sendAndWaitForResponse:(NSData*)data + withResponseValidator:(id) validator + withError:(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. + * + * @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 + * null 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) validator + andWithError:(NSError **)error; + @end @@ -116,10 +211,6 @@ *
  • As a best pracitce, Zebra recommends not making calls to our API from the GUI thread. Use Grand Central Dispatch to accomplish this.
  • *
  • Only Mobile printers are available with built-in magnetic card readers
  • *
  • Each ZebraPrinterConnection object should only be used on a single thread
  • - *
  • 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.
    • To change this, go into xCode > Build Settings > Build Options - and set “Enable Bitcode” to “No” for the project to be exported.
  • * * * Project Settings and Configuration diff --git a/src/ios/ZebraPrinter/lib/include/ZplPrintMode.h b/src/ios/ZebraPrinter/lib/include/ZplPrintMode.h old mode 100755 new mode 100644 diff --git a/src/ios/ZebraPrinter/lib/libZSDK_API.a b/src/ios/ZebraPrinter/lib/libZSDK_API.a index 7b1b1e64029b3f35384339d6a76d5623465feadd..2015961ed91e312e1f8275b6d3a12b19a2cb1cec 100755 GIT binary patch delta 3787 zcmZ8kdu&rx7|-3a-PmZmNAJBGD{X;x?bzDV4j3X75ExOkXmmqFib2>ww_;T0BcX`V zAxewHi%%$;AgBo&%C})+?2O`2lT~8e)F{Q6OdhgojNAOjbI;{`r}K~g@%`?1zQ^x- zoYV0uzX;>x7u#9r^LgekYz!#jb9Iv9a+JJv+9O=5y#f1Qj`y2Sd)(_^V!-Km|3rWb z*9R+^0O0~5yogB(ktDbj6m$qd<|!exhA9xsB81Ngt;-k!Nqx@9Jd_fPbBsbLtW;aTqM{=bFC`I1OjW#lgo;6;|?eZ`L;-$T%oX(DN#$E=L)~IXCb08(J-?Zc3dg^;#LML#F_-_7U()12vMKu z`*n%!4AS!XN|(YqDTHeoUY7KQ*@VmR@pAnUY&4Zo8J_IYcVu(63rdlRq6p`ln#yq%4`F*MAyWY< z`+ddZ3-L@wDbDbU69pM^zc2oWyBA8Q^}mDa$=+#^?K*A#`~hgHDH+n?N28_2A&vkC_(Sha$S&VK{8$5kHZhqf{G}w zB>5(SHB=Gd1tC0;UGP|ix1Cu~QpZThZ5mP$-QBWu}#%1t++ z70TbhSCxGTK~!fR;WJ73d%|fJv8*a%B%Mv>G2T`*o3e*fEv5;)53G%@piAi8PRWp{gFS^M7_5D?I5t~6XA&B1`NNEZZcr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