taro-bluetooth-print 2.3.0 → 2.3.1

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.
@@ -0,0 +1,325 @@
1
+ /**
2
+ * ZPL Driver
3
+ * Zebra Printer Language driver for Zebra label printers
4
+ *
5
+ * ZPL is the industry standard for industrial label printing
6
+ */
7
+ /**
8
+ * ZPL Label size configuration
9
+ */
10
+ export interface ZplLabelSize {
11
+ /** Label width in dots */
12
+ width: number;
13
+ /** Label height in dots */
14
+ height: number;
15
+ /** Label gap in dots (default: 0) */
16
+ gap?: number;
17
+ }
18
+ /**
19
+ * Text format options
20
+ */
21
+ export interface ZplTextOptions {
22
+ /** X position in dots */
23
+ x: number;
24
+ /** Y position in dots */
25
+ y: number;
26
+ /** Font name (default: 0 for built-in) */
27
+ font?: string;
28
+ /** Font rotation: N=0, R=90, I=270, B=180 (default: N) */
29
+ rotation?: 'N' | 'R' | 'I' | 'B';
30
+ /** Horizontal magnification (1-10, default: 1) */
31
+ xMultiplier?: number;
32
+ /** Vertical magnification (1-10, default: 1) */
33
+ yMultiplier?: number;
34
+ /** Field orientation: N=normal, R=rotated, I=inverted, B=bottom-up */
35
+ orientation?: 'N' | 'R' | 'I' | 'B';
36
+ }
37
+ /**
38
+ * Barcode options
39
+ */
40
+ export interface ZplBarcodeOptions {
41
+ /** X position in dots */
42
+ x: number;
43
+ /** Y position in dots */
44
+ y: number;
45
+ /** Barcode type: 128, 39, 93, EAN13, EAN8, UPCE, CODE51, etc. */
46
+ type: '128' | '39' | '93' | 'EAN13' | 'EAN8' | 'UPCA' | 'UPCE' | 'CODE51' | 'MSI' | 'PLESSEY';
47
+ /** Barcode height in dots (default: 50) */
48
+ height?: number;
49
+ /** Show human-readable text (default: Y) */
50
+ showText?: 'Y' | 'N';
51
+ /** Check digit: Y=validate, N=no check (default: Y) */
52
+ checkDigit?: 'Y' | 'N';
53
+ /** Interpretation line: Y=print, N=omit (default: Y) */
54
+ interpretLine?: 'Y' | 'N';
55
+ /** Interpretation line above: Y=above, N=below (default: N) */
56
+ interpretLineAbove?: 'Y' | 'N';
57
+ }
58
+ /**
59
+ * QR Code options
60
+ */
61
+ export interface ZplQRCodeOptions {
62
+ /** X position in dots */
63
+ x: number;
64
+ /** Y position in dots */
65
+ y: number;
66
+ /** Model: 2 (default) or 1 */
67
+ model?: 1 | 2;
68
+ /** Magnification factor 1-10 (default: 4) */
69
+ magnification?: number;
70
+ /** Error correction level: L(~7%), M(~15%), Q(~25%), H(~30%) */
71
+ errorCorrection?: 'L' | 'M' | 'Q' | 'H';
72
+ }
73
+ /**
74
+ * Box/Rectangle options
75
+ */
76
+ export interface ZplBoxOptions {
77
+ /** X position in dots */
78
+ x: number;
79
+ /** Y position in dots */
80
+ y: number;
81
+ /** Width in dots */
82
+ width: number;
83
+ /** Height in dots */
84
+ height: number;
85
+ /** Border thickness (default: 2) */
86
+ borderThickness?: number;
87
+ /** Corner rounding (0-10, default: 0) */
88
+ cornerRounding?: number;
89
+ }
90
+ /**
91
+ * ZPL Driver for Zebra label printers
92
+ *
93
+ * @example
94
+ * ```typescript
95
+ * const zpl = new ZplDriver();
96
+ *
97
+ * const commands = zpl
98
+ * .startFormat()
99
+ * .labelHome(10, 10)
100
+ * .text('Product Name', { x: 50, y: 50 })
101
+ * .barcode('1234567890', { x: 50, y: 150, type: '128' })
102
+ * .qrcode('https://example.com', { x: 300, y: 50 })
103
+ * .print()
104
+ * .getCommands();
105
+ * ```
106
+ */
107
+ export declare class ZplDriver {
108
+ private commands;
109
+ private readonly logger;
110
+ /**
111
+ * Initialize ZPL driver with default settings
112
+ */
113
+ constructor();
114
+ /**
115
+ * Start label format (^XA)
116
+ */
117
+ startFormat(): this;
118
+ /**
119
+ * End label format (^XZ)
120
+ */
121
+ endFormat(): this;
122
+ /**
123
+ * Set label home position
124
+ * @param x - X position in dots
125
+ * @param y - Y position in dots
126
+ */
127
+ labelHome(x: number, y: number): this;
128
+ /**
129
+ * Set field data (^FD)
130
+ * @param content - Field content
131
+ */
132
+ fieldData(content: string): this;
133
+ /**
134
+ * Set field origin
135
+ * @param x - X position in dots
136
+ * @param y - Y position in dots
137
+ */
138
+ fieldOrigin(x: number, y: number): this;
139
+ /**
140
+ * Set print width
141
+ * @param width - Width in dots
142
+ */
143
+ printWidth(width: number): this;
144
+ /**
145
+ * Set label length
146
+ * @param length - Length in dots
147
+ */
148
+ labelLength(length: number): this;
149
+ /**
150
+ * Set label gap
151
+ * @param gap - Gap in dots
152
+ */
153
+ labelGap(gap: number): this;
154
+ /**
155
+ * Set print quantity
156
+ * @param quantity - Number of labels
157
+ */
158
+ quantity(quantity: number): this;
159
+ /**
160
+ * Add text to label
161
+ * @param content - Text content
162
+ * @param options - Text options
163
+ */
164
+ text(content: string, options?: ZplTextOptions): this;
165
+ /**
166
+ * Add text with explicit field origin
167
+ * @param content - Text content
168
+ * @param x - X position
169
+ * @param y - Y position
170
+ * @param font - Font name (default: 0)
171
+ * @param rotation - Rotation
172
+ */
173
+ textAt(content: string, x: number, y: number, font?: string, rotation?: 'N' | 'R' | 'I' | 'B'): this;
174
+ /**
175
+ * Use built-in font
176
+ * @param content - Text content
177
+ * @param x - X position
178
+ * @param y - Y position
179
+ * @param height - Character height (40-400)
180
+ * @param width - Character width (30-300)
181
+ */
182
+ font(content: string, x: number, y: number, height?: number, width?: number): this;
183
+ /**
184
+ * Add scalable font
185
+ * @param content - Text content
186
+ * @param x - X position
187
+ * @param y - Y position
188
+ * @param fontName - Font name (e.g., "0" for built-in, or loaded font name)
189
+ * @param fontHeight - Height multiplier
190
+ * @param fontWidth - Width multiplier
191
+ */
192
+ scalableText(content: string, x: number, y: number, fontName?: string, fontHeight?: number, fontWidth?: number): this;
193
+ /**
194
+ * Add barcode
195
+ * @param content - Barcode content
196
+ * @param options - Barcode options
197
+ */
198
+ barcode(content: string, options: ZplBarcodeOptions): this;
199
+ /**
200
+ * Add Code 128 barcode
201
+ * @param content - Barcode content
202
+ * @param x - X position
203
+ * @param y - Y position
204
+ * @param height - Barcode height
205
+ */
206
+ code128(content: string, x?: number, y?: number, height?: number): this;
207
+ /**
208
+ * Add Code 39 barcode
209
+ * @param content - Barcode content
210
+ * @param x - X position
211
+ * @param y - Y position
212
+ * @param height - Barcode height
213
+ */
214
+ code39(content: string, x?: number, y?: number, height?: number): this;
215
+ /**
216
+ * Add EAN-13 barcode
217
+ * @param content - Barcode content (12 or 13 digits)
218
+ * @param x - X position
219
+ * @param y - Y position
220
+ * @param height - Barcode height
221
+ */
222
+ ean13(content: string, x?: number, y?: number, height?: number): this;
223
+ /**
224
+ * Add QR code
225
+ * @param content - QR code content
226
+ * @param options - QR code options
227
+ */
228
+ qrcode(content: string, options?: ZplQRCodeOptions): this;
229
+ /**
230
+ * Add rectangle/border
231
+ * @param options - Box options
232
+ */
233
+ box(options: ZplBoxOptions): this;
234
+ /**
235
+ * Add line
236
+ * @param x1 - Start X
237
+ * @param y1 - Start Y
238
+ * @param x2 - End X
239
+ * @param y2 - End Y
240
+ * @param thickness - Line thickness
241
+ */
242
+ line(x1: number, y1: number, x2: number, y2: number, thickness?: number): this;
243
+ /**
244
+ * Add circle
245
+ * @param x - Center X
246
+ * @param y - Center Y
247
+ * @param diameter - Diameter in dots
248
+ * @param borderThickness - Border thickness
249
+ */
250
+ circle(x: number, y: number, diameter: number, borderThickness?: number): this;
251
+ /**
252
+ * Add diagonal line
253
+ * @param x - Start X
254
+ * @param y - Start Y
255
+ * @param width - Width
256
+ * @param height - Height
257
+ * @param thickness - Line thickness
258
+ */
259
+ diagonal(x: number, y: number, width: number, height: number, thickness?: number): this;
260
+ /**
261
+ * Add ellipse
262
+ * @param x - Center X
263
+ * @param y - Center Y
264
+ * @param width - Width
265
+ * @param height - Height
266
+ * @param borderThickness - Border thickness
267
+ */
268
+ ellipse(x: number, y: number, width: number, height: number, borderThickness?: number): this;
269
+ /**
270
+ * Add image from raw bitmap
271
+ * Note: For best results, use pre-processed images. This is a placeholder for future implementation.
272
+ * @param _x - X position (placeholder)
273
+ * @param _y - Y position (placeholder)
274
+ * @param _width - Image width (placeholder)
275
+ * @param _height - Image height (placeholder)
276
+ * @param _bitmap - Binary bitmap data (placeholder)
277
+ */
278
+ image(_x: number, _y: number, _width: number, _height: number, _bitmap: Uint8Array): this;
279
+ /**
280
+ * Set darkness/print density
281
+ * @param value - Darkness value (0-30, default: 15)
282
+ */
283
+ setDarkness(value?: number): this;
284
+ /**
285
+ * Set print speed
286
+ * @param speed - Speed: 1=slowest, 2-5=medium, 6-13=fast, 14=max
287
+ */
288
+ setSpeed(speed: number): this;
289
+ /**
290
+ * Print configuration label (useful for testing)
291
+ */
292
+ printConfigLabel(): this;
293
+ /**
294
+ * Calibrate sensors
295
+ */
296
+ calibrate(): this;
297
+ /**
298
+ * Reset printer
299
+ */
300
+ reset(): this;
301
+ /**
302
+ * Get all commands as string
303
+ */
304
+ getCommands(): string;
305
+ /**
306
+ * Get commands as buffer for sending to printer
307
+ */
308
+ getBuffer(): Uint8Array;
309
+ /**
310
+ * Get raw command list
311
+ */
312
+ getCommandList(): string[];
313
+ /**
314
+ * Clear all commands
315
+ */
316
+ resetCommands(): this;
317
+ /**
318
+ * Print label (end format)
319
+ */
320
+ print(quantity?: number): this;
321
+ /**
322
+ * Escape special characters in field data
323
+ */
324
+ private escapeField;
325
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Printer Drivers Module
3
+ * 打印机驱动模块 - 支持多种打印机协议
4
+ */
5
+ export { EscPos, type EscPosOptions } from './EscPos';
6
+ export { GPrinterDriver, type GPrinterOptions } from './GPrinterDriver';
7
+ export { TsplDriver, type LabelSize, type TextOptions, type BarcodeOptions, type QRCodeOptions, type BoxOptions, type LineOptions, } from './TsplDriver';
8
+ export { ZplDriver, type ZplLabelSize, type ZplTextOptions, type ZplBarcodeOptions, type ZplQRCodeOptions, type ZplBoxOptions, } from './ZplDriver';
9
+ export { CpclDriver, type CPCLPageSize, type CpclTextOptions, type CpclBarcodeOptions, type CpclQRCodeOptions, type CpclLineOptions, type CpclBoxOptions, } from './CpclDriver';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 精简版 GBK 编码数据
3
+ * 包含约 3500 个最常用汉字,覆盖 99% 日常使用场景
4
+ * 使用二分查找,内存占用极低
5
+ */
6
+ export declare const GBK_LITE: number[];
7
+ export declare function binarySearchGbk(unicode: number): number | null;
8
+ export declare function isInCommonRange(unicode: number): boolean;
@@ -1,53 +1,31 @@
1
1
  /**
2
- * GBK Encoding Table
2
+ * GBK Encoding Table - 懒加载版本
3
3
  *
4
- * This module provides character mapping tables for GBK, GB2312, and Big5 encodings.
5
- * GBK is a superset of GB2312 and covers most Chinese characters used in simplified Chinese.
6
- * Big5 is used for traditional Chinese characters.
4
+ * 优化策略:
5
+ * 1. 默认使用精简版编码表 (gbk-lite.ts,约 3500 常用字)
6
+ * 2. 遇到非常用字时动态加载完整编码表
7
+ * 3. 二分查找代替 Map,大幅减少内存占用
7
8
  *
8
- * GBK encoding uses double-byte encoding for Chinese characters:
9
- * - First byte: 0x81-0xFE
10
- * - Second byte: 0x40-0xFE (excluding 0x7F)
11
- *
12
- * 映射数据存储在 gbk-data.ts 中,运行时解码为 Map。
13
9
  * GBK: 23940 个字符映射
14
10
  * Big5: 13911 个字符映射
15
11
  */
16
- /**
17
- * Unicode to GBK mapping table
18
- * Maps Unicode code points to GBK byte pairs
19
- */
20
12
  export declare const unicodeToGbk: Map<number, number>;
21
- /**
22
- * GBK to Unicode mapping table
23
- * Maps GBK byte pairs to Unicode code points
24
- */
25
13
  export declare const gbkToUnicode: Map<number, number>;
26
- /**
27
- * Unicode to Big5 mapping table
28
- */
29
14
  export declare const unicodeToBig5: Map<number, number>;
30
- /**
31
- * Big5 to Unicode mapping table
32
- */
33
15
  export declare const big5ToUnicode: Map<number, number>;
34
16
  /**
35
17
  * Get GBK bytes for a Unicode character
36
- * @param unicode - Unicode code point
37
- * @returns GBK byte pair [high, low] or null if not found
18
+ * 先查精简表,查不到再懒加载完整表
38
19
  */
39
20
  export declare function getGbkBytes(unicode: number): [number, number] | null;
40
21
  /**
41
22
  * Get Unicode character from GBK bytes
42
- * @param high - High byte
43
- * @param low - Low byte
44
- * @returns Unicode code point or null if not found
23
+ * 懒加载完整表
45
24
  */
46
25
  export declare function getUnicodeFromGbk(high: number, low: number): number | null;
47
26
  /**
48
27
  * Get Big5 bytes for a Unicode character
49
- * @param unicode - Unicode code point
50
- * @returns Big5 byte pair or null if not found
28
+ * 懒加载完整表
51
29
  */
52
30
  export declare function getBig5Bytes(unicode: number): [number, number] | null;
53
31
  /**
@@ -1,22 +1,22 @@
1
1
  /**
2
2
  * Taro Bluetooth Print Library
3
- * A lightweight, high-performance Bluetooth printing library for Taro
3
+ * 轻量级、高性能的蓝牙打印库
4
4
  *
5
5
  * @packageDocumentation
6
6
  */
7
7
  export { BluetoothPrinter } from './core/BluetoothPrinter';
8
8
  export type { PrinterEvents } from './core/BluetoothPrinter';
9
9
  export { EventEmitter } from './core/EventEmitter';
10
- export { EscPos } from './drivers/EscPos';
11
- export { TsplDriver } from './drivers/TsplDriver';
12
- export type { LabelSize, TextOptions as TsplTextOptions, BarcodeOptions as TsplBarcodeOptions, QRCodeOptions as TsplQRCodeOptions, BoxOptions, LineOptions, } from './drivers/TsplDriver';
10
+ export * from './drivers';
13
11
  export { TaroAdapter } from './adapters/TaroAdapter';
12
+ export { AlipayAdapter } from './adapters/AlipayAdapter';
13
+ export { BaiduAdapter } from './adapters/BaiduAdapter';
14
+ export { ByteDanceAdapter } from './adapters/ByteDanceAdapter';
15
+ export { WebBluetoothAdapter } from './adapters/WebBluetoothAdapter';
14
16
  export { AdapterFactory } from './adapters/AdapterFactory';
15
17
  export { BaseAdapter } from './adapters/BaseAdapter';
16
- export { WebBluetoothAdapter } from './adapters/WebBluetoothAdapter';
17
18
  export type { WebBluetoothRequestOptions } from './adapters/WebBluetoothAdapter';
18
- export { ConnectionManager } from './services/ConnectionManager';
19
- export type { ConnectionManagerConfig, ConnectionManagerEvents, } from './services/ConnectionManager';
19
+ export * from './services';
20
20
  export { DeviceManager } from './device/DeviceManager';
21
21
  export type { BluetoothDevice, ScanOptions, DeviceManagerEvents } from './device/DeviceManager';
22
22
  export { PrintQueue } from './queue/PrintQueue';
@@ -54,7 +54,7 @@ export declare class ConnectionManager extends EventEmitter<ConnectionManagerEve
54
54
  private adapter;
55
55
  private deviceId;
56
56
  private state;
57
- private readonly logger;
57
+ private readonly connLogger;
58
58
  private readonly config;
59
59
  private heartbeatTimer;
60
60
  private reconnectAttempts;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Services Module
3
+ * 服务模块 - 提供连接管理、命令构建、任务管理等功能
4
+ */
5
+ export { ConnectionManager, type ConnectionManagerConfig, type ConnectionManagerEvents, } from './ConnectionManager';
6
+ export { CommandBuilder } from './CommandBuilder';
7
+ export { PrintJobManager } from './PrintJobManager';
8
+ export * from './interfaces';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taro-bluetooth-print",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "Taro 蓝牙打印库 v2.3 - 轻量级、高性能、跨平台支持微信、支付宝、百度、字节跳动小程序及H5 Web Bluetooth",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",
@@ -13,6 +13,18 @@
13
13
  "require": "./dist/index.cjs.js",
14
14
  "default": "./dist/index.umd.js"
15
15
  },
