@connexup/react-native-xprinter 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/LICENSE +20 -0
  2. package/NativeXPrinter.podspec +23 -0
  3. package/README.md +24 -0
  4. package/android/build.gradle +73 -0
  5. package/android/gradle.properties +5 -0
  6. package/android/libs/printer-lib-3.4.7.aar +0 -0
  7. package/android/src/main/AndroidManifest.xml +2 -0
  8. package/android/src/main/java/com/connexup/xprinter/Errors.kt +11 -0
  9. package/android/src/main/java/com/connexup/xprinter/Util.kt +106 -0
  10. package/android/src/main/java/com/connexup/xprinter/XPrinterPackage.kt +77 -0
  11. package/android/src/main/java/com/connexup/xprinter/esc/Convert.kt +211 -0
  12. package/android/src/main/java/com/connexup/xprinter/esc/XPrinterESCModule.kt +1995 -0
  13. package/android/src/main/java/com/connexup/xprinter/printer/Convert.kt +46 -0
  14. package/android/src/main/java/com/connexup/xprinter/printer/DeviceConnection.kt +14 -0
  15. package/android/src/main/java/com/connexup/xprinter/printer/Printers.kt +153 -0
  16. package/android/src/main/java/com/connexup/xprinter/printer/XPrinterPrinterModule.kt +295 -0
  17. package/android/src/main/java/com/connexup/xprinter/tspl/Convert.kt +151 -0
  18. package/android/src/main/java/com/connexup/xprinter/tspl/XPrinterTSPLModule.kt +1408 -0
  19. package/android/src/main/java/com/connexup/xprinter/utils/XPrinterUtilsModule.kt +54 -0
  20. package/ios/ESC/ESCConvert.swift +283 -0
  21. package/ios/ESC/Models/RCTESCPrintBarCodeRequest.swift +23 -0
  22. package/ios/ESC/Models/RCTESCPrintBitmapRequest.swift +23 -0
  23. package/ios/ESC/Models/RCTESCPrintPDF417Request.swift +27 -0
  24. package/ios/ESC/Models/RCTESCPrintQRCodeRequest.swift +19 -0
  25. package/ios/ESC/Models/RCTESCPrintTableBarcode.swift +23 -0
  26. package/ios/ESC/Models/RCTESCPrintTableRequest.swift +19 -0
  27. package/ios/ESC/Models/RCTESCPrintTableRow.swift +19 -0
  28. package/ios/ESC/Models/RCTESCPrintTextRequest.swift +21 -0
  29. package/ios/ESC/Models/RCTESCPrintTextSizeRequest.swift +17 -0
  30. package/ios/ESC/Models/RCTESCSelectBitmapModelRequest.swift +17 -0
  31. package/ios/ESC/Models/RCTESCSetNetAllRequest.swift +19 -0
  32. package/ios/ESC/Models/RCTESCSetPrintAreaRequest.swift +19 -0
  33. package/ios/ESC/Models/RCTESCSetTextStyleRequest.swift +17 -0
  34. package/ios/ESC/Models/RCTESCWifiConfigRequest.swift +23 -0
  35. package/ios/ESC/NativeXPrinterESC.swift +1339 -0
  36. package/ios/ESC/RCTNativeXPrinterESC.h +10 -0
  37. package/ios/ESC/RCTNativeXPrinterESC.mm +541 -0
  38. package/ios/Errors.swift +11 -0
  39. package/ios/NativeErrorInfo.swift +21 -0
  40. package/ios/Printer/Connecter.swift +214 -0
  41. package/ios/Printer/Models/RCTDeviceConnectStatusChangeEvent.swift +19 -0
  42. package/ios/Printer/Models/RCTNetDevice.swift +21 -0
  43. package/ios/Printer/Models/RCTUSBDevice.swift +17 -0
  44. package/ios/Printer/Models/RCTUpdateUdpNetConfigRequest.swift +21 -0
  45. package/ios/Printer/NativeXPrinterPrinter.swift +209 -0
  46. package/ios/Printer/Printers.swift +59 -0
  47. package/ios/Printer/RCTNativeXPrinterPrinter.h +12 -0
  48. package/ios/Printer/RCTNativeXPrinterPrinter.mm +123 -0
  49. package/ios/PrinterSDK/Headers/CPCLCommand.h +324 -0
  50. package/ios/PrinterSDK/Headers/KDS_Log.h +47 -0
  51. package/ios/PrinterSDK/Headers/LabelDocument.h +32 -0
  52. package/ios/PrinterSDK/Headers/LabelImageTranster.h +19 -0
  53. package/ios/PrinterSDK/Headers/POSBLEManager.h +164 -0
  54. package/ios/PrinterSDK/Headers/POSCommand.h +760 -0
  55. package/ios/PrinterSDK/Headers/POSImageTranster.h +34 -0
  56. package/ios/PrinterSDK/Headers/POSPrinter.h +47 -0
  57. package/ios/PrinterSDK/Headers/POSPrinterSDK.h +13 -0
  58. package/ios/PrinterSDK/Headers/POSWIFIManager.h +162 -0
  59. package/ios/PrinterSDK/Headers/PTable.h +50 -0
  60. package/ios/PrinterSDK/Headers/PrinterProfile.h +28 -0
  61. package/ios/PrinterSDK/Headers/TSCBLEManager.h +142 -0
  62. package/ios/PrinterSDK/Headers/TSCCommand.h +701 -0
  63. package/ios/PrinterSDK/Headers/TSCPrinterSDK.h +15 -0
  64. package/ios/PrinterSDK/Headers/TSCWIFIManager.h +99 -0
  65. package/ios/PrinterSDK/Headers/WIFIConnecter.h +131 -0
  66. package/ios/PrinterSDK/Headers/ZPLCommand.h +372 -0
  67. package/ios/PrinterSDK/libPrinterSDK.a +0 -0
  68. package/ios/TSPL/Models/RCTTSPLBarRequest.swift +19 -0
  69. package/ios/TSPL/Models/RCTTSPLBarcodeRequest.swift +29 -0
  70. package/ios/TSPL/Models/RCTTSPLBitmapCompressionRequest.swift +25 -0
  71. package/ios/TSPL/Models/RCTTSPLBitmapRequest.swift +25 -0
  72. package/ios/TSPL/Models/RCTTSPLBoxRequest.swift +21 -0
  73. package/ios/TSPL/Models/RCTTSPLEraseRequest.swift +19 -0
  74. package/ios/TSPL/Models/RCTTSPLPDFBase64Request.swift +21 -0
  75. package/ios/TSPL/Models/RCTTSPLPutBMPRequest.swift +17 -0
  76. package/ios/TSPL/Models/RCTTSPLQRCodeRequest.swift +29 -0
  77. package/ios/TSPL/Models/RCTTSPLReverseRequest.swift +19 -0
  78. package/ios/TSPL/Models/RCTTSPLTextRequest.swift +25 -0
  79. package/ios/TSPL/NativeXPrinterTSPL.swift +831 -0
  80. package/ios/TSPL/RCTNativeXPrinterTSPL.h +10 -0
  81. package/ios/TSPL/RCTNativeXPrinterTSPL.mm +445 -0
  82. package/ios/TSPL/TSPLConvert.swift +140 -0
  83. package/ios/Utils/Models/RCTCheckIsPureWhiteImageRequest.swift +16 -0
  84. package/ios/Utils/NativeXPrinterUtils.swift +17 -0
  85. package/ios/Utils/RCTNativeXPrinterUtils.h +10 -0
  86. package/ios/Utils/RCTNativeXPrinterUtils.mm +38 -0
  87. package/ios/Utils.swift +126 -0
  88. package/lib/module/esc/NativeXPrinterESC.js +218 -0
  89. package/lib/module/esc/NativeXPrinterESC.js.map +1 -0
  90. package/lib/module/esc/index.js +324 -0
  91. package/lib/module/esc/index.js.map +1 -0
  92. package/lib/module/index.js +8 -0
  93. package/lib/module/index.js.map +1 -0
  94. package/lib/module/package.json +1 -0
  95. package/lib/module/printer/NativeXPrinterPrinter.js +30 -0
  96. package/lib/module/printer/NativeXPrinterPrinter.js.map +1 -0
  97. package/lib/module/printer/index.js +110 -0
  98. package/lib/module/printer/index.js.map +1 -0
  99. package/lib/module/tspl/NativeXPrinterTSPL.js +143 -0
  100. package/lib/module/tspl/NativeXPrinterTSPL.js.map +1 -0
  101. package/lib/module/tspl/index.js +347 -0
  102. package/lib/module/tspl/index.js.map +1 -0
  103. package/lib/module/type.js +12 -0
  104. package/lib/module/type.js.map +1 -0
  105. package/lib/module/util.js +4 -0
  106. package/lib/module/util.js.map +1 -0
  107. package/lib/module/utils/NativeXPrinterUtils.js +5 -0
  108. package/lib/module/utils/NativeXPrinterUtils.js.map +1 -0
  109. package/lib/module/utils/index.js +17 -0
  110. package/lib/module/utils/index.js.map +1 -0
  111. package/lib/typescript/package.json +1 -0
  112. package/lib/typescript/src/esc/NativeXPrinterESC.d.ts +343 -0
  113. package/lib/typescript/src/esc/NativeXPrinterESC.d.ts.map +1 -0
  114. package/lib/typescript/src/esc/index.d.ts +122 -0
  115. package/lib/typescript/src/esc/index.d.ts.map +1 -0
  116. package/lib/typescript/src/index.d.ts +6 -0
  117. package/lib/typescript/src/index.d.ts.map +1 -0
  118. package/lib/typescript/src/printer/NativeXPrinterPrinter.d.ts +61 -0
  119. package/lib/typescript/src/printer/NativeXPrinterPrinter.d.ts.map +1 -0
  120. package/lib/typescript/src/printer/index.d.ts +32 -0
  121. package/lib/typescript/src/printer/index.d.ts.map +1 -0
  122. package/lib/typescript/src/tspl/NativeXPrinterTSPL.d.ts +261 -0
  123. package/lib/typescript/src/tspl/NativeXPrinterTSPL.d.ts.map +1 -0
  124. package/lib/typescript/src/tspl/index.d.ts +128 -0
  125. package/lib/typescript/src/tspl/index.d.ts.map +1 -0
  126. package/lib/typescript/src/type.d.ts +9 -0
  127. package/lib/typescript/src/type.d.ts.map +1 -0
  128. package/lib/typescript/src/util.d.ts +2 -0
  129. package/lib/typescript/src/util.d.ts.map +1 -0
  130. package/lib/typescript/src/utils/NativeXPrinterUtils.d.ts +10 -0
  131. package/lib/typescript/src/utils/NativeXPrinterUtils.d.ts.map +1 -0
  132. package/lib/typescript/src/utils/index.d.ts +9 -0
  133. package/lib/typescript/src/utils/index.d.ts.map +1 -0
  134. package/package.json +178 -0
  135. package/src/esc/NativeXPrinterESC.ts +516 -0
  136. package/src/esc/index.ts +489 -0
  137. package/src/index.ts +5 -0
  138. package/src/printer/NativeXPrinterPrinter.ts +84 -0
  139. package/src/printer/index.ts +160 -0
  140. package/src/tspl/NativeXPrinterTSPL.ts +388 -0
  141. package/src/tspl/index.ts +535 -0
  142. package/src/type.ts +11 -0
  143. package/src/util.ts +1 -0
  144. package/src/utils/NativeXPrinterUtils.ts +14 -0
  145. package/src/utils/index.ts +27 -0
