@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.
- package/LICENSE +20 -0
- package/NativeXPrinter.podspec +23 -0
- package/README.md +24 -0
- package/android/build.gradle +73 -0
- package/android/gradle.properties +5 -0
- package/android/libs/printer-lib-3.4.7.aar +0 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/connexup/xprinter/Errors.kt +11 -0
- package/android/src/main/java/com/connexup/xprinter/Util.kt +106 -0
- package/android/src/main/java/com/connexup/xprinter/XPrinterPackage.kt +77 -0
- package/android/src/main/java/com/connexup/xprinter/esc/Convert.kt +211 -0
- package/android/src/main/java/com/connexup/xprinter/esc/XPrinterESCModule.kt +1995 -0
- package/android/src/main/java/com/connexup/xprinter/printer/Convert.kt +46 -0
- package/android/src/main/java/com/connexup/xprinter/printer/DeviceConnection.kt +14 -0
- package/android/src/main/java/com/connexup/xprinter/printer/Printers.kt +153 -0
- package/android/src/main/java/com/connexup/xprinter/printer/XPrinterPrinterModule.kt +295 -0
- package/android/src/main/java/com/connexup/xprinter/tspl/Convert.kt +151 -0
- package/android/src/main/java/com/connexup/xprinter/tspl/XPrinterTSPLModule.kt +1408 -0
- package/android/src/main/java/com/connexup/xprinter/utils/XPrinterUtilsModule.kt +54 -0
- package/ios/ESC/ESCConvert.swift +283 -0
- package/ios/ESC/Models/RCTESCPrintBarCodeRequest.swift +23 -0
- package/ios/ESC/Models/RCTESCPrintBitmapRequest.swift +23 -0
- package/ios/ESC/Models/RCTESCPrintPDF417Request.swift +27 -0
- package/ios/ESC/Models/RCTESCPrintQRCodeRequest.swift +19 -0
- package/ios/ESC/Models/RCTESCPrintTableBarcode.swift +23 -0
- package/ios/ESC/Models/RCTESCPrintTableRequest.swift +19 -0
- package/ios/ESC/Models/RCTESCPrintTableRow.swift +19 -0
- package/ios/ESC/Models/RCTESCPrintTextRequest.swift +21 -0
- package/ios/ESC/Models/RCTESCPrintTextSizeRequest.swift +17 -0
- package/ios/ESC/Models/RCTESCSelectBitmapModelRequest.swift +17 -0
- package/ios/ESC/Models/RCTESCSetNetAllRequest.swift +19 -0
- package/ios/ESC/Models/RCTESCSetPrintAreaRequest.swift +19 -0
- package/ios/ESC/Models/RCTESCSetTextStyleRequest.swift +17 -0
- package/ios/ESC/Models/RCTESCWifiConfigRequest.swift +23 -0
- package/ios/ESC/NativeXPrinterESC.swift +1339 -0
- package/ios/ESC/RCTNativeXPrinterESC.h +10 -0
- package/ios/ESC/RCTNativeXPrinterESC.mm +541 -0
- package/ios/Errors.swift +11 -0
- package/ios/NativeErrorInfo.swift +21 -0
- package/ios/Printer/Connecter.swift +214 -0
- package/ios/Printer/Models/RCTDeviceConnectStatusChangeEvent.swift +19 -0
- package/ios/Printer/Models/RCTNetDevice.swift +21 -0
- package/ios/Printer/Models/RCTUSBDevice.swift +17 -0
- package/ios/Printer/Models/RCTUpdateUdpNetConfigRequest.swift +21 -0
- package/ios/Printer/NativeXPrinterPrinter.swift +209 -0
- package/ios/Printer/Printers.swift +59 -0
- package/ios/Printer/RCTNativeXPrinterPrinter.h +12 -0
- package/ios/Printer/RCTNativeXPrinterPrinter.mm +123 -0
- package/ios/PrinterSDK/Headers/CPCLCommand.h +324 -0
- package/ios/PrinterSDK/Headers/KDS_Log.h +47 -0
- package/ios/PrinterSDK/Headers/LabelDocument.h +32 -0
- package/ios/PrinterSDK/Headers/LabelImageTranster.h +19 -0
- package/ios/PrinterSDK/Headers/POSBLEManager.h +164 -0
- package/ios/PrinterSDK/Headers/POSCommand.h +760 -0
- package/ios/PrinterSDK/Headers/POSImageTranster.h +34 -0
- package/ios/PrinterSDK/Headers/POSPrinter.h +47 -0
- package/ios/PrinterSDK/Headers/POSPrinterSDK.h +13 -0
- package/ios/PrinterSDK/Headers/POSWIFIManager.h +162 -0
- package/ios/PrinterSDK/Headers/PTable.h +50 -0
- package/ios/PrinterSDK/Headers/PrinterProfile.h +28 -0
- package/ios/PrinterSDK/Headers/TSCBLEManager.h +142 -0
- package/ios/PrinterSDK/Headers/TSCCommand.h +701 -0
- package/ios/PrinterSDK/Headers/TSCPrinterSDK.h +15 -0
- package/ios/PrinterSDK/Headers/TSCWIFIManager.h +99 -0
- package/ios/PrinterSDK/Headers/WIFIConnecter.h +131 -0
- package/ios/PrinterSDK/Headers/ZPLCommand.h +372 -0
- package/ios/PrinterSDK/libPrinterSDK.a +0 -0
- package/ios/TSPL/Models/RCTTSPLBarRequest.swift +19 -0
- package/ios/TSPL/Models/RCTTSPLBarcodeRequest.swift +29 -0
- package/ios/TSPL/Models/RCTTSPLBitmapCompressionRequest.swift +25 -0
- package/ios/TSPL/Models/RCTTSPLBitmapRequest.swift +25 -0
- package/ios/TSPL/Models/RCTTSPLBoxRequest.swift +21 -0
- package/ios/TSPL/Models/RCTTSPLEraseRequest.swift +19 -0
- package/ios/TSPL/Models/RCTTSPLPDFBase64Request.swift +21 -0
- package/ios/TSPL/Models/RCTTSPLPutBMPRequest.swift +17 -0
- package/ios/TSPL/Models/RCTTSPLQRCodeRequest.swift +29 -0
- package/ios/TSPL/Models/RCTTSPLReverseRequest.swift +19 -0
- package/ios/TSPL/Models/RCTTSPLTextRequest.swift +25 -0
- package/ios/TSPL/NativeXPrinterTSPL.swift +831 -0
- package/ios/TSPL/RCTNativeXPrinterTSPL.h +10 -0
- package/ios/TSPL/RCTNativeXPrinterTSPL.mm +445 -0
- package/ios/TSPL/TSPLConvert.swift +140 -0
- package/ios/Utils/Models/RCTCheckIsPureWhiteImageRequest.swift +16 -0
- package/ios/Utils/NativeXPrinterUtils.swift +17 -0
- package/ios/Utils/RCTNativeXPrinterUtils.h +10 -0
- package/ios/Utils/RCTNativeXPrinterUtils.mm +38 -0
- package/ios/Utils.swift +126 -0
- package/lib/module/esc/NativeXPrinterESC.js +218 -0
- package/lib/module/esc/NativeXPrinterESC.js.map +1 -0
- package/lib/module/esc/index.js +324 -0
- package/lib/module/esc/index.js.map +1 -0
- package/lib/module/index.js +8 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/printer/NativeXPrinterPrinter.js +30 -0
- package/lib/module/printer/NativeXPrinterPrinter.js.map +1 -0
- package/lib/module/printer/index.js +110 -0
- package/lib/module/printer/index.js.map +1 -0
- package/lib/module/tspl/NativeXPrinterTSPL.js +143 -0
- package/lib/module/tspl/NativeXPrinterTSPL.js.map +1 -0
- package/lib/module/tspl/index.js +347 -0
- package/lib/module/tspl/index.js.map +1 -0
- package/lib/module/type.js +12 -0
- package/lib/module/type.js.map +1 -0
- package/lib/module/util.js +4 -0
- package/lib/module/util.js.map +1 -0
- package/lib/module/utils/NativeXPrinterUtils.js +5 -0
- package/lib/module/utils/NativeXPrinterUtils.js.map +1 -0
- package/lib/module/utils/index.js +17 -0
- package/lib/module/utils/index.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/esc/NativeXPrinterESC.d.ts +343 -0
- package/lib/typescript/src/esc/NativeXPrinterESC.d.ts.map +1 -0
- package/lib/typescript/src/esc/index.d.ts +122 -0
- package/lib/typescript/src/esc/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/printer/NativeXPrinterPrinter.d.ts +61 -0
- package/lib/typescript/src/printer/NativeXPrinterPrinter.d.ts.map +1 -0
- package/lib/typescript/src/printer/index.d.ts +32 -0
- package/lib/typescript/src/printer/index.d.ts.map +1 -0
- package/lib/typescript/src/tspl/NativeXPrinterTSPL.d.ts +261 -0
- package/lib/typescript/src/tspl/NativeXPrinterTSPL.d.ts.map +1 -0
- package/lib/typescript/src/tspl/index.d.ts +128 -0
- package/lib/typescript/src/tspl/index.d.ts.map +1 -0
- package/lib/typescript/src/type.d.ts +9 -0
- package/lib/typescript/src/type.d.ts.map +1 -0
- package/lib/typescript/src/util.d.ts +2 -0
- package/lib/typescript/src/util.d.ts.map +1 -0
- package/lib/typescript/src/utils/NativeXPrinterUtils.d.ts +10 -0
- package/lib/typescript/src/utils/NativeXPrinterUtils.d.ts.map +1 -0
- package/lib/typescript/src/utils/index.d.ts +9 -0
- package/lib/typescript/src/utils/index.d.ts.map +1 -0
- package/package.json +178 -0
- package/src/esc/NativeXPrinterESC.ts +516 -0
- package/src/esc/index.ts +489 -0
- package/src/index.ts +5 -0
- package/src/printer/NativeXPrinterPrinter.ts +84 -0
- package/src/printer/index.ts +160 -0
- package/src/tspl/NativeXPrinterTSPL.ts +388 -0
- package/src/tspl/index.ts +535 -0
- package/src/type.ts +11 -0
- package/src/util.ts +1 -0
- package/src/utils/NativeXPrinterUtils.ts +14 -0
- package/src/utils/index.ts +27 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
package com.connexup.xprinter.utils
|
|
2
|
+
|
|
3
|
+
import com.connexup.xprinter.NativeXPrinterUtilsSpec
|
|
4
|
+
import com.connexup.xprinter.PARAMS_ERROR
|
|
5
|
+
import com.facebook.react.bridge.Promise
|
|
6
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
7
|
+
import com.facebook.react.bridge.ReadableMap
|
|
8
|
+
import kotlinx.coroutines.CancellationException
|
|
9
|
+
import kotlinx.coroutines.CoroutineScope
|
|
10
|
+
import kotlinx.coroutines.Dispatchers
|
|
11
|
+
import kotlinx.coroutines.SupervisorJob
|
|
12
|
+
import kotlinx.coroutines.launch
|
|
13
|
+
import kotlinx.coroutines.withContext
|
|
14
|
+
|
|
15
|
+
class XPrinterUtilsModule(reactContext: ReactApplicationContext) :
|
|
16
|
+
NativeXPrinterUtilsSpec(reactContext) {
|
|
17
|
+
|
|
18
|
+
private val scope: CoroutineScope by lazy {
|
|
19
|
+
CoroutineScope(
|
|
20
|
+
SupervisorJob() + Dispatchers.Main
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
override fun isPureWhiteImage(
|
|
25
|
+
payload: ReadableMap,
|
|
26
|
+
promise: Promise
|
|
27
|
+
) {
|
|
28
|
+
scope.launch {
|
|
29
|
+
val bitmapPath = payload.getString("bitmapPath")
|
|
30
|
+
val bitmapContent = payload.getString("bitmapContent")
|
|
31
|
+
if (bitmapPath == null && bitmapContent == null) {
|
|
32
|
+
promise.reject(PARAMS_ERROR, "bitmapPath is null and bitmapContent is null")
|
|
33
|
+
return@launch
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
val result = withContext(Dispatchers.IO) {
|
|
37
|
+
com.connexup.xprinter.isPureWhiteImage(
|
|
38
|
+
bitmapPath = bitmapPath,
|
|
39
|
+
bitmapContent = bitmapContent
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
promise.resolve(result)
|
|
43
|
+
} catch (e: CancellationException) {
|
|
44
|
+
throw e
|
|
45
|
+
} catch (e: Exception) {
|
|
46
|
+
promise.reject(PARAMS_ERROR, e.message, e)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
companion object {
|
|
52
|
+
const val NAME = NativeXPrinterUtilsSpec.NAME
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Convert.swift
|
|
3
|
+
|
|
4
|
+
//
|
|
5
|
+
// Created by chancetio on 2025/1/26.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
extension String {
|
|
9
|
+
func toCharSet() -> String.Encoding? {
|
|
10
|
+
switch self {
|
|
11
|
+
case "GBK":
|
|
12
|
+
return .init(rawValue: CFStringConvertEncodingToNSStringEncoding(CFStringEncoding(CFStringEncodings.GB_18030_2000.rawValue)))
|
|
13
|
+
case "UTF-8":
|
|
14
|
+
return .utf8
|
|
15
|
+
default:
|
|
16
|
+
return nil
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
func toESCBarCodeType() -> Int32? {
|
|
21
|
+
switch self {
|
|
22
|
+
case "UPCA":
|
|
23
|
+
return 0
|
|
24
|
+
case "UPCE":
|
|
25
|
+
return 1
|
|
26
|
+
case "EAN13", "JAN13":
|
|
27
|
+
return 2
|
|
28
|
+
case "JAN8", "EAN8":
|
|
29
|
+
return 3
|
|
30
|
+
case "CODE39":
|
|
31
|
+
return 4
|
|
32
|
+
case "ITF":
|
|
33
|
+
return 5
|
|
34
|
+
case "CODEBAR":
|
|
35
|
+
return 6
|
|
36
|
+
default:
|
|
37
|
+
return nil
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
func toESCTableBarCodeType() -> BCSBarcodeType? {
|
|
42
|
+
switch self {
|
|
43
|
+
case "UPCA":
|
|
44
|
+
return BCSBarcodeType.UPCA
|
|
45
|
+
case "UPCE":
|
|
46
|
+
return BCSBarcodeType.UPCE
|
|
47
|
+
case "EAN13", "JAN13":
|
|
48
|
+
return BCSBarcodeType.EAN13
|
|
49
|
+
case "JAN8", "EAN8":
|
|
50
|
+
return BCSBarcodeType.EAN8
|
|
51
|
+
case "CODE39":
|
|
52
|
+
return BCSBarcodeType.code39
|
|
53
|
+
case "ITF":
|
|
54
|
+
return BCSBarcodeType.ITF
|
|
55
|
+
case "CODEBAR":
|
|
56
|
+
return BCSBarcodeType.codabar
|
|
57
|
+
default:
|
|
58
|
+
return nil
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
func toESCInternationCharacterSet() -> Int32? {
|
|
63
|
+
switch self {
|
|
64
|
+
case "AMERICA":
|
|
65
|
+
return 0
|
|
66
|
+
case "FRANCE":
|
|
67
|
+
return 1
|
|
68
|
+
case "GERMANY":
|
|
69
|
+
return 2
|
|
70
|
+
case "ENGLAND":
|
|
71
|
+
return 3
|
|
72
|
+
case "DENMARK1":
|
|
73
|
+
return 4
|
|
74
|
+
case "SWEDEN":
|
|
75
|
+
return 5
|
|
76
|
+
case "ITALY":
|
|
77
|
+
return 6
|
|
78
|
+
case "SPAIN1":
|
|
79
|
+
return 7
|
|
80
|
+
case "JAPAN":
|
|
81
|
+
return 8
|
|
82
|
+
case "NORWAY":
|
|
83
|
+
return 9
|
|
84
|
+
case "DENMARK2":
|
|
85
|
+
return 10
|
|
86
|
+
case "SPAIN2":
|
|
87
|
+
return 11
|
|
88
|
+
case "LATIN_AMERICA":
|
|
89
|
+
return 12
|
|
90
|
+
case "KOREA":
|
|
91
|
+
return 13
|
|
92
|
+
case "SLOVENIA_OR_CROATIA":
|
|
93
|
+
return 14
|
|
94
|
+
case "CHINA":
|
|
95
|
+
return 15
|
|
96
|
+
default:
|
|
97
|
+
return nil
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
func toESCTextWidth() -> Int32? {
|
|
102
|
+
switch self {
|
|
103
|
+
case "TXT_1_WIDTH": return TextWidthRatio.TXT_1WIDTH.toInt32 - 1
|
|
104
|
+
case "TXT_2_WIDTH": return TextWidthRatio.TXT_2WIDTH.toInt32 - 1
|
|
105
|
+
case "TXT_3_WIDTH": return TextWidthRatio.TXT_3WIDTH.toInt32 - 1
|
|
106
|
+
case "TXT_4_WIDTH": return TextWidthRatio.TXT_4WIDTH.toInt32 - 1
|
|
107
|
+
case "TXT_5_WIDTH": return TextWidthRatio.TXT_5WIDTH.toInt32 - 1
|
|
108
|
+
case "TXT_6_WIDTH": return TextWidthRatio.TXT_6WIDTH.toInt32 - 1
|
|
109
|
+
case "TXT_7_WIDTH": return TextWidthRatio.TXT_7WIDTH.toInt32 - 1
|
|
110
|
+
case "TXT_8_WIDTH": return TextWidthRatio.TXT_8WIDTH.toInt32 - 1
|
|
111
|
+
default: return nil
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
func toESCTextHeight() -> Int32? {
|
|
116
|
+
switch self {
|
|
117
|
+
case "TXT_1_HEIGHT": return TextHeightRatio.TXT_1HEIGHT.toInt32 - 1
|
|
118
|
+
case "TXT_2_HEIGHT": return TextHeightRatio.TXT_2HEIGHT.toInt32 - 1
|
|
119
|
+
case "TXT_3_HEIGHT": return TextHeightRatio.TXT_3HEIGHT.toInt32 - 1
|
|
120
|
+
case "TXT_4_HEIGHT": return TextHeightRatio.TXT_4HEIGHT.toInt32 - 1
|
|
121
|
+
case "TXT_5_HEIGHT": return TextHeightRatio.TXT_5HEIGHT.toInt32 - 1
|
|
122
|
+
case "TXT_6_HEIGHT": return TextHeightRatio.TXT_6HEIGHT.toInt32 - 1
|
|
123
|
+
case "TXT_7_HEIGHT": return TextHeightRatio.TXT_7HEIGHT.toInt32 - 1
|
|
124
|
+
case "TXT_8_HEIGHT": return TextHeightRatio.TXT_8HEIGHT.toInt32 - 1
|
|
125
|
+
default: return nil
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
func toESCTextAttribute() -> Int32? {
|
|
130
|
+
switch self {
|
|
131
|
+
case "DEFAULT": return TextFontAttribute.FNT_DEFAULT.toInt32
|
|
132
|
+
case "FONTB": return TextFontAttribute.FNT_FONTB.toInt32
|
|
133
|
+
case "BOLD": return TextFontAttribute.FNT_BOLD.toInt32
|
|
134
|
+
case "REVERSE": return TextFontAttribute.FNT_REVERSE.toInt32
|
|
135
|
+
case "UNDERLINE": return TextFontAttribute.FNT_UNDERLINE.toInt32
|
|
136
|
+
case "UNDERLINE2": return TextFontAttribute.FNT_UNDERLINE2.toInt32
|
|
137
|
+
default: return nil
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
func toESCAlignment() -> Int32? {
|
|
142
|
+
switch self {
|
|
143
|
+
case "LEFT": return POSTextAlignment.ALIGNMENT_LEFT.toInt32
|
|
144
|
+
case "CENTER": return POSTextAlignment.ALIGNMENT_CENTER.toInt32
|
|
145
|
+
case "RIGHT": return POSTextAlignment.ALIGNMENT_RIGHT.toInt32
|
|
146
|
+
default: return nil
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
func toESCBmpModel() -> PrintRasterType? {
|
|
151
|
+
switch self {
|
|
152
|
+
case "NORMAL": return RasterNolmorWH
|
|
153
|
+
case "WIDTH_DOUBLE": return RasterDoubleWidth
|
|
154
|
+
case "HEIGHT_DOUBLE": return RasterDoubleHeight
|
|
155
|
+
case "WIDTH_HEIGHT_DOUBLE": return RasterDoubleWH
|
|
156
|
+
default: return nil
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
func toESCBmpType() -> BmpType? {
|
|
161
|
+
switch self {
|
|
162
|
+
case "DITHERING": return Dithering
|
|
163
|
+
case "THRESHOLD": return Threshold
|
|
164
|
+
default: return nil
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
func toESCTextPosition() -> Int32? {
|
|
169
|
+
switch self {
|
|
170
|
+
case "NONE": return 0
|
|
171
|
+
case "ABOVE": return 1
|
|
172
|
+
case "BELOW": return 2
|
|
173
|
+
case "BOTH": return 3
|
|
174
|
+
default: return nil
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
func toESCTableTextPosition() -> BarHriText? {
|
|
179
|
+
switch self {
|
|
180
|
+
case "NONE": return BarHriText.BAR_HRI_TEXT_NONE
|
|
181
|
+
case "ABOVE": return BarHriText.BAR_HRI_TEXT_ABOVE
|
|
182
|
+
case "BELOW": return BarHriText.BAR_HRI_TEXT_BELOW
|
|
183
|
+
case "BOTH": return BarHriText.BAR_HRI_TEXT_BOTH
|
|
184
|
+
default: return nil
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
func toESCPrinterCheckType() -> Int32? {
|
|
189
|
+
switch self {
|
|
190
|
+
case "PRINT": return 1
|
|
191
|
+
case "OFFLINE": return 2
|
|
192
|
+
case "ERR": return 3
|
|
193
|
+
case "PAPER": return 4
|
|
194
|
+
default: return nil
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
func toESCECLevel() -> Int32? {
|
|
199
|
+
switch self {
|
|
200
|
+
case "LEVEL_L": return 48
|
|
201
|
+
case "LEVEL_M": return 49
|
|
202
|
+
case "LEVEL_Q": return 50
|
|
203
|
+
case "LEVEL_H": return 51
|
|
204
|
+
default: return nil
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
func toESCCutModel() -> Int32? {
|
|
209
|
+
switch self {
|
|
210
|
+
case "CUT_ALL": return 0
|
|
211
|
+
case "CUT_HALF": return 1
|
|
212
|
+
default: return nil
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
func toESCDirection() -> Int32? {
|
|
217
|
+
switch self {
|
|
218
|
+
case "LEFT_TOP": return 0
|
|
219
|
+
case "LEFT_BOTTOM": return 1
|
|
220
|
+
case "RIGHT_BOTTOM": return 2
|
|
221
|
+
case "RIGHT_TOP": return 3
|
|
222
|
+
default: return nil
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
func toESCSelectBitmapModel() -> Int32? {
|
|
227
|
+
switch self {
|
|
228
|
+
case "SINGLE_DENSITY_8": return 0
|
|
229
|
+
case "DOUBLE_DENSITY_8": return 1
|
|
230
|
+
case "SINGLE_DENSITY_24": return 32
|
|
231
|
+
case "DOUBLE_DENSITY_24": return 33
|
|
232
|
+
default: return nil
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
func toESCFontType() -> Int32? {
|
|
237
|
+
switch self {
|
|
238
|
+
case "STANDARD": return 0
|
|
239
|
+
case "COMPRESS": return 1
|
|
240
|
+
default: return nil
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
func toESCWifiEncrypt() -> UInt? {
|
|
245
|
+
switch self {
|
|
246
|
+
case "NULL": return 0
|
|
247
|
+
case "WEP64": return 1
|
|
248
|
+
case "WEP128": return 2
|
|
249
|
+
case "WPA_AES_PSK": return 3
|
|
250
|
+
case "WPA_TKIP_PSK": return 4
|
|
251
|
+
case "WPA_TKIP_AES_PSK": return 5
|
|
252
|
+
case "WPA2_AES_PSK": return 6
|
|
253
|
+
case "WPA2_TKIP": return 7
|
|
254
|
+
case "WPA2_TKIP_AES_PSK": return 8
|
|
255
|
+
case "WPA_WPA2_MixedMode": return 9
|
|
256
|
+
default: return nil
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
extension POSTextAlignment {
|
|
262
|
+
var toInt32: Int32 {
|
|
263
|
+
return Int32(self.rawValue)
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
extension TextFontAttribute {
|
|
268
|
+
var toInt32: Int32 {
|
|
269
|
+
return Int32(self.rawValue)
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
extension TextWidthRatio {
|
|
274
|
+
var toInt32: Int32 {
|
|
275
|
+
return Int32(self.rawValue)
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
extension TextHeightRatio {
|
|
280
|
+
var toInt32: Int32 {
|
|
281
|
+
return Int32(self.rawValue)
|
|
282
|
+
}
|
|
283
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@objcMembers
|
|
2
|
+
public class RCTESCPrintBarCodeRequest: NSObject {
|
|
3
|
+
public let data: String
|
|
4
|
+
public let codeType: String
|
|
5
|
+
public let width: Double
|
|
6
|
+
public let height: Double
|
|
7
|
+
public let alignment: String
|
|
8
|
+
public let textPosition: String
|
|
9
|
+
|
|
10
|
+
public init(data: String, codeType: String, width: Double, height: Double, alignment: String, textPosition: String) {
|
|
11
|
+
self.data = data
|
|
12
|
+
self.codeType = codeType
|
|
13
|
+
self.width = width
|
|
14
|
+
self.height = height
|
|
15
|
+
self.alignment = alignment
|
|
16
|
+
self.textPosition = textPosition
|
|
17
|
+
super.init()
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
override public var description: String {
|
|
21
|
+
"RCTESCPrintBarCodeRequest(data=\(String(describing: data)), codeType=\(String(describing: codeType)), width=\(String(describing: width)), height=\(String(describing: height)), alignment=\(String(describing: alignment)), textPosition=\(String(describing: textPosition)))"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@objcMembers
|
|
2
|
+
public class RCTESCPrintBitmapRequest: NSObject {
|
|
3
|
+
public let alignment: String
|
|
4
|
+
public let width: Double
|
|
5
|
+
public let model: String
|
|
6
|
+
public let type: String?
|
|
7
|
+
public let bitmapPath: String?
|
|
8
|
+
public let bitmapContent: String?
|
|
9
|
+
|
|
10
|
+
public init(alignment: String, width: Double, model: String, type: String?, bitmapPath: String?, bitmapContent: String?) {
|
|
11
|
+
self.alignment = alignment
|
|
12
|
+
self.width = width
|
|
13
|
+
self.model = model
|
|
14
|
+
self.type = type
|
|
15
|
+
self.bitmapPath = bitmapPath
|
|
16
|
+
self.bitmapContent = bitmapContent
|
|
17
|
+
super.init()
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
override public var description: String {
|
|
21
|
+
"RCTESCPrintBitmapRequest(alignment=\(String(describing: alignment)), width=\(String(describing: width)), model=\(String(describing: model)), type=\(String(describing: type)), bitmapPath=\(String(describing: bitmapPath)), bitmapContent=\(String(describing: bitmapContent)))"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@objcMembers
|
|
2
|
+
public class RCTESCPrintPDF417Request: NSObject {
|
|
3
|
+
public let data: String
|
|
4
|
+
public let cellWidth: Double
|
|
5
|
+
public let cellHeightRatio: Double
|
|
6
|
+
public let numberOfColumns: Double
|
|
7
|
+
public let numberOfRows: Double
|
|
8
|
+
public let eclType: Double
|
|
9
|
+
public let eclValue: Double
|
|
10
|
+
public let alignment: String
|
|
11
|
+
|
|
12
|
+
public init(data: String, cellWidth: Double, cellHeightRatio: Double, numberOfColumns: Double, numberOfRows: Double, eclType: Double, eclValue: Double, alignment: String) {
|
|
13
|
+
self.data = data
|
|
14
|
+
self.cellWidth = cellWidth
|
|
15
|
+
self.cellHeightRatio = cellHeightRatio
|
|
16
|
+
self.numberOfColumns = numberOfColumns
|
|
17
|
+
self.numberOfRows = numberOfRows
|
|
18
|
+
self.eclType = eclType
|
|
19
|
+
self.eclValue = eclValue
|
|
20
|
+
self.alignment = alignment
|
|
21
|
+
super.init()
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
override public var description: String {
|
|
25
|
+
"RCTESCPrintPDF417Request(data=\(String(describing: data)), cellWidth=\(String(describing: cellWidth)), cellHeightRatio=\(String(describing: cellHeightRatio)), numberOfColumns=\(String(describing: numberOfColumns)), numberOfRows=\(String(describing: numberOfRows)), eclType=\(String(describing: eclType)), eclValue=\(String(describing: eclValue)), alignment=\(String(describing: alignment)))"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@objcMembers
|
|
2
|
+
public class RCTESCPrintQRCodeRequest: NSObject {
|
|
3
|
+
public let data: String
|
|
4
|
+
public let moduleSize: Double
|
|
5
|
+
public let ecLevel: String
|
|
6
|
+
public let alignment: String
|
|
7
|
+
|
|
8
|
+
public init(data: String, moduleSize: Double, ecLevel: String, alignment: String) {
|
|
9
|
+
self.data = data
|
|
10
|
+
self.moduleSize = moduleSize
|
|
11
|
+
self.ecLevel = ecLevel
|
|
12
|
+
self.alignment = alignment
|
|
13
|
+
super.init()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
override public var description: String {
|
|
17
|
+
"RCTESCPrintQRCodeRequest(data=\(String(describing: data)), moduleSize=\(String(describing: moduleSize)), ecLevel=\(String(describing: ecLevel)), alignment=\(String(describing: alignment)))"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@objcMembers
|
|
2
|
+
public class RCTESCPrintTableBarcode: NSObject {
|
|
3
|
+
public let data: String
|
|
4
|
+
public let codeType: String
|
|
5
|
+
public let width: Double
|
|
6
|
+
public let height: Double
|
|
7
|
+
public let alignment: String
|
|
8
|
+
public let textPosition: String
|
|
9
|
+
|
|
10
|
+
public init(data: String, codeType: String, width: Double, height: Double, alignment: String, textPosition: String) {
|
|
11
|
+
self.data = data
|
|
12
|
+
self.codeType = codeType
|
|
13
|
+
self.width = width
|
|
14
|
+
self.height = height
|
|
15
|
+
self.alignment = alignment
|
|
16
|
+
self.textPosition = textPosition
|
|
17
|
+
super.init()
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
override public var description: String {
|
|
21
|
+
"RCTESCPrintTableBarcode(data=\(String(describing: data)), codeType=\(String(describing: codeType)), width=\(String(describing: width)), height=\(String(describing: height)), alignment=\(String(describing: alignment)), textPosition=\(String(describing: textPosition)))"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@objcMembers
|
|
2
|
+
public class RCTESCPrintTableRequest: NSObject {
|
|
3
|
+
public let titles: [String]
|
|
4
|
+
public let numberOfSingleBytesPerCol: [Double]
|
|
5
|
+
public let align: [Double]
|
|
6
|
+
public let rows: [RCTESCPrintTableRow]?
|
|
7
|
+
|
|
8
|
+
public init(titles: [String], numberOfSingleBytesPerCol: [Double], align: [Double], rows: [RCTESCPrintTableRow]?) {
|
|
9
|
+
self.titles = titles
|
|
10
|
+
self.numberOfSingleBytesPerCol = numberOfSingleBytesPerCol
|
|
11
|
+
self.align = align
|
|
12
|
+
self.rows = rows
|
|
13
|
+
super.init()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
override public var description: String {
|
|
17
|
+
"RCTESCPrintTableRequest(titles=\(String(describing: titles)), numberOfSingleBytesPerCol=\(String(describing: numberOfSingleBytesPerCol)), align=\(String(describing: align)), rows=\(String(describing: rows)))"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@objcMembers
|
|
2
|
+
public class RCTESCPrintTableRow: NSObject {
|
|
3
|
+
public let title: String?
|
|
4
|
+
public let data: [String]
|
|
5
|
+
public let remark: String?
|
|
6
|
+
public let barcode: RCTESCPrintTableBarcode?
|
|
7
|
+
|
|
8
|
+
public init(title: String?, data: [String], remark: String?, barcode: RCTESCPrintTableBarcode?) {
|
|
9
|
+
self.title = title
|
|
10
|
+
self.data = data
|
|
11
|
+
self.remark = remark
|
|
12
|
+
self.barcode = barcode
|
|
13
|
+
super.init()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
override public var description: String {
|
|
17
|
+
"RCTESCPrintTableRow(title=\(String(describing: title)), data=\(String(describing: data)), remark=\(String(describing: remark)), barcode=\(String(describing: barcode)))"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@objcMembers
|
|
2
|
+
public class RCTESCPrintTextRequest: NSObject {
|
|
3
|
+
public let data: String
|
|
4
|
+
public let alignment: String
|
|
5
|
+
public let attribute: String
|
|
6
|
+
public let textWidth: String
|
|
7
|
+
public let textHeight: String
|
|
8
|
+
|
|
9
|
+
public init(data: String, alignment: String, attribute: String, textWidth: String, textHeight: String) {
|
|
10
|
+
self.data = data
|
|
11
|
+
self.alignment = alignment
|
|
12
|
+
self.attribute = attribute
|
|
13
|
+
self.textWidth = textWidth
|
|
14
|
+
self.textHeight = textHeight
|
|
15
|
+
super.init()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
override public var description: String {
|
|
19
|
+
"RCTESCPrintTextRequest(data=\(String(describing: data)), alignment=\(String(describing: alignment)), attribute=\(String(describing: attribute)), textWidth=\(String(describing: textWidth)), textHeight=\(String(describing: textHeight)))"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@objcMembers
|
|
2
|
+
public class RCTESCPrintTextSizeRequest: NSObject {
|
|
3
|
+
public let data: String
|
|
4
|
+
public let textWidth: String
|
|
5
|
+
public let textHeight: String
|
|
6
|
+
|
|
7
|
+
public init(data: String, textWidth: String, textHeight: String) {
|
|
8
|
+
self.data = data
|
|
9
|
+
self.textWidth = textWidth
|
|
10
|
+
self.textHeight = textHeight
|
|
11
|
+
super.init()
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
override public var description: String {
|
|
15
|
+
"RCTESCPrintTextSizeRequest(data=\(String(describing: data)), textWidth=\(String(describing: textWidth)), textHeight=\(String(describing: textHeight)))"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@objcMembers
|
|
2
|
+
public class RCTESCSelectBitmapModelRequest: NSObject {
|
|
3
|
+
public let bitmapPath: String
|
|
4
|
+
public let width: Double
|
|
5
|
+
public let model: String
|
|
6
|
+
|
|
7
|
+
public init(bitmapPath: String, width: Double, model: String) {
|
|
8
|
+
self.bitmapPath = bitmapPath
|
|
9
|
+
self.width = width
|
|
10
|
+
self.model = model
|
|
11
|
+
super.init()
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
override public var description: String {
|
|
15
|
+
"RCTESCSelectBitmapModelRequest(bitmapPath=\(String(describing: bitmapPath)), width=\(String(describing: width)), model=\(String(describing: model)))"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@objcMembers
|
|
2
|
+
public class RCTESCSetNetAllRequest: NSObject {
|
|
3
|
+
public let ip: String
|
|
4
|
+
public let mask: String
|
|
5
|
+
public let gateway: String
|
|
6
|
+
public let dhcpIsOpen: Bool
|
|
7
|
+
|
|
8
|
+
public init(ip: String, mask: String, gateway: String, dhcpIsOpen: Bool) {
|
|
9
|
+
self.ip = ip
|
|
10
|
+
self.mask = mask
|
|
11
|
+
self.gateway = gateway
|
|
12
|
+
self.dhcpIsOpen = dhcpIsOpen
|
|
13
|
+
super.init()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
override public var description: String {
|
|
17
|
+
"RCTESCSetNetAllRequest(ip=\(String(describing: ip)), mask=\(String(describing: mask)), gateway=\(String(describing: gateway)), dhcpIsOpen=\(String(describing: dhcpIsOpen)))"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@objcMembers
|
|
2
|
+
public class RCTESCSetPrintAreaRequest: NSObject {
|
|
3
|
+
public let x: Double
|
|
4
|
+
public let y: Double
|
|
5
|
+
public let width: Double
|
|
6
|
+
public let height: Double
|
|
7
|
+
|
|
8
|
+
public init(x: Double, y: Double, width: Double, height: Double) {
|
|
9
|
+
self.x = x
|
|
10
|
+
self.y = y
|
|
11
|
+
self.width = width
|
|
12
|
+
self.height = height
|
|
13
|
+
super.init()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
override public var description: String {
|
|
17
|
+
"RCTESCSetPrintAreaRequest(x=\(String(describing: x)), y=\(String(describing: y)), width=\(String(describing: width)), height=\(String(describing: height)))"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@objcMembers
|
|
2
|
+
public class RCTESCSetTextStyleRequest: NSObject {
|
|
3
|
+
public let attribute: String
|
|
4
|
+
public let textWidth: String
|
|
5
|
+
public let textHeight: String
|
|
6
|
+
|
|
7
|
+
public init(attribute: String, textWidth: String, textHeight: String) {
|
|
8
|
+
self.attribute = attribute
|
|
9
|
+
self.textWidth = textWidth
|
|
10
|
+
self.textHeight = textHeight
|
|
11
|
+
super.init()
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
override public var description: String {
|
|
15
|
+
"RCTESCSetTextStyleRequest(attribute=\(String(describing: attribute)), textWidth=\(String(describing: textWidth)), textHeight=\(String(describing: textHeight)))"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@objcMembers
|
|
2
|
+
public class RCTESCWifiConfigRequest: NSObject {
|
|
3
|
+
public let ip: String
|
|
4
|
+
public let mask: String
|
|
5
|
+
public let gateway: String
|
|
6
|
+
public let ssid: String
|
|
7
|
+
public let password: String
|
|
8
|
+
public let encrypt: String
|
|
9
|
+
|
|
10
|
+
public init(ip: String, mask: String, gateway: String, ssid: String, password: String, encrypt: String) {
|
|
11
|
+
self.ip = ip
|
|
12
|
+
self.mask = mask
|
|
13
|
+
self.gateway = gateway
|
|
14
|
+
self.ssid = ssid
|
|
15
|
+
self.password = password
|
|
16
|
+
self.encrypt = encrypt
|
|
17
|
+
super.init()
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
override public var description: String {
|
|
21
|
+
"RCTESCWifiConfigRequest(ip=\(String(describing: ip)), mask=\(String(describing: mask)), gateway=\(String(describing: gateway)), ssid=\(String(describing: ssid)), password=\(String(describing: password)), encrypt=\(String(describing: encrypt)))"
|
|
22
|
+
}
|
|
23
|
+
}
|