@hoangnh0099/react-native-sunmi-printer 0.2.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/src/index.tsx ADDED
@@ -0,0 +1,205 @@
1
+ import SunmiPrinter from './NativeSunmiPrinter';
2
+
3
+ // Printer Info
4
+ export function getPrinterSerialNo(): Promise<string> {
5
+ return SunmiPrinter.getPrinterSerialNo();
6
+ }
7
+
8
+ export function getPrinterVersion(): Promise<string> {
9
+ return SunmiPrinter.getPrinterVersion();
10
+ }
11
+
12
+ export function getPrinterModal(): Promise<string> {
13
+ return SunmiPrinter.getPrinterModal();
14
+ }
15
+
16
+ export function getPrinterPaper(): Promise<number> {
17
+ return SunmiPrinter.getPrinterPaper();
18
+ }
19
+
20
+ export function getPrinterMode(): Promise<number> {
21
+ return SunmiPrinter.getPrinterMode();
22
+ }
23
+
24
+ export function getServiceVersion(): Promise<string> {
25
+ return SunmiPrinter.getServiceVersion();
26
+ }
27
+
28
+ export function getFirmwareStatus(): Promise<number> {
29
+ return SunmiPrinter.getFirmwareStatus();
30
+ }
31
+
32
+ export function updatePrinterState(): Promise<number> {
33
+ return SunmiPrinter.updatePrinterState();
34
+ }
35
+
36
+ export function getPrintedLength(): Promise<string> {
37
+ return SunmiPrinter.getPrintedLength();
38
+ }
39
+
40
+ export function getPrinterFactory(): Promise<string> {
41
+ return SunmiPrinter.getPrinterFactory();
42
+ }
43
+
44
+ // Initialization
45
+ export function printerInit(): Promise<void> {
46
+ return SunmiPrinter.printerInit();
47
+ }
48
+
49
+ export function printerSelfChecking(): Promise<void> {
50
+ return SunmiPrinter.printerSelfChecking();
51
+ }
52
+
53
+ // Formatting
54
+ export function setAlignment(alignment: number): Promise<void> {
55
+ return SunmiPrinter.setAlignment(alignment);
56
+ }
57
+
58
+ export function setFontName(typeface: string): Promise<void> {
59
+ return SunmiPrinter.setFontName(typeface);
60
+ }
61
+
62
+ export function setFontSize(fontsize: number): Promise<void> {
63
+ return SunmiPrinter.setFontSize(fontsize);
64
+ }
65
+
66
+ export function setPrinterStyle(key: number, value: number): Promise<void> {
67
+ return SunmiPrinter.setPrinterStyle(key, value);
68
+ }
69
+
70
+ // Text
71
+ export function printText(text: string): Promise<void> {
72
+ return SunmiPrinter.printText(text);
73
+ }
74
+
75
+ export function printTextWithFont(
76
+ text: string,
77
+ typeface: string,
78
+ fontsize: number
79
+ ): Promise<void> {
80
+ return SunmiPrinter.printTextWithFont(text, typeface, fontsize);
81
+ }
82
+
83
+ export function printOriginalText(text: string): Promise<void> {
84
+ return SunmiPrinter.printOriginalText(text);
85
+ }
86
+
87
+ // Image
88
+ export function printImage(base64: string): Promise<void> {
89
+ return SunmiPrinter.printImage(base64);
90
+ }
91
+
92
+ export function printBitmapCustom(base64: string, type: number): Promise<void> {
93
+ return SunmiPrinter.printBitmapCustom(base64, type);
94
+ }
95
+
96
+ // Barcode
97
+ export function printBarCode(
98
+ data: string,
99
+ symbology: number,
100
+ height: number,
101
+ width: number,
102
+ textposition: number
103
+ ): Promise<void> {
104
+ return SunmiPrinter.printBarCode(
105
+ data,
106
+ symbology,
107
+ height,
108
+ width,
109
+ textposition
110
+ );
111
+ }
112
+
113
+ export function printQRCode(
114
+ data: string,
115
+ modulesize: number,
116
+ errorlevel: number
117
+ ): Promise<void> {
118
+ return SunmiPrinter.printQRCode(data, modulesize, errorlevel);
119
+ }
120
+
121
+ // Table
122
+ export function printColumnsText(
123
+ texts: string[],
124
+ widths: number[],
125
+ aligns: number[]
126
+ ): Promise<void> {
127
+ return SunmiPrinter.printColumnsText(texts, widths, aligns);
128
+ }
129
+
130
+ export function printColumnsString(
131
+ texts: string[],
132
+ widths: number[],
133
+ aligns: number[]
134
+ ): Promise<void> {
135
+ return SunmiPrinter.printColumnsString(texts, widths, aligns);
136
+ }
137
+
138
+ // Raw
139
+ export function sendRAWData(data: number[]): Promise<void> {
140
+ return SunmiPrinter.sendRAWData(data);
141
+ }
142
+
143
+ // Paper
144
+ export function lineWrap(lines: number): Promise<void> {
145
+ return SunmiPrinter.lineWrap(lines);
146
+ }
147
+
148
+ export function cutPaper(): Promise<void> {
149
+ return SunmiPrinter.cutPaper();
150
+ }
151
+
152
+ export function autoOutPaper(): Promise<void> {
153
+ return SunmiPrinter.autoOutPaper();
154
+ }
155
+
156
+ // Cash Drawer
157
+ export function openDrawer(): Promise<void> {
158
+ return SunmiPrinter.openDrawer();
159
+ }
160
+
161
+ // Label
162
+ export function labelLocate(): Promise<void> {
163
+ return SunmiPrinter.labelLocate();
164
+ }
165
+
166
+ export function labelOutput(): Promise<void> {
167
+ return SunmiPrinter.labelOutput();
168
+ }
169
+
170
+ // LCD
171
+ export function sendLCDCommand(flag: number): Promise<void> {
172
+ return SunmiPrinter.sendLCDCommand(flag);
173
+ }
174
+
175
+ export function sendLCDFillString(
176
+ text: string,
177
+ size: number,
178
+ fill: boolean
179
+ ): Promise<void> {
180
+ return SunmiPrinter.sendLCDFillString(text, size, fill);
181
+ }
182
+
183
+ export function sendLCDMultiString(
184
+ texts: string[],
185
+ align: number[]
186
+ ): Promise<void> {
187
+ return SunmiPrinter.sendLCDMultiString(texts, align);
188
+ }
189
+
190
+ export function sendLCDBitmap(base64: string): Promise<void> {
191
+ return SunmiPrinter.sendLCDBitmap(base64);
192
+ }
193
+
194
+ // Transaction
195
+ export function enterPrinterBuffer(clean: boolean): Promise<void> {
196
+ return SunmiPrinter.enterPrinterBuffer(clean);
197
+ }
198
+
199
+ export function exitPrinterBuffer(commit: boolean): Promise<void> {
200
+ return SunmiPrinter.exitPrinterBuffer(commit);
201
+ }
202
+
203
+ export function commitPrinterBuffer(): Promise<void> {
204
+ return SunmiPrinter.commitPrinterBuffer();
205
+ }