You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

650 lines
20 KiB

3 years ago
/*!
* \~chinese
* SDK3.0.0使SDK
*
* \~english
* This class is a version before SDK3.0.0. Since many customers still use the previous SDK, after optimizing the interface and making too much change, use a class to retain the previous interface.
*/
#import <Foundation/Foundation.h>
#import "SDKDefine.h"
#import "PTBitmap.h"
NS_ASSUME_NONNULL_BEGIN
@interface PTOldCommandTSPL : NSObject
@property(strong,nonatomic,readwrite) NSMutableData *cmdData;
@property (nonatomic, assign) NSStringEncoding encoding;
/**
* printer print self-test message.
*
*/
- (void)selfTest;
- (void)appendCommand:(NSString *)cmd;
/** 打印并走纸一行
* Print and feed one line
*/
- (void)printAndLineFeed;
/**
set font bold
@param bold 0 1
*/
- (void)setFontBold:(NSInteger)bold;
/**
104(aa bb cc dd) + 4() + 1 + 00
eg:1.aabbccdd 03000000 2000
2.aabbccdd ffffffff 0000 aabbccdd 00000000 0000
@param status 1 3
*/
- (void)setPrinterStateAutomaticBackWithStatus:(NSInteger)status;
/**
* setting print area size in paper.
*
*/
- (void)setPrintAreaSizeWithWidth:(NSInteger)label_width
Height:(NSInteger)label_height;
/**
get print status
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
1 1 1 1 1 1 1 1
*/
- (void)getPrinterStatus;
/**
* setting gap distance during labels.
*
*
* @param distance
* @param offset
*/
- (void)setGapWithDistance:(NSInteger)distance
Offset:(NSInteger)offset;
/**
* setting black line
* 线
*
* @param height 线 0~25.4 mm
* @param offset 线 0~label length
* height,offset 0,0
*/
- (void)setBlineWithHeight:(NSInteger)height
Offset:(NSInteger)offset;
/**
* paper feed with distance.
*
*/
- (void)setOffsetWithDistance:(NSInteger)distance;
/**
* setting print sets and copies.
*
*
* @param sets how many sets of labels will be printed.
* @param copies how many copies should be printed for each particular label set.
*/
- (void)printWithSets:(NSInteger)sets Copies:(NSInteger)copies;
/**
@param x_pos x
@param y_pos y
@param font 1-91-8 99
@param rotation
@param x_multiplication font1-8 font9eg24
@param y_multiplication font1-8 font9eg24
@param safeHeight
@param width 0
@param lineSpacing
@param text
@return
*/
- (NSInteger)printAutoTextForVectorWithXpos:(NSInteger)x_pos
yPos:(NSInteger)y_pos
font:(NSInteger)font
rotation:(NSInteger)rotation
xMultiplication:(NSInteger)x_multiplication
yMultiplication:(NSInteger)y_multiplication
safeHeight:(NSInteger)safeHeight
width:(NSInteger)width
lineSpacing:(NSInteger)lineSpacing
text:(NSString *)text;
/**
@param x_pos x
@param y_pos y
@param font 0-1012x24 24x24 1:8x16 16x16
@param rotation
@param x_multiplication :1-10
@param y_multiplication :1-10
@param safeHeight
@param width 0
@param lineSpacing
@param text
@return
*/
- (NSInteger)printAutoTextWithXpos:(NSInteger)x_pos
yPos:(NSInteger)y_pos
font:(NSInteger)font
rotation:(NSInteger)rotation
xMultiplication:(NSInteger)x_multiplication
yMultiplication:(NSInteger)y_multiplication
safeHeight:(NSInteger)safeHeight
width:(NSInteger)width
lineSpacing:(NSInteger)lineSpacing
text:(NSString *)text;
/**
@param x_pos x
@param y_pos y
@param font 0-8 9
@param rotation 0 90 180 270
@param x_multiplication 1-10 40-80()
@param y_multiplication 1-10 40-80()
@param text
*/
- (void)appendTextWithXpos:(NSInteger)x_pos
Ypos:(NSInteger)y_pos
Font:(NSInteger)font
Rotation:(NSInteger)rotation
Xmultiplication:(NSInteger)x_multiplication
Ymultiplication:(NSInteger)y_multiplication
Text:(NSString *)text;
/**
* clean printer buffer.
*
*/
- (void)setCLS;
/**
* print barcode.
*
*
* @param type bar code type @[128,128M,EAN128,25,25C,39,29S,93,EAN13,EAN13+2,EAN13+5,EAN8,EAN8+5,CODA,POST,UPCA,UPCA+2,UPCA+5,UPCE,UPCE+2,UPCE+5,CPOST,MSI,MSIC,PLESSEY,ITF14,EAN14,11];
* @param readable 01 whether it is readable0: unreadable; 1: readable
* @param rotation rotation090180270
* @param narrow narrow element
* @param wide wide element
*/
/**
print barcode.
eg:100,100,39,96,1,0,2,4,1000 10,10,128M,48,1,0,2,2,!104!096ABCD!101EFGH
@param x_pos Specify the x-coordinate of the bar code on the label
@param y_pos Specify the y-coordinate of the bar code on the label
@param type bar code type @[128,128M,EAN128,25,25C,39,29S,93,EAN13,EAN13+2,EAN13+5,EAN8,EAN8+5,CODA,POST,UPCA,UPCA+2,UPCA+5,UPCE,UPCE+2,UPCE+5,CPOST,MSI,MSIC,PLESSEY,ITF14,EAN14,11];
@param height Bar code height (in dots)
@param readable 01 whether it is readable0: unreadable; 1: readable
@param rotation rotation090180270
@param narrow narrow element
@param wide wide element
@param codeNumber the maximum number of digits of bar code content
*/
- (void)printBarcodeWithXPos:(NSInteger)x_pos
YPos:(NSInteger)y_pos
Type:(NSString *)type
Height:(NSInteger)height
HumanReadable:(NSInteger)readable
Rotation:(NSInteger)rotation
Narrow:(NSInteger)narrow
Wide:(NSInteger)wide
CodeNumber:(NSString *)codeNumber;
/**
print QRCode
eg:100,10,L,7,M,0,M1,S1,"ATHE FIRMWARE HAS BEEN UPDATED"
@param x_pos The upper left corner x-coordinate of the QR code
@param y_pos The upper left corner y-coordinate of the QR code
@param ecc_level Error correction recovery level
L :7% M :15% Q : 25% H : 30%
@param width 1~10
@param mode A/M A:Auto M:Manual
@param rotation 0 90 180 270
@param model M1: (default), original version M2: enhanced version
@param mask S0~S8, default is S7
@param text The encodable character set is described as below
*/
- (void)printQRcodeWithXPos:(NSInteger)x_pos
YPos:(NSInteger)y_pos
EccLevel:(NSString *)ecc_level
CellWidth:(NSInteger)width
Mode:(NSString *)mode
Rotation:(NSInteger)rotation
Model:(NSString *)model
Mask:(NSString *)mask
Text:(NSString *)text;
/**
Print Bitmap
,SDK
@param xpos Specify the x-coordinate
@param ypos Specify the y-coordinate
@param mode mode Graphic modes listed below: 0:OVERWRITE 1:OR 2:XOR 3:compress 16:OVERWRITE compress 17:OR compress 18:XOR compress
@param image image
@param bitmapMode binary/dithering
@param compress TIFF/ZPL2/LZO/None
@return The data is less than the cache and can be printed NO:The data exceeds the cache and cannot be printed
*/
- (BOOL)addBitmapWithXPos:(NSInteger)xpos
YPos:(NSInteger)ypos
Mode:(NSInteger)mode
image:(CGImageRef)image
bitmapMode:(PTBitmapMode)bitmapMode
compress:(PTBitmapCompressMode)compress;
#pragma mark BasicSetting 基本设定
/**
* setting print speed
*
*
*/
- (void)setSpeed:(NSInteger)speed;
/**
* setting print density
*
*
* @param density 0~15 level
*/
- (void)setDensity:(NSInteger)density;
/**
* setting print direction and mirror.
*
*
* @param direction 01
* @param mirror 0 1
*/
- (void)setDirection:(NSInteger)direction Mirror:(NSInteger)mirror;
/**
* setting print reference position
*
*
*/
- (void)setReferenceXPos:(NSInteger)x_pos
YPos:(NSInteger)y_pos;
/**
* page 18.
* setting the code page of inernational character set.
7-bit code page name:
USA: USA
BRI: British
GER: German
FRE: French
DAN: Danish
ITA: Italian
SPA: Spanish
SWE: Swedish
SWI: Swiss
8-bit code page number:
437: United States
850: Multilingual
852: Slavic
860: Portuguese
863: Canadian/French
865: Nordic
857: Turkish (TSPL2 printers only)
Windows code page:
1250: Central Europe (TSPL2 printers only)
1252: Latin I (TSPL2 printers only)
1253: Greek (TSPL2 printers only)
1254: Turkish (TSPL2 printers only)
*
* @param codepage
*/
- (void)setCodePage:(NSString *)codepage;
/**
* page 21.
* feed label with the specified length.
*
* @param feedLength (1~9999)
*/
- (void)setFeedLength:(NSInteger)feedLength;
/**
* feed label to the beginning of next label.
*/
- (void)setFormFeed;
/** 回纸 */
- (void)setBackFeed:(NSInteger)distance;
- (void)setBackUP:(NSInteger)distance;
/**
* page 25.
* feed label until the internal sensor has determined the origin.
*/
- (void)setHome;
/**
* page 28.
* control the sound frequency of the beeper.
*
* @param level 0-9
* @param interval 1-4095
*/
- (void)setSoundWithLevel:(NSInteger)level
Interval:(NSInteger)interval;
/**
* page 29.
* activate the cutter to immediately cut the labels without back feeding the label.
*/
- (void)setCut;
/**
* page 30.
*
*/
- (void)setLimitFeed:(NSInteger)max_len;
/**
* page 32.
* draw a bar on the label format.线
*/
- (void)printBarWithXPos:(NSInteger)x_pos
YPos:(NSInteger)y_pos
Width:(NSInteger)width
Height:(NSInteger)height;
/**
* page 39.
* draw rectangles on the label.
* @param thickness 线
*/
- (void)setBoxWithXStart:(NSInteger)x_start
YStart:(NSInteger)y_start
XEnd:(NSInteger)x_end
YEnd:(NSInteger)y_end
Thickness:(NSInteger)thickness;
/** 在标签上绘制椭圆 */
- (void)setEllipseWithXStart:(NSInteger)x_start
YStart:(NSInteger)y_start
Width:(NSInteger)width
Height:(NSInteger)height
Thickness:(NSInteger)thickness;
/**
* page 41.
* draw a circle on the label.
*
* @param diameter
* @param thickness 线
*/
- (void)setCircleWithXStart:(NSInteger)x_start
YStart:(NSInteger)y_start
Diameter:(NSInteger)diameter
Thickness:(NSInteger)thickness;
/**
* page 43.
* clear a specified region in the image buffer.
*/
- (void)setEraseWithXStart:(NSInteger)x_start
YStart:(NSInteger)y_start
XWidth:(NSInteger)x_width
YHeight:(NSInteger)y_height;
/**
* page 42.
* define the DataMatrix 2D bar code.Currently,only ECC200 error correction is supported.
* DataMatrix ECC200
*
* @param xm []Module sizex6x8
* @param row []10-144
* @param col []10-144
* @param expression
*/
- (void)setDmatrixWithExpression:(NSString *)expression
XPos:(NSInteger)x_pos
YPos:(NSInteger)y_pos
Width:(NSInteger)width
Height:(NSInteger)height
XM:(NSString *)xm
Row:(NSString *)row
Col:(NSString *)col;
/**
* page 44.
* define a 2D Maxicode. Maxicode
*
* @param mode 2,3,4,5
* @param iClass [option],Class of Service ,3-digit number(for mode 2,3)
* @param country [option],Country code, 3-digit number (for mode 2,3)
* @param post [option],
Mode 2: (USA) 5-digit+ 4-digit number.
Mode 3: (Canada) 6 alphanumeric post code included by double quotes.
* @param lm Expression length (double quote is ignored) , 1-138, (this parameter is just for mode 4 and 5.)
*/
- (void)setMaxicode:(NSString *)text
XPos:(NSInteger)x_pos
YPos:(NSInteger)y_pos
Mode:(NSInteger)mode
Class:(NSInteger)iClass
Country:(NSInteger)country
Post:(NSString *)post
LM:(NSInteger)lm;
/**
*
* page 46.
* define a PDF417 2D barcode.
[Option]
P Data compression method
0: Auto encoding
1: Binary mode
E Error correction level. Range: 0~8 Center pattern in barcode area
0: The pattern will print upper left justified the area
1: The pattern is printed middle of area
Ux,y,c Human readable
x: Human readable characters in the specified x-coordinate
y: Human readable characters in the specified y-coordinate
c: Maximum characters of human readable character per line
W Module width in dot. Range: 2~9
H Bar height in dot. Range: 4~99
R Maximum number of rows
C Maximum number of columns
T Truncation.
0: Not truncated
1: Truncated
* @param option
*/
- (void)printPDF417WithXPos:(NSInteger)x_pos
YPos:(NSInteger)y_pos
Width:(NSInteger)width
Height:(NSInteger)height
Rotate:(NSInteger)rotate
Option:(NSString *)option
Expression:(NSString *)expression;
/** page 50 */
- (void)printAztecWithXPos:(NSInteger)XPos
YPos:(NSInteger)YPos
rotate:(NSInteger)rotate
size:(NSInteger)size
ecp:(NSInteger)ecp
flg:(NSInteger)flg
menu:(NSInteger)menu
multi:(NSInteger)multi
rev:(NSInteger)rev
aztecData:(NSString *)aztecData;
/**
* page 52.
* print Bitmap format image.
*/
- (void)putBMPWithFilename:(NSString *)filename
XPos:(NSInteger)x_pos
YPos:(NSInteger)y_pos;
/**
* page 54.
* print PCX format images.
*/
- (void)putPCXWithFilename:(NSString *)filename
XPos:(NSInteger)x_pos
YPos:(NSInteger)y_pos;
/**
* page 63.
* reverse a region in image buffer.
*/
- (void)setReverseWithXStart:(NSInteger)x_start
YStart:(NSInteger)y_start
XWidth:(NSInteger)x_width
YHeight:(NSInteger)y_height;
#pragma mark Device Reconfiguration Commands
/**
* page 32.
* setting the counter number in the program and its increments.
*
* @param counterNumber which number of counter0-50
* @param step counting interval -99999999 ~ 99999999
*/
- (void)setCounterWithCounterNumber:(NSInteger)counterNumber
Step:(NSInteger)step;
- (void)setCutterON;
- (void)setCutterOFF;
- (void)setCutterBATCH;
/**
* set number of printing labels per cut
*
* @param pieces (0 ~ 65535)
*/
- (void)setCutterPieces:(NSInteger)pieces;
- (void)setPARTIAL_CUTTER_OFF;
- (void)setPARTIAL_CUTTER_BATCH;
/**
* set number of printing labels per cut
*
* @param pieces (0 ~ 65535)
*/
- (void)setPARTIAL_CUTTER_Pieces:(NSInteger)pieces;
- (void)setBackOFF;
- (void)setBackON;
/**
* This setting is used to enable/disable the KEY1/KEY2/KEY3 function.
*
* @param index KEY1,KEY2,KEY3
* @param switcher ON/OFF
*/
- (void)setKEY:(NSInteger)index Switch:(NSString *)switcher;
/**
* This setting is used to enable/disable the LED function.
LED1 Power on/off
LED2 Printer on-line/off-line
LED3 Error/normal
*
* @param index LED1,LED2,LED3
* @param switcher ON/OFF
*/
- (void)setLED:(NSInteger)index Switch:(NSString *)switcher;
- (void)setPeelON;
- (void)setPeelOFF;
/**
* This command is used to enable/disable feeding of labels to gap/black mark position for tearing off.
* This setting will be saved in printer memory when turning off the power.
*/
- (void)setTearON;
- (void)setTearOFF;
- (void)setStriperON;
- (void)setStriperOFF;
/**
* This setting is used to enable/disable head open sensor.
*/
- (void)setHeadON;
- (void)setHeadOFF;
- (void)setRibbonON;
- (void)setRibbonOFF;
/**
* This setting defines communication parameters for printer serial port.
*
* @param baud 24,48,96,19,38,57,115( 2400 bps,4800 bps,9600 bps,38400 bps,15200 bps)
* @param parity N,E,O(NO/Even/Odd parity check)
* @param data 7,8(bits Data)
* @param stop 1,2(stop bit)
*/
- (void)setCOM1WithBaud:(NSInteger)baud
Parity:(NSString *)parity
Data:(NSString *)data
Stop:(NSString *)stop;
/**
* This command will print one label and feed label gap to tear br position for tearing away.
* This setting will be saved in printer memory.
*
* @param key OFF/ON/AUTO/<num>
*/
- (void)setPrintKey:(NSString *)key;
- (void)setReprintON;
- (void)setReprintOFF;
@end
NS_ASSUME_NONNULL_END