jc-printer-sdk-ts 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/README.md +86 -0
- package/dist/builder.d.ts +60 -0
- package/dist/builder.d.ts.map +1 -0
- package/dist/builder.js +411 -0
- package/dist/builder.js.map +1 -0
- package/dist/client.d.ts +85 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +352 -0
- package/dist/client.js.map +1 -0
- package/dist/constants.d.ts +186 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +179 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/transport.d.ts +132 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +334 -0
- package/dist/transport.js.map +1 -0
- package/dist/types.d.ts +310 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +40 -0
- package/src/builder.ts +562 -0
- package/src/client.ts +588 -0
- package/src/constants.ts +210 -0
- package/src/index.ts +5 -0
- package/src/transport.ts +526 -0
- package/src/types.ts +385 -0
package/src/constants.ts
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
export const AddressType = {
|
|
2
|
+
SPP: "SPP",
|
|
3
|
+
BLE: "BLE",
|
|
4
|
+
DUAL: "DUAL",
|
|
5
|
+
WiFi: "WiFi",
|
|
6
|
+
} as const;
|
|
7
|
+
|
|
8
|
+
export type AddressType = (typeof AddressType)[keyof typeof AddressType];
|
|
9
|
+
|
|
10
|
+
export const AddressTypeCode = {
|
|
11
|
+
SPP: 16,
|
|
12
|
+
BLE: 20,
|
|
13
|
+
DUAL: 31,
|
|
14
|
+
WiFi: 240,
|
|
15
|
+
} as const;
|
|
16
|
+
|
|
17
|
+
export const PrinterState = {
|
|
18
|
+
Connecting: "Connecting",
|
|
19
|
+
Connected: "Connected",
|
|
20
|
+
Connected2: "Connected2",
|
|
21
|
+
Printing: "Printing",
|
|
22
|
+
Working: "Working",
|
|
23
|
+
Disconnected: "Disconnected",
|
|
24
|
+
} as const;
|
|
25
|
+
|
|
26
|
+
export type PrinterState = (typeof PrinterState)[keyof typeof PrinterState];
|
|
27
|
+
|
|
28
|
+
export const PrinterStateGroup = {
|
|
29
|
+
Connecting: 1,
|
|
30
|
+
Connected: 2,
|
|
31
|
+
Connected2: 2,
|
|
32
|
+
Printing: 2,
|
|
33
|
+
Working: 2,
|
|
34
|
+
Disconnected: 0,
|
|
35
|
+
} as const;
|
|
36
|
+
|
|
37
|
+
export const GeneralProgress = {
|
|
38
|
+
Start: "Start",
|
|
39
|
+
Success: "Success",
|
|
40
|
+
Success2: "Success2",
|
|
41
|
+
Failed: "Failed",
|
|
42
|
+
Cancelled: "Cancelled",
|
|
43
|
+
Timeout: "Timeout",
|
|
44
|
+
Info: "Info",
|
|
45
|
+
} as const;
|
|
46
|
+
|
|
47
|
+
export type GeneralProgress = (typeof GeneralProgress)[keyof typeof GeneralProgress];
|
|
48
|
+
|
|
49
|
+
export const PrintProgress = {
|
|
50
|
+
Connected: "Connected",
|
|
51
|
+
StartCopy: "StartCopy",
|
|
52
|
+
DataEnded: "DataEnded",
|
|
53
|
+
Success: "Success",
|
|
54
|
+
Failed: "Failed",
|
|
55
|
+
} as const;
|
|
56
|
+
|
|
57
|
+
export type PrintProgress = (typeof PrintProgress)[keyof typeof PrintProgress];
|
|
58
|
+
|
|
59
|
+
export const ProgressInfo = {
|
|
60
|
+
AdapterEnabling: "AdapterEnabling",
|
|
61
|
+
AdapterEnabled: "AdapterEnabled",
|
|
62
|
+
AdapterDisabled: "AdapterDisabled",
|
|
63
|
+
DeviceBonding: "DeviceBonding",
|
|
64
|
+
DeviceBonded: "DeviceBonded",
|
|
65
|
+
DeviceUnbonded: "DeviceUnbonded",
|
|
66
|
+
} as const;
|
|
67
|
+
|
|
68
|
+
export type ProgressInfo = (typeof ProgressInfo)[keyof typeof ProgressInfo];
|
|
69
|
+
|
|
70
|
+
export const PrintFailReason = {
|
|
71
|
+
OK: "OK",
|
|
72
|
+
IsPrinting: "IsPrinting",
|
|
73
|
+
IsRotating: "IsRotating",
|
|
74
|
+
VolTooLow: "VolTooLow",
|
|
75
|
+
VolTooHigh: "VolTooHigh",
|
|
76
|
+
TphNotFound: "TphNotFound",
|
|
77
|
+
TphTooHot: "TphTooHot",
|
|
78
|
+
TphTooCold: "TphTooCold",
|
|
79
|
+
TphOpened: "TphOpened",
|
|
80
|
+
CoverOpened: "CoverOpened",
|
|
81
|
+
No_Paper: "No_Paper",
|
|
82
|
+
No_Ribbon: "No_Ribbon",
|
|
83
|
+
Unmatched_Ribbon: "Unmatched_Ribbon",
|
|
84
|
+
Usedup_Ribbon: "Usedup_Ribbon",
|
|
85
|
+
Usedup_Ribbon2: "Usedup_Ribbon2",
|
|
86
|
+
Cancelled: "Cancelled",
|
|
87
|
+
Disconnected: "Disconnected",
|
|
88
|
+
Timeout: "Timeout",
|
|
89
|
+
Other: "Other",
|
|
90
|
+
} as const;
|
|
91
|
+
|
|
92
|
+
export type PrintFailReason =
|
|
93
|
+
(typeof PrintFailReason)[keyof typeof PrintFailReason];
|
|
94
|
+
|
|
95
|
+
export const PrintParamName = {
|
|
96
|
+
PRINT_DARKNESS: "PRINT_DENSITY",
|
|
97
|
+
PRINT_DENSITY: "PRINT_DENSITY",
|
|
98
|
+
PRINT_SPEED: "PRINT_SPEED",
|
|
99
|
+
PRINT_DIRECTION: "PRINT_DIRECTION",
|
|
100
|
+
PRINT_COPIES: "PRINT_COPIES",
|
|
101
|
+
GAP_TYPE: "GAP_TYPE",
|
|
102
|
+
GAP_LENGTH_01MM: "GAP_LENGTH_01MM",
|
|
103
|
+
GAP_LENGTH_PX: "GAP_LENGTH_PX",
|
|
104
|
+
GAP_LENGTH: "GAP_LENGTH_01MM",
|
|
105
|
+
PRINT_ALIGNMENT: "PRINT_ALIGNMENT",
|
|
106
|
+
ANTI_COLOR: "ANTI_COLOR",
|
|
107
|
+
HORIZONTAL_OFFSET_01MM: "HORIZONTAL_OFFSET_01MM",
|
|
108
|
+
HORIZONTAL_OFFSET_PX: "HORIZONTAL_OFFSET_PX",
|
|
109
|
+
VERTICAL_OFFSET_01MM: "VERTICAL_OFFSET_01MM",
|
|
110
|
+
VERTICAL_OFFSET_PX: "VERTICAL_OFFSET_PX",
|
|
111
|
+
LEFT_MARGIN_01MM: "LEFT_MARGIN_01MM",
|
|
112
|
+
LEFT_MARGIN_PX: "LEFT_MARGIN_PX",
|
|
113
|
+
RIGHT_MARGIN_01MM: "RIGHT_MARGIN_01MM",
|
|
114
|
+
RIGHT_MARGIN_PX: "RIGHT_MARGIN_PX",
|
|
115
|
+
TOP_MARGIN_01MM: "TOP_MARGIN_01MM",
|
|
116
|
+
TOP_MARGIN_PX: "TOP_MARGIN_PX",
|
|
117
|
+
BOTTOM_MARGIN_01MM: "BOTTOM_MARGIN_01MM",
|
|
118
|
+
BOTTOM_MARGIN_PX: "BOTTOM_MARGIN_PX",
|
|
119
|
+
IMAGE_THRESHOLD: "IMAGE_THRESHOLD",
|
|
120
|
+
MOTOR_MODE: "MOTOR_MODE",
|
|
121
|
+
AUTO_POWEROFF: "AUTO_POWEROFF",
|
|
122
|
+
LANGUAGE: "LANGUAGE",
|
|
123
|
+
} as const;
|
|
124
|
+
|
|
125
|
+
export type PrintParamName = (typeof PrintParamName)[keyof typeof PrintParamName];
|
|
126
|
+
|
|
127
|
+
export const PrintParamValue = {
|
|
128
|
+
MIN_PRINT_DARKNESS: 0,
|
|
129
|
+
DEFAULT_PRINT_DARKNESS: 5,
|
|
130
|
+
MAX_PRINT_DARKNESS: 14,
|
|
131
|
+
MIN_PRINT_SPEED: 0,
|
|
132
|
+
DEFAULT_PRINT_SPEED: 2,
|
|
133
|
+
MAX_PRINT_SPEED: 4,
|
|
134
|
+
GAP_NONE: 0,
|
|
135
|
+
GAP_HOLE: 1,
|
|
136
|
+
GAP_GAP: 2,
|
|
137
|
+
GAP_BLACK: 3,
|
|
138
|
+
PRINT_ALIGNMENT_LEFT: 1024,
|
|
139
|
+
PRINT_ALIGNMENT_CENTER: 512,
|
|
140
|
+
PRINT_ALIGNMENT_RIGHT: 0,
|
|
141
|
+
} as const;
|
|
142
|
+
|
|
143
|
+
export const FontStyle = {
|
|
144
|
+
REGULAR: 0,
|
|
145
|
+
BOLD: 1,
|
|
146
|
+
ITALIC: 2,
|
|
147
|
+
BOLDITALIC: 3,
|
|
148
|
+
UNDERLINE: 4,
|
|
149
|
+
STRIKEOUT: 8,
|
|
150
|
+
} as const;
|
|
151
|
+
|
|
152
|
+
export const ItemAlignment = {
|
|
153
|
+
NEAR: 0,
|
|
154
|
+
CENTER: 1,
|
|
155
|
+
FAR: 2,
|
|
156
|
+
SAMEASITEM: 3,
|
|
157
|
+
LEFT: 0,
|
|
158
|
+
RIGHT: 2,
|
|
159
|
+
TOP: 0,
|
|
160
|
+
MIDDLE: 1,
|
|
161
|
+
BOTTOM: 2,
|
|
162
|
+
} as const;
|
|
163
|
+
|
|
164
|
+
export const PenAlignment = {
|
|
165
|
+
CENTER: 0,
|
|
166
|
+
INSET: 1,
|
|
167
|
+
} as const;
|
|
168
|
+
|
|
169
|
+
export const LabelScaleUnit = {
|
|
170
|
+
PIXEL: 0,
|
|
171
|
+
MM01: 1,
|
|
172
|
+
} as const;
|
|
173
|
+
|
|
174
|
+
export const ErrorCorrectionLevel = {
|
|
175
|
+
L: 0,
|
|
176
|
+
M: 1,
|
|
177
|
+
Q: 2,
|
|
178
|
+
H: 3,
|
|
179
|
+
} as const;
|
|
180
|
+
|
|
181
|
+
export const BarcodeType1D = {
|
|
182
|
+
UPC_A: 20,
|
|
183
|
+
UPC_E: 21,
|
|
184
|
+
EAN13: 22,
|
|
185
|
+
EAN8: 23,
|
|
186
|
+
CODE39: 24,
|
|
187
|
+
ITF25: 25,
|
|
188
|
+
CODABAR: 26,
|
|
189
|
+
CODE93: 27,
|
|
190
|
+
CODE128: 28,
|
|
191
|
+
ISBN: 29,
|
|
192
|
+
ECODE39: 30,
|
|
193
|
+
AUTO: 60,
|
|
194
|
+
} as const;
|
|
195
|
+
|
|
196
|
+
export const BarcodeType2D = {
|
|
197
|
+
QR_CODE: 41,
|
|
198
|
+
DATA_MATRIX: 42,
|
|
199
|
+
PDF_417: 43,
|
|
200
|
+
} as const;
|
|
201
|
+
|
|
202
|
+
export const ResultCode = {
|
|
203
|
+
OK: 0,
|
|
204
|
+
PARAM_ERROR: 1,
|
|
205
|
+
SYSTEM_ERROR: 2,
|
|
206
|
+
NOPRINTDATA: 5,
|
|
207
|
+
NOPAGEDIMENSION: 6,
|
|
208
|
+
INVALID_FILE: 7,
|
|
209
|
+
PRINTDATANOTREADY: 8,
|
|
210
|
+
} as const;
|