@@ -0,0 +1,760 @@
1
+ //
2
+ // POSCommand.h
3
+ // Printer
4
+ //
5
+
6
+ #import <Foundation/Foundation.h>
7
+ #import "POSImageTranster.h"
8
+
9
+ typedef NS_ENUM(NSInteger, TextWidthRatio) {
10
+ TXT_DEFAULTWIDTH = 0, // 默认
11
+ TXT_1WIDTH = 1, // 将宽度比设置为 x1
12
+ TXT_2WIDTH = 2, // 将宽度比设置为 x2
13
+ TXT_3WIDTH = 3, // 将宽度比设置为 x3
14
+ TXT_4WIDTH = 4, // 将宽度比设置为 x4
15
+ TXT_5WIDTH = 5, // 将宽度比设置为 x5
16
+ TXT_6WIDTH = 6, // 将宽度比设置为 x6
17
+ TXT_7WIDTH = 7, // 将宽度比设置为 x7
18
+ TXT_8WIDTH = 8 // 将宽度比设置为 x8
19
+ };
20
+
21
+ typedef NS_ENUM(NSInteger, TextHeightRatio) {
22
+ TXT_DEFAULTHEIGHT = 0, // 默认
23
+ TXT_1HEIGHT = 1, // 将高度比设置为 x1
24
+ TXT_2HEIGHT = 2, // 将高度比设置为 x2
25
+ TXT_3HEIGHT = 3, // 将高度比设置为 x3
26
+ TXT_4HEIGHT = 4, // 将高度比设置为 x4
27
+ TXT_5HEIGHT = 5, // 将高度比设置为 x5
28
+ TXT_6HEIGHT = 6, // 将高度比设置为 x6
29
+ TXT_7HEIGHT = 7, // 将高度比设置为 x7
30
+ TXT_8HEIGHT = 8 // 将高度比设置为 x8
31
+ };
32
+
33
+ typedef NS_ENUM(NSInteger, TextFontAttribute) {
34
+ FNT_DEFAULT = 0, // 标准字体A
35
+ FNT_FONTB, // FontB 字体
36
+ FNT_BOLD, // 粗字体
37
+ FNT_REVERSE, // 反打印属性
38
+ FNT_UNDERLINE, // 下划线属性
39
+ FNT_UNDERLINE2 // 粗下划线属性
40
+ };
41
+
42
+ typedef NS_ENUM(NSInteger, POSTextAlignment) {
43
+ POS_ALIGNMENT_LEFT, // 左对齐
44
+ POS_ALIGNMENT_CENTER, // 居中对齐
45
+ POS_ALIGNMENT_RIGHT // 右对齐
46
+ };
47
+
48
+ /**
49
+ Pos command
50
+ */
51
+ @interface POSCommand : NSObject
52
+
53
+ /// MARK: - Basic related APIs
54
+
55
+ /**
56
+ * Initialize the printer.
57
+ */
58
+ + (NSData *)initializePrinter;
59
+
60
+ /**
61
+ * Print and feed.
62
+ * @param n length(in inch) to feed.
63
+ */
64
+ + (NSData *)printAndFeed:(int) n;
65
+
66
+ /**
67
+ * Horizontal positioning.
68
+ */
69
+ + (NSData *)horizontalPosition;
70
+
71
+ /**
72
+ * Print and wrap.
73
+ */
74
+ + (NSData *)printAndFeedLine;
75
+
76
+ /**
77
+ * Print and go back to standard mode.
78
+ */
79
+ + (NSData *)printAndBackStandardModel;
80
+
81
+ /**
82
+ * Print and tab.
83
+ */
84
+ + (NSData *)printAndTabs;
85
+
86
+ /**
87
+ * Cancel print data in page mode.
88
+ */
89
+ + (NSData *)canclePrintDataByPageModel;
90
+
91
+ /**
92
+ * Transfer real-time status.
93
+ * @param n 1<=n<=4.
94
+ */
95
+ + (NSData *)sendRealTimeStatus:(int) n;
96
+
97
+ /**
98
+ * Real-time request to printer.
99
+ * @param n 1<=n<=2.
100
+ */
101
+ + (NSData *)requestRealTimeForPrint:(int) n;
102
+
103
+ /**
104
+ * Generate cash box pulses in real time.
105
+ * @param m m=0, or 1;
106
+ * @param t 1<=t<=8.
107
+ */
108
+ + (NSData *)openCashBoxRealTimeWithM:(int) m andT:(int) t;
109
+
110
+ /**
111
+ * Printing in page mode.
112
+ * This command is only valid in page mode.
113
+ */
114
+ + (NSData *)printUnderPageModel;
115
+
116
+ /**
117
+ * Select printer.
118
+ * @param n 0 or 1.
119
+ */
120
+ + (NSData *)selectPrinter:(int) n;
121
+
122
+ /**
123
+ * Select an alignment.
124
+ * @param n Alignment value.
125
+ * @return Data for selecting alignment.
126
+ */
127
+ + (NSData *)selectAlignment:(int) n;
128
+
129
+ /**
130
+ * Print and advance paper n lines.
131
+ * @param n 0~255.
132
+ * @return Data for printing and advancing paper n lines.
133
+ */
134
+ + (NSData *)printAndFeedForwardWhitN:(int) n;
135
+
136
+ /**
137
+ * To select or cancel upside-down printing.
138
+ * @param n Last decision. 1: select, 0: cancel.
139
+ * @return Data for selecting or canceling upside-down printing.
140
+ */
141
+ + (NSData *)selectOrCancleConvertPrintModel:(int) n;
142
+
143
+
144
+ /// MARK: - Set related APIs
145
+
146
+ /**
147
+ * Set absolute print position.
148
+ * @param nL range 0~255, the lower byte of te distance from the beginning of the line.
149
+ * @param nH range 0~255, the higher byte of the distance from the beginning of the line.
150
+ */
151
+ + (NSData *)setAbsolutePrintPositionWithNL:(int) nL andNH:(int) nH;
152
+
153
+ /**
154
+ * Set default line spacing.
155
+ */
156
+ + (NSData *)setDefultLineSpace;
157
+
158
+ /**
159
+ * Set line spacing.
160
+ * @param n range 0~255.
161
+ */
162
+ + (NSData *)setDefultLineSpace:(int) n;
163
+
164
+ /**
165
+ * Set the horizontal tab position.
166
+ * @param data array of tab positions (k<=32), Tab distance=character width*k.
167
+ */
168
+ + (NSData *)setHorizontalTabsPosition:(NSData *)data;
169
+
170
+ /**
171
+ * Set density.
172
+ * @param density 1 - 8
173
+ * @return Data for setting density.
174
+ */
175
+ + (NSData *)setDensity:(int)density;
176
+
177
+ /**
178
+ * Set DIP.
179
+ * @param string DIP string.
180
+ * @return Data for setting DIP.
181
+ */
182
+ + (NSData *)setDIPSettingsWithString:(NSString *)string;
183
+
184
+ /**
185
+ * Set beeper.
186
+ * @param onSwitch Switch for beeper.
187
+ * @return Data for setting beeper.
188
+ */
189
+ + (NSData *)setBeeper:(BOOL)onSwitch;
190
+
191
+ /**
192
+ * Set beeper count after cutter.
193
+ * @param count Beeper count.
194
+ * @param interval Interval * 50ms.
195
+ * @return Data for setting beeper count after cutter.
196
+ */
197
+ + (NSData *)setCutterAndBeeper:(int)count interval:(int)interval;
198
+
199
+ /**
200
+ * Set cash box open.
201
+ * @return Data for setting cash box open.
202
+ */
203
+ + (NSData *)setCashBoxOpen;
204
+
205
+ /**
206
+ * Cancel beeper count after cutter.
207
+ * @return Data for canceling beeper count after cutter.
208
+ */
209
+ + (NSData *)cancelCutterAndBeeper;
210
+
211
+ /**
212
+ * Select or deselect Rotate 90 degrees clockwise.
213
+ * This command is only valid in page mode.
214
+ * @param n 0 or 48 to cancel, 1 or 49 to select.
215
+ */
216
+ + (NSData *)selectOrCancleCW90:(int) n;
217
+
218
+ /**
219
+ * Setting the print area in page mode.
220
+ * @param xL lower byte of the start bit in the x direction.
221
+ * @param xH higher byte of the start bit in the x direction.
222
+ * @param yL lower byte of the start bit in the y direction.
223
+ * @param yH higher byte of the start bit in the y direction.
224
+ * @param dxL lower byte of width in x direction.
225
+ * @param dxH higher byte of width in x direction.
226
+ * @param dyL lower byte of height in y direction.
227
+ * @param dyH higher byte of height in y direction.
228
+ */
229
+ + (NSData *)setPrintAreaUnderPageModelWithxL:(int) xL
230
+ andxH:(int) xH
231
+ andyL:(int) yL
232
+ andyH:(int) yH
233
+ anddxL:(int) dxL
234
+ anddxH:(int) dxH
235
+ anddyL:(int) dyL
236
+ anddyH:(int) dyH;
237
+
238
+ /**
239
+ * Set relative landscape print position.
240
+ * @param nL Lower byte of the set size.
241
+ * @param nH Higher byte of the set size.
242
+ * @return Data for setting relative landscape print position.
243
+ */
244
+ + (NSData *)setRelativeHorizontalPrintPositionWithnL:(int) nL andnH:(int) nH;
245
+
246
+ /**
247
+ * Set double byte language.
248
+ * @param type 0 - 3
249
+ * @return Data for setting double byte language.
250
+ */
251
+ + (NSData *)setDoubleByteLanguageWithType:(int)type;
252
+
253
+ /**
254
+ * Set code page.
255
+ * @param page Page number.
256
+ * @return Data for setting code page.
257
+ */
258
+ + (NSData *)setCodePage:(int)page;
259
+
260
+ /**
261
+ * Turn automatic status return on or off.
262
+ * @param n 0~255, each bit means a different type of status return.
263
+ * @return Data for turning automatic status return on or off.
264
+ */
265
+ + (NSData *)openOrCloseAutoReturnPrintState:(int) n;
266
+
267
+ /**
268
+ * Set left margin.
269
+ * @param nL Lower byte of the left margin.
270
+ * @param nH Higher byte of the left margin.
271
+ * @return Data for setting left margin.
272
+ */
273
+ + (NSData *)setLeftSpaceWithnL:(int) nL andnH:(int) nH;
274
+
275
+ /**
276
+ * Set horizontal and vertical movement units.
277
+ * @param x Horizontal movement unit, 0~255.
278
+ * @param y Vertical movement unit, 0~255.
279
+ * @return Data for setting horizontal and vertical movement units.
280
+ */
281
+ + (NSData *)setHorizontalAndVerticalMoveUnitWithX:(int) x andY:(int) y;
282
+
283
+ /**
284
+ * Set the print area width.
285
+ * @param nL Lower byte of the print area width.
286
+ * @param nH Higher byte of the print area width.
287
+ * @return Data for setting the print area width.
288
+ */
289
+ + (NSData *)setPrintAreaWidthWithnL:(int) nL andnH:(int) nH;
290
+
291
+ /**
292
+ * Set absolute print position in page mode.
293
+ * @param nL Lower byte of the vertical movement distance.
294
+ * @param nH Higher byte of the vertical movement distance.
295
+ * @return Data for setting absolute print position in page mode.
296
+ */
297
+ + (NSData *)setVertivalRelativePositionUnderPageModelWithNL:(int) nL andNH:(int) nH;
298
+
299
+ /**
300
+ * Set absolute position in page mode.
301
+ * @param nL Lower byte of the position.
302
+ * @param nH Higher byte of the position.
303
+ * @return Data for setting absolute position in page mode.
304
+ */
305
+ + (NSData *)setAbsolutePositionUnderPageModelWithnL:(int) nL andnH:(int) nH;
306
+
307
+ /// MARK: - Text related APIs
308
+
309
+ /**
310
+ * Set character right spacing.
311
+ * @param n 0~255, in dots.
312
+ */
313
+ + (NSData *)setCharRightSpace:(int) n;
314
+
315
+ /**
316
+ * Select print mode.
317
+ * @param n 0~255, the last digit of n, 0: cancel, 1: select.
318
+ */
319
+ + (NSData *)selectPrintMode:(int) n;
320
+
321
+ /**
322
+ * Select or cancel user-defined characters.
323
+ * @param n 0~255, the last digit of n, 0: cancel, 1: select.
324
+ */
325
+ + (NSData *)selectOrCancleCustomChar:(int) n;
326
+
327
+ /**
328
+ * Define user-defined characters.
329
+ * @param m range 0, 1, 32, 33, representing different densities of points.
330
+ * @param nL range 0~255, the lower byte of the character code.
331
+ * @param nH range 0~3, the higher byte of the character code.
332
+ * @param bytes character binary data.
333
+ */
334
+ + (NSData *)defineUserDefinedCharactersWithM:(int) m andNL:(int) nL andNH:(int) nH andBytes:(Byte *) bytes;
335
+
336
+ /**
337
+ * Select or deselect underline mode.
338
+ * @param n 0 or 48 to cancel; 1 or 49 to select (by 1 dot); 2 or 50 to select (by 2 dots).
339
+ */
340
+ + (NSData *)selectOrCancleUnderLineModel:(int) n;
341
+
342
+ /**
343
+ * Cancel user-defined characters.
344
+ * Cancel the character with code n in user-defined characters. n range: 32~127.
345
+ * @param n character code to cancel.
346
+ */
347
+ + (NSData *)cancleUserDefinedCharacters:(int) n;
348
+
349
+ /**
350
+ * Select or deselect bold mode.
351
+ * @param n 0~255, the last digit of n, 0 to cancel, 1 to select.
352
+ */
353
+ + (NSData *)selectOrCancleBoldModel:(int) n;
354
+
355
+ /**
356
+ * Select font.
357
+ * @param n 0, 1, 48, 49.
358
+ */
359
+ + (NSData *)selectFont:(int) n;
360
+
361
+ /**
362
+ * Select international character set.
363
+ * @param n 0-15, means an international character set.
364
+ */
365
+ + (NSData *)selectInternationCharacterSets:(int) n;
366
+
367
+ /**
368
+ * Select character size.
369
+ * @param n 0~255, 0-3 for character height, 4-7 for character width.
370
+ * @return Data for selecting character size.
371
+ */
372
+ + (NSData *)selectCharacterSize:(int) n;
373
+
374
+ /**
375
+ * Set the left and right spacing of Chinese characters.
376
+ * @param n1 Left spacing, 0~255.
377
+ * @param n2 Right spacing, 0~255.
378
+ * @return Data for setting the left and right spacing of Chinese characters.
379
+ */
380
+ + (NSData *)setChineseCharLeftAndRightSpaceWithN1:(int) n1 andN2:(int) n2;
381
+
382
+ /**
383
+ * Set Chinese character mode.
384
+ * @param n 0~255, different bits define character patterns.
385
+ * @return Data for setting Chinese character mode.
386
+ */
387
+ + (NSData *)setChineseCharacterModel:(int) n;
388
+
389
+ /**
390
+ * Select Chinese mode.
391
+ * @return Data for selecting Chinese mode.
392
+ */
393
+ + (NSData *)selectChineseCharacterModel;
394
+
395
+ /**
396
+ * Cancel Chinese mode.
397
+ * @return Data for canceling Chinese mode.
398
+ */
399
+ + (NSData *)CancelChineseCharModel;
400
+
401
+ /**
402
+ * Select or cancel the double width and double height of Chinese characters.
403
+ * @param n 0~255, the last digit of n, 1: select; 0: cancel.
404
+ * @return Data for selecting or canceling the double width and double height of Chinese characters.
405
+ */
406
+ + (NSData *)selectOrCancelChineseCharDoubleWH:(int) n;
407
+
408
+ /**
409
+ * Select or cancel Chinese character underline mode.
410
+ * @param n 0~2 or 48~50.
411
+ * @return Data for selecting or canceling Chinese character underline mode.
412
+ */
413
+ + (NSData *)selectOrCancelChineseCharUnderLineModel:(int) n;
414
+
415
+ /**
416
+ * User-defined Chinese characters.
417
+ * @param c2 C2: A1H<=c2<=FEH.
418
+ * @param bytes Byte array of Chinese character.
419
+ * @return Data for defining user-defined Chinese characters.
420
+ */
421
+ + (NSData *)definedUserDefinedChineseCharWithCPosition:(int) c2 andNsdata:(Byte *) bytes;
422
+
423
+
424
+ /**
425
+ * Select or cancel the black and white reverse print mode.
426
+ * @param n The last digit of n. 1: select, 0: cancel.
427
+ * @return Data for selecting or canceling the black and white reverse print mode.
428
+ */
429
+ + (NSData *)selectOrCancleInvertPrintModel:(int) n;
430
+
431
+ /**
432
+ * Select character code table.
433
+ * @return Data for selecting character code table.
434
+ */
435
+ + (NSData *)selectCharacterCodePage:(int) n;
436
+
437
+ /// new:This method is used to print text in a specific format
438
+ + (NSData *)setTextSize:(int)width height:(int)height;
439
+
440
+ + (NSData *)printText:(NSString *)data alignment:(int)alignment attribute:(int)attribute textWid:(int)textWid textHei:(int)textHei;
441
+
442
+ + (NSData *)printTextSize:(NSString *)data textWid:(int)textWid textHei:(int)textHei;
443
+
444
+ + (NSData *)printTextAttribute:(NSString *)data attribute:(int)attribute;
445
+
446
+ + (NSData *)printTextAlignment:(NSString *)data alignment:(int)alignment;
447
+
448
+ /// MARK: - QRCode related API
449
+
450
+ /**
451
+ * QRCODE: Set cell size.
452
+ * @param n 0~16.
453
+ * @return Data for setting cell size for QR code.
454
+ */
455
+ + (NSData *)setQRcodeUnitsize:(int) n;
456
+
457
+ /**
458
+ * Set error correction level for QR code.
459
+ * @param n Error correction level: L:48 M:49 Q:50 H:51.
460
+ * @return Data for setting error correction level for QR code.
461
+ */
462
+ + (NSData *)setErrorCorrectionLevelForQrcode:(int) n;
463
+
464
+ /**
465
+ * Transfer data to encoding buffer for QR code.
466
+ * @param str QR code content.
467
+ * @param strEnCoding String encoding.
468
+ * @return Data for transferring data to encoding buffer for QR code.
469
+ */
470
+ + (NSData *)sendDataToStoreAreaWitQrcodeConent:(NSString *) str usEnCoding:(NSStringEncoding) strEnCoding;
471
+
472
+ /**
473
+ * Print the QR code of the encoded cache.
474
+ * @return Data for printing the QR code in the store.
475
+ */
476
+ + (NSData *)printTheQRcodeInStore;
477
+
478
+ /**
479
+ * Print QR code.
480
+ * @param n 0~16.
481
+ * @param errLevel Error correction level: L:48 M:49 Q:50 H:51.
482
+ * @param code QR code content.
483
+ * @param strEncoding String encoding.
484
+ * @return Data for printing QR code.
485
+ */
486
+ + (NSData *)printQRCode:(int )n level:(int)errLevel code:(NSString *)code useEnCodeing:(NSStringEncoding)strEncoding;
487
+
488
+ /**
489
+ * Set the number of columns in the data region for PDF417.
490
+ * @param n Number of columns.
491
+ * @return Data for setting the number of columns in the data region for PDF417.
492
+ */
493
+ + (NSData *)setPdf417Columns:(int) n;
494
+
495
+ /**
496
+ * Set the width of the module for PDF417.
497
+ * @param n Width of the module.
498
+ * @return Data for setting the width of the module for PDF417.
499
+ */
500
+ + (NSData *)setpdf417WidthOfModule:(int) n;
501
+
502
+ /**
503
+ * Set the row height for PDF417.
504
+ * @param n Row height.
505
+ * @return Data for setting the row height for PDF417.
506
+ */
507
+ + (NSData *)setpdf417RowHeight:(int) n;
508
+
509
+ /**
510
+ * Store the data in the symbol storage area for PDF417.
511
+ * @param pL Lower byte of the data length.
512
+ * @param pH Higher byte of the data length.
513
+ * @param content Content to store.
514
+ * @param strEnCoding String encoding.
515
+ * @return Data for storing PDF417 data in the symbol storage area.
516
+ */
517
+ + (NSData *)storethepdf417WithpL:(int) pL andpH:(int) pH andContent:(NSString*) content usEnCoding:(NSStringEncoding) strEnCoding;
518
+
519
+ /**
520
+ * Print the PDF417 symbol data in the symbol storage area.
521
+ * @return Data for printing the PDF417 symbol data in the symbol storage area.
522
+ */
523
+ + (NSData *)printPdf417InStore;
524
+
525
+
526
+ /// MARK: - Barcode related API
527
+
528
+ /**
529
+ * Select HRI font.
530
+ * @param n 0 or 48 for normal; 1 or 49 for compression.
531
+ * @return Data for selecting HRI font.
532
+ */
533
+ + (NSData *)selectHRIFont:(int) n;
534
+
535
+ /**
536
+ * Select barcode height.
537
+ * GS h n (0x1D 0x68 n)
538
+ * @param n 1~255, default: 162.
539
+ * @return Data for selecting barcode height.
540
+ */
541
+ + (NSData *)setBarcodeHeight:(int) n;
542
+
543
+ /**
544
+ * Print barcode.
545
+ * @param m Barcode type, 0~6.
546
+ * @param content Barcode content.
547
+ * @param strEncoding String encoding.
548
+ * @return Data for printing barcode.
549
+ */
550
+ + (NSData *)printBarcodeWithM:(int) m andContent:(NSString *) content useEnCodeing:(NSStringEncoding) strEncoding;
551
+
552
+ /**
553
+ * Print barcode.
554
+ * @param m Barcode type, 66~73.
555
+ * @param n Barcode content's width.
556
+ * @param content Barcode content.
557
+ * @param strEncoding String encoding.
558
+ * @return Data for printing barcode.
559
+ */
560
+ + (NSData *)printBarcodeWithM:(int)m andN:(int) n andContent:(NSString *)content useEnCodeing:(NSStringEncoding) strEncoding;
561
+
562
+ /**
563
+ * Set barcode width.
564
+ * @param n 2~6, default 3.
565
+ * @return Data for setting barcode width.
566
+ */
567
+ + (NSData *)setBarcodeWidth:(int) n;
568
+
569
+ /**
570
+ * Select the HRI character print position.
571
+ * @param n 0~3 or 48~51, means the printing position of the characters relative to the barcode.
572
+ * @return Data for selecting the HRI character print position.
573
+ */
574
+ + (NSData *)selectHRICharactersPrintPosition:(int) n;
575
+
576
+ /// MARK: - Image related APIs
577
+
578
+ /**
579
+ * Print raster bitmap.
580
+ * @param m Print mode.
581
+ * @param image Image instance.
582
+ * @param type Dither or threshold.
583
+ * @return Data for printing raster bitmap.
584
+ */
585
+ + (NSData *)printRasteBmpWithM:(PrintRasterType) m andImage:(UIImage *) image andType:(BmpType) type;
586
+
587
+ /**
588
+ * Select bitmap mode.
589
+ * @param m range 0, 1, 32, 33, representing different densities of points.
590
+ * @param nL range 0~255, the lower byte of the number of dots.
591
+ * @param nH range 0~3, the higher byte of the number of dots.
592
+ * @param data bitmap data.
593
+ */
594
+ + (NSData *)selectBmpModelWithM:(int) m andnL:(int) nL andnH:(int) nH andNSData:(NSData *)data;
595
+
596
+
597
+ /**
598
+ * Print compressionP bitmap.
599
+ * @param m Print mode.
600
+ * @param image Image instance.
601
+ * @param type BmpType: dither or threshold.
602
+ * @return Data for printing compression bitmap.
603
+ */
604
+ + (NSData *)compressionPrintBmpWithM:(PrintRasterType) m andImage:(UIImage *) image andType:(BmpType) type;
605
+
606
+ /**
607
+ * Print bitmap downloaded to flash.
608
+ * @param n Image at n position in flash cache.
609
+ * @param m Print flash bitmap way, 0~3 or 48~51, means normal, double width, double height, double width and height.
610
+ * @return Data for printing bitmap downloaded to flash.
611
+ */
612
+ + (NSData *)printBmpInFLASHWithN:(int) n andM:(int) m;
613
+
614
+ /**
615
+ * Define flash bitmap.
616
+ * @param n Define bitmap counts.
617
+ * @param image Image data.
618
+ * @param bmptype Bitmap type.
619
+ * @param type Print raster type.
620
+ * @param paperheight Paper height.
621
+ * @return Data for defining flash bitmap.
622
+ */
623
+ + (NSData *)definedFlashBmpWithN:(int)n andBmp:(UIImage *)image andBmpType:(BmpType) bmptype andPrintType:(PrintRasterType) type andPaperHeight:(int) paperheight;
624
+
625
+ /**
626
+ * Print download bitmap.
627
+ * @param m Print mode, range: 0~3 or 48~51.
628
+ * @return Data for printing download bitmap.
629
+ */
630
+ + (NSData *)printDownLoadBmp:(int) m;
631
+
632
+ /**
633
+ * Define download bitmap.
634
+ * @param image Image data.
635
+ * @param bmptype Bitmap type.
636
+ * @return Data for defining download bitmap.
637
+ */
638
+ + (NSData *)definedDownLoadBmp:(UIImage *)image byType:(BmpType) bmptype;
639
+
640
+ /// MARK: - Pattern related APIs
641
+
642
+ /**
643
+ * Select or cancel dual printing mode.
644
+ * @param n 0~255, the last digit of n, 0 to cancel, 1 to select.
645
+ */
646
+ + (NSData *)selectOrCancleDoublePrintMode:(int) n;
647
+
648
+ /**
649
+ * Select page mode.
650
+ */
651
+ + (NSData *)selectPagemode;
652
+
653
+ /**
654
+ * Select standard mode.
655
+ */
656
+ + (NSData *)selectStabdardMode;
657
+
658
+ /**
659
+ * Select the print area orientation in page mode.
660
+ * @param n 0<=n<=3 or 48<=n<=51, n specifies the orientation and starting position of the print area.
661
+ */
662
+ + (NSData *)selectPrintDirectionUnderPageMode:(int) n;
663
+
664
+ /**
665
+ * Select the cut paper mode and cut the paper.
666
+ * @param m 0 or 48 for full cut; 1 or 49 for half cut.
667
+ * @return Data for selecting the cut paper mode and cutting the paper.
668
+ */
669
+ + (NSData *)selectCutPageModelAndCutpage:(int) m;
670
+
671
+ /**
672
+ * Select the cut paper mode and cut the paper.
673
+ * @param m M=66.
674
+ * @param n Paper feed n, and half cut paper.
675
+ * @return Data for selecting the cut paper mode and cutting the paper.
676
+ */
677
+ + (NSData *)selectCutPageModelAndCutpageWithM:(int) m andN:(int) n;
678
+
679
+
680
+ /// MARK: - Query related APIs
681
+
682
+ /**
683
+ * Return status.
684
+ * @param n 1, 2, 49, 50; 1 or 49 for returning sensor status, 2 or 50 for returning cash box status.
685
+ * @return Data for returning status.
686
+ */
687
+ + (NSData *)returnState:(int) n;
688
+
689
+
690
+ /// MARK: - Other related APIs
691
+
692
+ /**
693
+ * Select the printer sensor to output the paper-cut signal.
694
+ * @param n 0~255.
695
+ * @return Data for selecting the printer sensor to output the paper-cut signal.
696
+ */
697
+ + (NSData *)selectPrintTransducerOutPutPageOutSignal:(int) n;
698
+
699
+ /**
700
+ * Select Printer Sensor - Stop Printing.
701
+ * @param n 0~255.
702
+ * @return Data for selecting Printer Sensor - Stop Printing.
703
+ */
704
+ + (NSData *)selectPrintTransducerStopPrint:(int) n;
705
+
706
+ /**
707
+ * The printer beeps for a single print.
708
+ * @param n Beeps counts, 1~9.
709
+ * @param t T*50ms means every beep time, 1~9.
710
+ * @return Data for the printer beeping for a single print.
711
+ */
712
+ + (NSData *)printerOrderBuzzingHintWithRes:(int) n andTime:(int) t;
713
+
714
+ /**
715
+ * The printer beeps and the alarm light flashes.
716
+ * @param m Number of beeps, number of flashes of alarm light, 1~20.
717
+ * @param t (T*50ms) interval, 1~20.
718
+ * @param n 0~3, 0: no beep no flash; 1: beep; 2: flash, 3: beep and flash.
719
+ * @return Data for the printer beeping and the alarm light flashing.
720
+ */
721
+ + (NSData *)printerOrderBuzzingAndWaringLightWithM:(int) m andT:(int) t andN:(int) n;
722
+
723
+ /**
724
+ * Allow or disallow keystrokes.
725
+ * @param n Last decision. 1: allow, 0: forbid.
726
+ * @return Data for allowing or disallowing keystrokes.
727
+ */
728
+ + (NSData *)allowOrForbidPressButton:(int) n;
729
+
730
+ /**
731
+ * Generate cash box control pulses.
732
+ * @param t1 0~255.
733
+ * @param t2 0~255.
734
+ * @return Data for generating cash box control pulses.
735
+ */
736
+ + (NSData *)creatCashBoxContorPulseWithM:(int) m andT1:(int) t1 andT2:(int) t2;
737
+
738
+
739
+ /**
740
+ * Execute macro command.
741
+ * @param r Execute counts, 0~255.
742
+ * @param t Execute wait time, 0~255.
743
+ * @param m Execute model, 0 or 1.
744
+ * @return Data for executing macro command.
745
+ */
746
+ + (NSData *)executeMacrodeCommandWithR:(int) r andT:(int) t andM:(int) m;
747
+
748
+ /**
749
+ * Start or end macro definition.
750
+ * @return Data for starting or ending macro definition.
751
+ */
752
+ + (NSData *)startOrStopMacrodeFinition;
753
+
754
+ /**
755
+ * Execute printer data hex dump.
756
+ * @return Data for executing printer data hex dump.
757
+ */
758
+ + (NSData *)executePrintDataSavaByTeansformToHex;
759
+
760
+ @end