@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,516 @@
1
+ import { type TurboModule, TurboModuleRegistry } from 'react-native';
2
+
3
+ export interface Spec extends TurboModule {
4
+ setCharSet(connectInfo: string, charSet: CharSet): Promise<void>;
5
+
6
+ //only ios
7
+ selectInternationCharacterSets(
8
+ connectInfo: string,
9
+ n: InternationCharacterSet
10
+ ): Promise<void>;
11
+
12
+ //only ios
13
+ isConnect(connectInfo: string): Promise<boolean>;
14
+
15
+ initializePrinter(connectInfo: string): Promise<void>;
16
+
17
+ printString(connectInfo: string, data: string): Promise<void>;
18
+
19
+ printTextSize(
20
+ connectInfo: string,
21
+ payload: PrintTextSizeRequest
22
+ ): Promise<void>;
23
+
24
+ printTextAttribute(
25
+ connectInfo: string,
26
+ data: string,
27
+ attribute: TextAttribute
28
+ ): Promise<void>;
29
+
30
+ printTextAlignment(
31
+ connectInfo: string,
32
+ //使用对齐方式时,data 需以”\n”结尾,否则有可能会无效
33
+ data: string,
34
+ alignment: Alignment
35
+ ): Promise<void>;
36
+
37
+ printText(connectInfo: string, payload: PrintTextRequest): Promise<void>;
38
+
39
+ printBitmap(connectInfo: string, payload: PrintBitmapRequest): Promise<void>;
40
+
41
+ compressionPrintBitmap(
42
+ connectInfo: string,
43
+ payload: PrintBitmapRequest
44
+ ): Promise<void>;
45
+
46
+ printBarCode(
47
+ connectInfo: string,
48
+ payload: PrintBarCodeRequest
49
+ ): Promise<void>;
50
+
51
+ lineFeed(connectInfo: string, lineCount: number): Promise<void>;
52
+
53
+ feedDot(connectInfo: string, dotCount: number): Promise<void>;
54
+
55
+ printerCheck(
56
+ connectInfo: string,
57
+ type: PrinterCheckType,
58
+ timeout: number
59
+ ): Promise<{
60
+ debugArray?: number[] | null;
61
+ status: PrinterCheckStatus;
62
+ }>;
63
+
64
+ printerStatus(connectInfo: string): Promise<{
65
+ status: PrinterStatus;
66
+ debugCode?: number;
67
+ }>;
68
+
69
+ printerStatusII(connectInfo: string): Promise<{
70
+ status: PrinterStatusII;
71
+ debugCode?: number;
72
+ }>;
73
+
74
+ printQRCode(connectInfo: string, payload: PrintQRCodeRequest): Promise<void>;
75
+
76
+ cutPaper(connectInfo: string, model: CutModel): Promise<void>;
77
+
78
+ cutHalfAndFeed(connectInfo: string, distance: number): Promise<void>;
79
+
80
+ setPrintArea(
81
+ connectInfo: string,
82
+ payload: SetPrintAreaRequest
83
+ ): Promise<void>;
84
+
85
+ setPageModel(connectInfo: string, isOpen: boolean): Promise<void>;
86
+
87
+ printPageModelData(connectInfo: string): Promise<void>;
88
+
89
+ setPrintDirection(connectInfo: string, direction: Direction): Promise<void>;
90
+
91
+ setAbsoluteHorizontal(connectInfo: string, position: number): Promise<void>;
92
+
93
+ setRelativeHorizontal(connectInfo: string, position: number): Promise<void>;
94
+
95
+ setAbsoluteVertical(connectInfo: string, position: number): Promise<void>;
96
+
97
+ setRelativeVertical(connectInfo: string, position: number): Promise<void>;
98
+
99
+ setTextStyle(
100
+ connectInfo: string,
101
+ payload: SetTextStyleRequest
102
+ ): Promise<void>;
103
+
104
+ setAlignment(connectInfo: string, alignment: Alignment): Promise<void>;
105
+
106
+ downloadNVImage(
107
+ connectInfo: string,
108
+ //图片绝对路径,不同的图片用“,”隔开。
109
+ imagePaths: string,
110
+ imageWidth: number
111
+ ): Promise<void>;
112
+
113
+ //only android
114
+ clearNVImage(connectInfo: string): Promise<void>;
115
+
116
+ printNVImage(
117
+ connectInfo: string,
118
+ //图片下标 [1,255]
119
+ index: number,
120
+ model: BMPModel
121
+ ): Promise<void>;
122
+
123
+ selectBitmapModel(
124
+ connectInfo: string,
125
+ payload: SelectBitmapModelRequest
126
+ ): Promise<void>;
127
+
128
+ setLineSpacing(connectInfo: string, space: number): Promise<void>;
129
+
130
+ setTurnUpsideDownMode(connectInfo: string, on: boolean): Promise<void>;
131
+
132
+ /**
133
+ * @param connectInfo
134
+ * @param page
135
+ * 需要查看文档有具体的对应值
136
+ */
137
+ selectCodePage(connectInfo: string, page: number): Promise<void>;
138
+
139
+ selectCharacterFont(connectInfo: string, font: FontType): Promise<void>;
140
+
141
+ printPDF417(connectInfo: string, payload: PrintPDF417Request): Promise<void>;
142
+
143
+ printTable(connectInfo: string, payload: PrintTableRequest): Promise<void>;
144
+
145
+ wifiConfig(connectInfo: string, payload: WifiConfigRequest): Promise<void>;
146
+
147
+ //only android
148
+ setIp(connectInfo: string, ip: string): Promise<void>;
149
+
150
+ //only android
151
+ setMask(connectInfo: string, mask: string): Promise<void>;
152
+
153
+ //only android
154
+ setGateway(connectInfo: string, gateway: string): Promise<void>;
155
+
156
+ setNetAll(connectInfo: string, payload: SetNetAllRequest): Promise<void>;
157
+
158
+ setBluetooth(connectInfo: string, name: string, pin: string): Promise<void>;
159
+
160
+ //
161
+ getSerialNumber(connectInfo: string): Promise<string>;
162
+ }
163
+
164
+ export const NativeXPrinterESC =
165
+ TurboModuleRegistry.getEnforcing<Spec>('NativeXPrinterESC');
166
+
167
+ export enum CharSet {
168
+ GBK = 'GBK',
169
+ UTF_8 = 'UTF-8',
170
+ }
171
+
172
+ export enum TextWidth {
173
+ TXT_1_WIDTH = 'TXT_1_WIDTH',
174
+ TXT_2_WIDTH = 'TXT_2_WIDTH',
175
+ TXT_3_WIDTH = 'TXT_3_WIDTH',
176
+ TXT_4_WIDTH = 'TXT_4_WIDTH',
177
+ TXT_5_WIDTH = 'TXT_5_WIDTH',
178
+ TXT_6_WIDTH = 'TXT_6_WIDTH',
179
+ TXT_7_WIDTH = 'TXT_7_WIDTH',
180
+ TXT_8_WIDTH = 'TXT_8_WIDTH',
181
+ }
182
+
183
+ export enum TextHeight {
184
+ TXT_1_HEIGHT = 'TXT_1_HEIGHT',
185
+ TXT_2_HEIGHT = 'TXT_2_HEIGHT',
186
+ TXT_3_HEIGHT = 'TXT_3_HEIGHT',
187
+ TXT_4_HEIGHT = 'TXT_4_HEIGHT',
188
+ TXT_5_HEIGHT = 'TXT_5_HEIGHT',
189
+ TXT_6_HEIGHT = 'TXT_6_HEIGHT',
190
+ TXT_7_HEIGHT = 'TXT_7_HEIGHT',
191
+ TXT_8_HEIGHT = 'TXT_8_HEIGHT',
192
+ }
193
+
194
+ export enum TextAttribute {
195
+ DEFAULT = 'DEFAULT',
196
+ FONTB = 'FONTB',
197
+ BOLD = 'BOLD',
198
+ REVERSE = 'REVERSE',
199
+ UNDERLINE = 'UNDERLINE',
200
+ UNDERLINE2 = 'UNDERLINE2',
201
+ }
202
+
203
+ export enum Alignment {
204
+ LEFT = 'LEFT',
205
+ CENTER = 'CENTER',
206
+ RIGHT = 'RIGHT',
207
+ }
208
+
209
+ export enum BMPModel {
210
+ NORMAL = 'NORMAL',
211
+ WIDTH_DOUBLE = 'WIDTH_DOUBLE',
212
+ HEIGHT_DOUBLE = 'HEIGHT_DOUBLE',
213
+ WIDTH_HEIGHT_DOUBLE = 'WIDTH_HEIGHT_DOUBLE',
214
+ }
215
+
216
+ export enum BMPType {
217
+ DITHERING = 'DITHERING',
218
+ THRESHOLD = 'THRESHOLD',
219
+ }
220
+
221
+ export enum BarcodeType {
222
+ UPCA = 'UPCA',
223
+ UPCE = 'UPCE',
224
+ EAN8 = 'EAN8',
225
+ EAN13 = 'EAN13',
226
+ JAN8 = 'JAN8',
227
+ JAN13 = 'JAN13',
228
+ ITF = 'ITF',
229
+ CODEBAR = 'CODEBAR',
230
+ CODE39 = 'CODE39',
231
+ CODE93 = 'CODE93',
232
+ //Code 128 类型,该类型时,data 必须加上{A, {B,{C 等
233
+ CODE128 = 'CODE128',
234
+ }
235
+
236
+ export enum TextPosition {
237
+ NONE = 'NONE',
238
+ ABOVE = 'ABOVE',
239
+ BELOW = 'BELOW',
240
+ BOTH = 'BOTH',
241
+ }
242
+
243
+ export enum PrinterCheckType {
244
+ PRINT = 'PRINT',
245
+ OFFLINE = 'OFFLINE',
246
+ ERR = 'ERR',
247
+ PAPER = 'PAPER',
248
+ }
249
+
250
+ export enum PrinterCheckStatus {
251
+ START_READ_LOOP_RETURN = 'START_READ_LOOP_RETURN',
252
+ DISCONNECT = 'DISCONNECT',
253
+ TIMEOUT = 'TIMEOUT',
254
+ UNKNOWN = 'UNKNOWN',
255
+ }
256
+
257
+ export enum PrinterStatus {
258
+ NORMAL = 'NORMAL',
259
+ COVER_OPEN = 'COVER_OPEN',
260
+ PRESS_FEED = 'PRESS_FEED',
261
+ PAPER_EMPTY = 'PAPER_EMPTY',
262
+ PRINTER_ERR = 'PRINTER_ERR',
263
+ COVER_OPEN_AND_PAPER_EMPTY = 'COVER_OPEN_AND_PAPER_EMPTY',
264
+ OTHER_ERROR = 'OTHER_ERROR',
265
+ DISCONNECT = 'DISCONNECT',
266
+ TIMEOUT = 'TIMEOUT',
267
+ UNKNOWN = 'UNKNOWN',
268
+ }
269
+
270
+ export enum PrinterStatusII {
271
+ NORMAL = 'NORMAL',
272
+ PRINTER = 'PRINTING',
273
+ COVER_OPEN = 'COVER_OPEN',
274
+ PAPER_EMPTY = 'PAPER_EMPTY',
275
+ PAPER_IS_OVER = 'PAPER_IS_OVER',
276
+ MONEY_BOX_OPEN = 'MONEY_BOX_OPEN',
277
+ OTHER_ERROR = 'OTHER_ERROR',
278
+ CUTTING_ERROR = 'CUTTING_ERROR',
279
+ PRINT_HEAD_OVERHEATING = 'PRINT_HEAD_OVERHEATING',
280
+ DISCONNECT = 'DISCONNECT',
281
+ TIMEOUT = 'TIMEOUT',
282
+ UNKNOWN = 'UNKNOWN',
283
+ }
284
+
285
+ export enum PingPrinterStatus {
286
+ NORMAL = 'NORMAL',
287
+ PRINTER_IS_BUSY = 'PRINTER_IS_BUSY',
288
+ COVER_OPEN = 'COVER_OPEN',
289
+ PAPER_EMPTY = 'PAPER_EMPTY',
290
+ OTHER_ERROR = 'OTHER_ERROR',
291
+ CUTTING_ERROR = 'CUTTING_ERROR',
292
+ PRINT_HEAD_OVERHEATING = 'PRINT_HEAD_OVERHEATING',
293
+ DISCONNECT = 'DISCONNECT',
294
+ TIMEOUT = 'TIMEOUT',
295
+ UNKNOWN = 'UNKNOWN',
296
+ }
297
+
298
+ export enum ECLevel {
299
+ LEVEL_L = 'LEVEL_L',
300
+ LEVEL_M = 'LEVEL_M',
301
+ LEVEL_Q = 'LEVEL_Q',
302
+ LEVEL_H = 'LEVEL_H',
303
+ }
304
+
305
+ export enum CutModel {
306
+ CUT_ALL = 'CUT_ALL',
307
+ CUT_HALF = 'CUT_HALF',
308
+ }
309
+
310
+ export enum Direction {
311
+ LEFT_TOP = 'LEFT_TOP',
312
+ LEFT_BOTTOM = 'LEFT_BOTTOM',
313
+ RIGHT_BOTTOM = 'RIGHT_BOTTOM',
314
+ RIGHT_TOP = 'RIGHT_TOP',
315
+ }
316
+
317
+ export enum SelectBitmapModel {
318
+ SINGLE_DENSITY_8 = 'SINGLE_DENSITY_8',
319
+ DOUBLE_DENSITY_8 = 'DOUBLE_DENSITY_8',
320
+ SINGLE_DENSITY_24 = 'SINGLE_DENSITY_24',
321
+ DOUBLE_DENSITY_24 = 'DOUBLE_DENSITY_24',
322
+ }
323
+
324
+ export enum FontType {
325
+ STANDARD = 'STANDARD',
326
+ COMPRESS = 'COMPRESS',
327
+ }
328
+
329
+ export enum WifiEncrypt {
330
+ NULL = 'NULL',
331
+ WEP64 = 'WEP64',
332
+ WEP128 = 'WEP128',
333
+ WPA_AES_PSK = 'WPA_AES_PSK',
334
+ WPA_TKIP_PSK = 'WPA_TKIP_PSK',
335
+ WPA_TKIP_AES_PSK = 'WPA_TKIP_AES_PSK',
336
+ WPA2_AES_PSK = 'WPA2_AES_PSK',
337
+ WPA2_TKIP = 'WPA2_TKIP',
338
+ WPA2_TKIP_AES_PSK = 'WPA2_TKIP_AES_PSK',
339
+ WPA_WPA2_MixedMode = 'WPA_WPA2_MixedMode',
340
+ }
341
+
342
+ export enum InternationCharacterSet {
343
+ AMERICA = 'AMERICA',
344
+ FRANCE = 'FRANCE',
345
+ GERMANY = 'GERMANY',
346
+ ENGLAND = 'ENGLAND',
347
+ DENMARK1 = 'DENMARK1',
348
+ SWEDEN = 'SWEDEN',
349
+ ITALY = 'ITALY',
350
+ SPAIN1 = 'SPAIN1',
351
+ JAPAN = 'JAPAN',
352
+ NORWAY = 'NORWAY',
353
+ DENMARK2 = 'DENMARK2',
354
+ SPAIN2 = 'SPAIN2',
355
+ LATIN_AMERICA = 'LATIN_AMERICA',
356
+ KOREA = 'KOREA',
357
+ SLOVENIA_OR_CROATIA = 'SLOVENIA_OR_CROATIA',
358
+ CHINA = 'CHINA',
359
+ }
360
+
361
+ export interface PrintTextSizeRequest {
362
+ data: string;
363
+ textWidth: TextWidth;
364
+ textHeight: TextHeight;
365
+ }
366
+
367
+ export interface PrintTextRequest {
368
+ //使用对齐方式时,data 需以”\n”结尾,否则有可能会无效
369
+ data: string;
370
+ alignment: Alignment;
371
+ attribute: TextAttribute;
372
+ textWidth: TextWidth;
373
+ textHeight: TextHeight;
374
+ }
375
+
376
+ export type PrintBitmapRequest = {
377
+ alignment: Alignment;
378
+ width: number;
379
+ model: BMPModel;
380
+ type?: BMPType; //only ios
381
+ bitmapPath: string | null;
382
+ bitmapContent: string | null;
383
+ };
384
+
385
+ export interface PrintBarCodeRequest {
386
+ data: string;
387
+ codeType: BarcodeType;
388
+ //[2,6]
389
+ width: number;
390
+ //[1,255]
391
+ height: number;
392
+ alignment: Alignment;
393
+ textPosition: TextPosition;
394
+ }
395
+
396
+ export interface PrintQRCodeRequest {
397
+ data: string;
398
+ //[1,16]
399
+ moduleSize: number;
400
+ ecLevel: ECLevel;
401
+ alignment: Alignment;
402
+ }
403
+
404
+ export interface SetPrintAreaRequest {
405
+ //默认为 0
406
+ x: number;
407
+ //默认为 0
408
+ y: number;
409
+ width: number;
410
+ height: number;
411
+ }
412
+
413
+ export interface SetTextStyleRequest {
414
+ //only android
415
+ attribute: TextAttribute;
416
+ textWidth: TextWidth;
417
+ textHeight: TextHeight;
418
+ }
419
+
420
+ export interface SelectBitmapModelRequest {
421
+ bitmapPath: string;
422
+ width: number;
423
+ model: SelectBitmapModel;
424
+ }
425
+
426
+ export interface PrintPDF417Request {
427
+ data: string;
428
+ //[2- 8]
429
+ cellWidth: number;
430
+ //[2-8]
431
+ cellHeightRatio: number;
432
+ //[0-30]
433
+ numberOfColumns: number;
434
+ //[0, 3-90]
435
+ //only android
436
+ numberOfRows: number;
437
+ //错误纠正等级类型
438
+ // 范围[0-1]。
439
+ // 0:误差校正级别由级别来设定 1:误差校正级别由比率设定。比率为 eclValue x 10%
440
+ //only android
441
+ eclType: number;
442
+ //错误纠正等级值
443
+ // eclType = 0 :范围[ 0 – 8 ].
444
+ // eclType = 1 :范围[ 1 – 40 ].
445
+ //only android
446
+ eclValue: number;
447
+ alignment: Alignment;
448
+ }
449
+
450
+ //表的列宽是以单字节字符为 1 个单位来统计的,例如字母‘a’的宽度为 1,中 文的‘印’的宽度为 2。
451
+ // 如果需要换行可再文本中加入‘\n’。 如果文本宽度大于设定的列宽,会自动换行。
452
+ export interface PrintTableRequest {
453
+ //标题数组集合
454
+ titles: string[];
455
+ //各列中单字节字符数量集合
456
+ numberOfSingleBytesPerCol: number[];
457
+ //各列的对齐方式,0 左对齐 1 右对齐。 默认为 0。
458
+ align: number[];
459
+ rows?: PrintTableRow[];
460
+ }
461
+
462
+ export interface PrintTableRow {
463
+ title?: string;
464
+ data: string[];
465
+ remark?: string;
466
+ barcode?: PrintTableBarcode;
467
+ }
468
+
469
+ export interface PrintTableBarcode {
470
+ data: string;
471
+ codeType: BarcodeType;
472
+ //[1,255] 默认 80
473
+ width: number;
474
+ //[2,6] 默认 2
475
+ height: number;
476
+ alignment: Alignment;
477
+ textPosition: TextPosition;
478
+ }
479
+
480
+ export interface WifiConfigRequest {
481
+ ip: string;
482
+ mask: string;
483
+ gateway: string;
484
+ ssid: string;
485
+ password: string;
486
+ encrypt: WifiEncrypt;
487
+ }
488
+
489
+ export interface SetNetAllRequest {
490
+ ip: string;
491
+ mask: string;
492
+ gateway: string;
493
+ dhcpIsOpen: boolean;
494
+ }
495
+
496
+ export const DEFAULT_TEXT_ATTRIBUTE = TextAttribute.DEFAULT;
497
+
498
+ export const DEFAULT_TEXT_ALIGNMENT = Alignment.LEFT;
499
+
500
+ export const DEFAULT_TEXT_POSITION = TextPosition.BELOW;
501
+
502
+ export const DEFAULT_BARCODE_HEIGHT = 162;
503
+ export const DEFAULT_BARCODE_WIDTH = 3;
504
+
505
+ export const DEFAULT_LINE_COUNT = 1;
506
+
507
+ export const DEFAULT_QRCODE_MODULE_SIZE = 8;
508
+ export const DEFAULT_QRCODE_ALIGNMENT = Alignment.CENTER;
509
+
510
+ export const DEFAULT_PRINT_TABLE_BARCODE_WIDTH = 80;
511
+ export const DEFAULT_PRINT_TABLE_BARCODE_HEIGHT = 2;
512
+ export const DEFAULT_PRINT_TABLE_ALIGNMENT = Alignment.LEFT;
513
+
514
+ // export const STS_UNKNOWN = -1;
515
+ // export const STS_CASH_OPEN = 0;
516
+ // export const STS_CASH_CLOSE = 1;