16
+ "./core": {
17
+ "types": "./dist/types/core/index.d.ts",
18
+ "import": "./dist/core/index.es.js"
19
+ },
20
+ "./drivers": {
21
+ "types": "./dist/types/drivers/index.d.ts",
22
+ "import": "./dist/drivers/index.es.js"
23
+ },
24
+ "./adapters": {
25
+ "types": "./dist/types/adapters/index.d.ts",
26
+ "import": "./dist/adapters/index.es.js"
27
+ },
16
28
  "./package.json": "./package.json"
17
29
  },
18
30
  "files": [
@@ -49,13 +61,19 @@
49
61
  ],
50
62
  "author": "Agions",
51
63
  "license": "MIT",
52
- "dependencies": {
53
- "@tarojs/taro": "^4.1.11"
64
+ "peerDependencies": {
65
+ "@tarojs/taro": "^3.6.22"
66
+ },
67
+ "peerDependenciesMeta": {
68
+ "@tarojs/taro": {
69
+ "optional": true
70
+ }
54
71
  },
55
72
  "devDependencies": {
56
73
  "@types/node": "^20.14.8",
57
- "@typescript-eslint/eslint-plugin": "^6.19.0",
58
- "@typescript-eslint/parser": "^6.19.0",
74
+ "@types/web-bluetooth": "^0.0.21",
75
+ "@typescript-eslint/eslint-plugin": "^8.57.1",
76
+ "@typescript-eslint/parser": "^8.57.1",
59
77
  "@vitest/coverage-v8": "^4.0.18",
60
78
  "eslint": "^8.56.0",
61
79
  "eslint-config-prettier": "^9.1.0",
@@ -67,7 +85,7 @@
67
85
  "typescript": "^5.9.3",
68
86
  "vite": "^7.3.1",
69
87
  "vite-plugin-dts": "^4.5.4",
70
- "vitepress": "^1.0.0",
88
+ "vitepress": "^1.6.4",
71
89
  "vitest": "^4.0.18"
72
90
  },
73
91
  "sideEffects": false
@@ -242,15 +242,13 @@ export abstract class MiniProgramAdapter extends BaseAdapter {
242
242
  this.logger.info('Device connected successfully');
243
243
 
244
244
  // Listen for connection state changes
245
- this.getApi().onBLEConnectionStateChange(
246
- (res: { deviceId: string; connected: boolean }) => {
247
- if (res.deviceId === deviceId && !res.connected) {
248
- this.logger.warn('Device disconnected unexpectedly');
249
- this.updateState(PrinterState.DISCONNECTED);
250
- this.cleanupDevice(deviceId);
251
- }
245
+ this.getApi().onBLEConnectionStateChange((res: { deviceId: string; connected: boolean }) => {
246
+ if (res.deviceId === deviceId && !res.connected) {
247
+ this.logger.warn('Device disconnected unexpectedly');
248
+ this.updateState(PrinterState.DISCONNECTED);
249
+ this.cleanupDevice(deviceId);
252
250
  }
253
- );
251
+ });
254
252
  } catch (error) {
255
253
  this.updateState(PrinterState.DISCONNECTED);
256
254
  this.logger.error('Connection failed:', error);
@@ -60,7 +60,7 @@ export interface PrinterEvents {
60
60
  * ```
61
61
  */
62
62
  export class BluetoothPrinter extends EventEmitter<PrinterEvents> {
63
- private readonly logger = Logger.scope('BluetoothPrinter');
63
+ private readonly printerLogger = Logger.scope('BluetoothPrinter');
64
64
 
65
65
  /** Current printer state */
66
66
  public state: PrinterState = PrinterState.DISCONNECTED;
@@ -155,7 +155,7 @@ export class BluetoothPrinter extends EventEmitter<PrinterEvents> {
155
155
  }
156
156
 
157
157
  this.emit('state-change', this.state);
158
- this.logger.debug('State updated:', this.state);
158
+ this.printerLogger.debug('State updated:', this.state);
159
159
  }
160
160
 
161
161
  /**
@@ -171,13 +171,13 @@ export class BluetoothPrinter extends EventEmitter<PrinterEvents> {
171
171
  * ```
172
172
  */
173
173
  async connect(deviceId: string): Promise<this> {
174
- this.logger.info('Connecting to device:', deviceId);
174
+ this.printerLogger.info('Connecting to device:', deviceId);
175
175
 
176
176
  try {
177
177
  await this.connectionManager.connect(deviceId);
178
178
  this.updateState();
179
179
  this.emit('connected', deviceId);
180
- this.logger.info('Connected successfully');
180
+ this.printerLogger.info('Connected successfully');
181
181
 
182
182
  return this;
183
183
  } catch (error) {
@@ -208,18 +208,18 @@ export class BluetoothPrinter extends EventEmitter<PrinterEvents> {
208
208
  async disconnect(): Promise<void> {
209
209
  const deviceId = this.connectionManager.getDeviceId();
210
210
  if (!deviceId) {
211
- this.logger.warn('Disconnect called but no device connected');
211
+ this.printerLogger.warn('Disconnect called but no device connected');
212
212
  return;
213
213
  }
214
214
 
215
- this.logger.info('Disconnecting from device:', deviceId);
215
+ this.printerLogger.info('Disconnecting from device:', deviceId);
216
216
 
217
217
  try {
218
218
  await this.connectionManager.disconnect();
219
219
  this.printJobManager.cancel();
220
220
  this.updateState();
221
221
  this.emit('disconnected', deviceId);
222
- this.logger.info('Disconnected successfully');
222
+ this.printerLogger.info('Disconnected successfully');
223
223
  } catch (error) {
224
224
  const printError = new BluetoothPrintError(
225
225
  ErrorCode.DEVICE_DISCONNECTED,
@@ -346,7 +346,7 @@ export class BluetoothPrinter extends EventEmitter<PrinterEvents> {
346
346
  pause(): void {
347
347
  this.printJobManager.pause();
348
348
  this.updateState();
349
- this.logger.info('Print job paused');
349
+ this.printerLogger.info('Print job paused');
350
350
  }
351
351
 
352
352
  /**
@@ -360,12 +360,12 @@ export class BluetoothPrinter extends EventEmitter<PrinterEvents> {
360
360
  * ```
361
361
  */
362
362
  async resume(): Promise<void> {
363
- this.logger.info('Resuming print job');
363
+ this.printerLogger.info('Resuming print job');
364
364
 
365
365
  try {
366
366
  await this.printJobManager.resume();
367
367
  this.updateState();
368
- this.logger.info('Print job resumed');
368
+ this.printerLogger.info('Print job resumed');
369
369
  } catch (error) {
370
370
  const printError = new BluetoothPrintError(
371
371
  ErrorCode.PRINT_JOB_FAILED,
@@ -390,7 +390,7 @@ export class BluetoothPrinter extends EventEmitter<PrinterEvents> {
390
390
  this.printJobManager.cancel();
391
391
  this.commandBuilder.clear();
392
392
  this.updateState();
393
- this.logger.info('Print job cancelled');
393
+ this.printerLogger.info('Print job cancelled');
394
394
  }
395
395
 
396
396
  /**
@@ -439,7 +439,7 @@ export class BluetoothPrinter extends EventEmitter<PrinterEvents> {
439
439
  }
440
440
 
441
441
  const buffer = this.commandBuilder.getBuffer();
442
- this.logger.info(`Starting print job: ${buffer.length} bytes`);
442
+ this.printerLogger.info(`Starting print job: ${buffer.length} bytes`);
443
443
 
444
444
  // Clear the command buffer after getting the buffer for printing
445
445
  this.commandBuilder.clear();
@@ -462,14 +462,14 @@ export class BluetoothPrinter extends EventEmitter<PrinterEvents> {
462
462
 
463
463
  if (isPaused) {
464
464
  // Print job was paused
465
- this.logger.info('Print job paused');
465
+ this.printerLogger.info('Print job paused');
466
466
  } else {
467
467
  // Print job completed successfully
468
468
  this.emit('print-complete');
469
- this.logger.info('Print job completed successfully');
469
+ this.printerLogger.info('Print job completed successfully');
470
470
  }
471
471
  } catch (error) {
472
- this.logger.error('Print job failed with error:', error);
472
+ this.printerLogger.error('Print job failed with error:', error);
473
473
  const printError =
474
474
  error instanceof BluetoothPrintError
475
475
  ? error