@rdlabo/capacitor-brotherprint 8.2.0 → 8.2.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.
- package/README.md +7 -0
- package/dist/esm/index.d.ts +49 -0
- package/dist/esm/index.js +184 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/models.d.ts +2 -0
- package/dist/esm/models.js +10 -0
- package/dist/esm/models.js.map +1 -0
- package/dist/esm/printer.d.ts +9 -0
- package/dist/esm/printer.js +46 -0
- package/dist/esm/printer.js.map +1 -0
- package/dist/plugin.cjs.js +274 -34
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +274 -34
- package/dist/plugin.js.map +1 -1
- package/docs/connection-management.md +151 -0
- package/docs/helper-design.md +42 -0
- package/package.json +4 -2
package/dist/plugin.js
CHANGED
|
@@ -1,40 +1,6 @@
|
|
|
1
1
|
var capacitorExample = (function (exports, core) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
class BrotherPrintWeb extends core.WebPlugin {
|
|
5
|
-
async printImage(options) {
|
|
6
|
-
console.log('printImage', options);
|
|
7
|
-
}
|
|
8
|
-
async isChannelAvailable(options) {
|
|
9
|
-
console.log('isChannelAvailable', options);
|
|
10
|
-
return {
|
|
11
|
-
result: false,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
async search(options) {
|
|
15
|
-
console.log('search', options);
|
|
16
|
-
}
|
|
17
|
-
async cancelSearchWiFiPrinter() {
|
|
18
|
-
console.log('cancelSearchWiFiPrinter');
|
|
19
|
-
}
|
|
20
|
-
async cancelSearchBluetoothPrinter() {
|
|
21
|
-
console.log('cancelSearchBluetoothPrinter');
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
var web = /*#__PURE__*/Object.freeze({
|
|
26
|
-
__proto__: null,
|
|
27
|
-
BrotherPrintWeb: BrotherPrintWeb
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
exports.BrotherPrintEventsEnum = void 0;
|
|
31
|
-
(function (BrotherPrintEventsEnum) {
|
|
32
|
-
BrotherPrintEventsEnum["onPrinterAvailable"] = "onPrinterAvailable";
|
|
33
|
-
BrotherPrintEventsEnum["onPrint"] = "onPrint";
|
|
34
|
-
BrotherPrintEventsEnum["onPrintFailedCommunication"] = "onPrintFailedCommunication";
|
|
35
|
-
BrotherPrintEventsEnum["onPrintError"] = "onPrintError";
|
|
36
|
-
})(exports.BrotherPrintEventsEnum || (exports.BrotherPrintEventsEnum = {}));
|
|
37
|
-
|
|
38
4
|
exports.BRLMPrinterPort = void 0;
|
|
39
5
|
(function (BRLMPrinterPort) {
|
|
40
6
|
BRLMPrinterPort["usb"] = "usb";
|
|
@@ -194,12 +160,286 @@ var capacitorExample = (function (exports, core) {
|
|
|
194
160
|
// High = 'High',
|
|
195
161
|
// }
|
|
196
162
|
|
|
163
|
+
exports.BrotherPrintEventsEnum = void 0;
|
|
164
|
+
(function (BrotherPrintEventsEnum) {
|
|
165
|
+
BrotherPrintEventsEnum["onPrinterAvailable"] = "onPrinterAvailable";
|
|
166
|
+
BrotherPrintEventsEnum["onPrint"] = "onPrint";
|
|
167
|
+
BrotherPrintEventsEnum["onPrintFailedCommunication"] = "onPrintFailedCommunication";
|
|
168
|
+
BrotherPrintEventsEnum["onPrintError"] = "onPrintError";
|
|
169
|
+
})(exports.BrotherPrintEventsEnum || (exports.BrotherPrintEventsEnum = {}));
|
|
170
|
+
|
|
171
|
+
const printerPorts = {
|
|
172
|
+
[exports.BRLMPrinterModelName.QL_800]: [exports.BRLMPrinterPort.usb],
|
|
173
|
+
[exports.BRLMPrinterModelName.QL_810W]: [exports.BRLMPrinterPort.wifi, exports.BRLMPrinterPort.usb],
|
|
174
|
+
[exports.BRLMPrinterModelName.QL_820NWB]: [exports.BRLMPrinterPort.wifi, exports.BRLMPrinterPort.bluetooth, exports.BRLMPrinterPort.usb],
|
|
175
|
+
[exports.BRLMPrinterModelName.TD_2320D_203]: [exports.BRLMPrinterPort.wifi, exports.BRLMPrinterPort.usb],
|
|
176
|
+
[exports.BRLMPrinterModelName.TD_2030AD]: [exports.BRLMPrinterPort.usb],
|
|
177
|
+
[exports.BRLMPrinterModelName.TD_2350D_300]: [exports.BRLMPrinterPort.wifi, exports.BRLMPrinterPort.bluetooth, exports.BRLMPrinterPort.usb, exports.BRLMPrinterPort.bluetoothLowEnergy],
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
/** Common display names for connection transports. */
|
|
181
|
+
function brotherPrinterPortLabel(port) {
|
|
182
|
+
switch (port) {
|
|
183
|
+
case exports.BRLMPrinterPort.wifi:
|
|
184
|
+
return 'Wi-Fi';
|
|
185
|
+
case exports.BRLMPrinterPort.bluetooth:
|
|
186
|
+
return 'Bluetooth';
|
|
187
|
+
case exports.BRLMPrinterPort.bluetoothLowEnergy:
|
|
188
|
+
return 'Bluetooth LE';
|
|
189
|
+
case exports.BRLMPrinterPort.usb:
|
|
190
|
+
return 'USB';
|
|
191
|
+
default:
|
|
192
|
+
return '';
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/** Connection choices for the existing models. USB is Android-only; wifi also covers Ethernet. */
|
|
196
|
+
function brotherPrinterPorts(model, isAndroid = core.Capacitor.getPlatform() === 'android') {
|
|
197
|
+
if (!Object.values(exports.BRLMPrinterModelName).includes(model))
|
|
198
|
+
return [];
|
|
199
|
+
return printerPorts[model].filter((port) => isAndroid || port !== exports.BRLMPrinterPort.usb);
|
|
200
|
+
}
|
|
201
|
+
/** Keep a supported saved port; otherwise prefer USB for QL-800/810W on Android. */
|
|
202
|
+
function resolveBrotherPrinterPort(model, saved) {
|
|
203
|
+
const ports = brotherPrinterPorts(model);
|
|
204
|
+
if (saved && ports.includes(saved))
|
|
205
|
+
return saved;
|
|
206
|
+
if (ports.includes(exports.BRLMPrinterPort.usb) &&
|
|
207
|
+
(model === exports.BRLMPrinterModelName.QL_800 || model === exports.BRLMPrinterModelName.QL_810W))
|
|
208
|
+
return exports.BRLMPrinterPort.usb;
|
|
209
|
+
return ports[0];
|
|
210
|
+
}
|
|
211
|
+
/** Match discovery names to an existing model enum, including documented product aliases. */
|
|
212
|
+
function brotherPrinterModel(name) {
|
|
213
|
+
const key = name
|
|
214
|
+
.trim()
|
|
215
|
+
.toUpperCase()
|
|
216
|
+
.replace(/^BROTHER\s+/, '')
|
|
217
|
+
.replace(/[-_ ]/g, '');
|
|
218
|
+
// Product names omit TD resolution; QL-820NWBc and TD-2030A use the existing enum spellings.
|
|
219
|
+
const product = key === 'QL820NWBC' ? 'QL820NWB' : key === 'TD2030A' ? 'TD2030AD' : key;
|
|
220
|
+
return Object.values(exports.BRLMPrinterModelName).find((model) => model.replace(/_/g, '') === product || model.replace(/_(203|300)$/, '').replace(/_/g, '') === product);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
class BrotherPrintWeb extends core.WebPlugin {
|
|
224
|
+
async printImage(options) {
|
|
225
|
+
console.log('printImage', options);
|
|
226
|
+
}
|
|
227
|
+
async isChannelAvailable(options) {
|
|
228
|
+
console.log('isChannelAvailable', options);
|
|
229
|
+
return {
|
|
230
|
+
result: false,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
async search(options) {
|
|
234
|
+
console.log('search', options);
|
|
235
|
+
}
|
|
236
|
+
async cancelSearchWiFiPrinter() {
|
|
237
|
+
console.log('cancelSearchWiFiPrinter');
|
|
238
|
+
}
|
|
239
|
+
async cancelSearchBluetoothPrinter() {
|
|
240
|
+
console.log('cancelSearchBluetoothPrinter');
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
245
|
+
__proto__: null,
|
|
246
|
+
BrotherPrintWeb: BrotherPrintWeb
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
250
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
251
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
252
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
253
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
254
|
+
};
|
|
255
|
+
var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
256
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
257
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
258
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
259
|
+
};
|
|
260
|
+
var _BrotherPrinterSession_instances, _BrotherPrinterSession_closed, _BrotherPrinterSession_printers, _BrotherPrinterSession_listeners, _BrotherPrinterSession_listening, _BrotherPrinterSession_disposal, _BrotherPrinterSession_storage, _BrotherPrinterSession_storageKey, _BrotherPrinterSession_readSavedPrinter, _BrotherPrinterSession_savePrinter, _BrotherPrinterSession_discover;
|
|
197
261
|
const BrotherPrint = core.registerPlugin('BrotherPrint', {
|
|
198
262
|
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.BrotherPrintWeb()),
|
|
199
263
|
});
|
|
264
|
+
// Native discovery events are shared. Keep each helper call's listener scoped to its turn.
|
|
265
|
+
let connectionQueue = Promise.resolve();
|
|
266
|
+
function queueConnection(run) {
|
|
267
|
+
const result = connectionQueue.then(run);
|
|
268
|
+
connectionQueue = result.catch(() => undefined);
|
|
269
|
+
return result;
|
|
270
|
+
}
|
|
271
|
+
/** Collect discovery results, waiting for earlier helper calls to finish. */
|
|
272
|
+
function searchBrotherPrinters(options, model) {
|
|
273
|
+
return queueConnection(() => discoverPrinters(options, model));
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Reuse a matching, available previous channel; otherwise discover printers.
|
|
277
|
+
* The caller owns storage. USB always discovers again through the native permission flow.
|
|
278
|
+
* Availability errors propagate; only an unavailable channel triggers discovery.
|
|
279
|
+
*/
|
|
280
|
+
function prepareBrotherPrinters(options, model, previous) {
|
|
281
|
+
return queueConnection(() => preparePrinters(options, model, previous));
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Check an explicitly selected address without discovery or fallback to another printer.
|
|
285
|
+
* Port must be supplied; an address does not identify its transport or printer model.
|
|
286
|
+
*/
|
|
287
|
+
function checkBrotherPrinterChannel(channel) {
|
|
288
|
+
return queueConnection(async () => {
|
|
289
|
+
const { result } = await BrotherPrint.isChannelAvailable(Object.assign({ modelName: '', serialNumber: '', macAddress: '', nodeName: '', location: '' }, channel));
|
|
290
|
+
return result;
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
async function discoverPrinters(options, model, active = () => true) {
|
|
294
|
+
const printers = [];
|
|
295
|
+
const listener = await BrotherPrint.addListener(exports.BrotherPrintEventsEnum.onPrinterAvailable, (printer) => {
|
|
296
|
+
if (printer.port !== options.port)
|
|
297
|
+
return;
|
|
298
|
+
if (printer.port !== exports.BRLMPrinterPort.usb && model !== undefined && brotherPrinterModel(printer.modelName) !== model)
|
|
299
|
+
return;
|
|
300
|
+
const index = printers.findIndex((current) => current.port === printer.port && current.channelInfo === printer.channelInfo);
|
|
301
|
+
if (index < 0)
|
|
302
|
+
printers.push(printer);
|
|
303
|
+
else
|
|
304
|
+
printers[index] = printer;
|
|
305
|
+
});
|
|
306
|
+
await (active() ? BrotherPrint.search(options) : Promise.resolve()).finally(() => listener.remove());
|
|
307
|
+
return printers;
|
|
308
|
+
}
|
|
309
|
+
async function preparePrinters(options, model, previous, active = () => true) {
|
|
310
|
+
if (options.port !== exports.BRLMPrinterPort.usb &&
|
|
311
|
+
(previous === null || previous === void 0 ? void 0 : previous.port) === options.port &&
|
|
312
|
+
previous.channelInfo.trim() &&
|
|
313
|
+
brotherPrinterModel(previous.modelName) === model) {
|
|
314
|
+
const available = await BrotherPrint.isChannelAvailable(previous);
|
|
315
|
+
if (available.result)
|
|
316
|
+
return [previous];
|
|
317
|
+
}
|
|
318
|
+
return active() ? discoverPrinters(options, model, active) : [];
|
|
319
|
+
}
|
|
320
|
+
/** One print screen's discovery results and event subscriptions. Create a new session after disposal. */
|
|
321
|
+
class BrotherPrinterSession {
|
|
322
|
+
constructor(options = {}) {
|
|
323
|
+
var _a;
|
|
324
|
+
_BrotherPrinterSession_instances.add(this);
|
|
325
|
+
_BrotherPrinterSession_closed.set(this, false);
|
|
326
|
+
_BrotherPrinterSession_printers.set(this, []);
|
|
327
|
+
_BrotherPrinterSession_listeners.set(this, []);
|
|
328
|
+
_BrotherPrinterSession_listening.set(this, void 0);
|
|
329
|
+
_BrotherPrinterSession_disposal.set(this, void 0);
|
|
330
|
+
_BrotherPrinterSession_storage.set(this, void 0);
|
|
331
|
+
_BrotherPrinterSession_storageKey.set(this, void 0);
|
|
332
|
+
__classPrivateFieldSet(this, _BrotherPrinterSession_storage, options.storage, "f");
|
|
333
|
+
__classPrivateFieldSet(this, _BrotherPrinterSession_storageKey, `${(_a = options.storagePrefix) !== null && _a !== void 0 ? _a : 'brotherprint:'}last-printer`, "f");
|
|
334
|
+
}
|
|
335
|
+
get closed() {
|
|
336
|
+
return __classPrivateFieldGet(this, _BrotherPrinterSession_closed, "f");
|
|
337
|
+
}
|
|
338
|
+
get printers() {
|
|
339
|
+
return __classPrivateFieldGet(this, _BrotherPrinterSession_printers, "f");
|
|
340
|
+
}
|
|
341
|
+
search(options, model) {
|
|
342
|
+
return __classPrivateFieldGet(this, _BrotherPrinterSession_instances, "m", _BrotherPrinterSession_discover).call(this, () => discoverPrinters(options, model, () => !__classPrivateFieldGet(this, _BrotherPrinterSession_closed, "f")));
|
|
343
|
+
}
|
|
344
|
+
prepare(options, model, previous) {
|
|
345
|
+
return __classPrivateFieldGet(this, _BrotherPrinterSession_instances, "m", _BrotherPrinterSession_discover).call(this, async () => {
|
|
346
|
+
const saved = previous === undefined ? await __classPrivateFieldGet(this, _BrotherPrinterSession_instances, "m", _BrotherPrinterSession_readSavedPrinter).call(this).catch(() => undefined) : previous;
|
|
347
|
+
if (__classPrivateFieldGet(this, _BrotherPrinterSession_closed, "f"))
|
|
348
|
+
return [];
|
|
349
|
+
return preparePrinters(options, model, saved, () => !__classPrivateFieldGet(this, _BrotherPrinterSession_closed, "f"));
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
/** Forget the remembered connection. Storage removal errors propagate to the caller. */
|
|
353
|
+
async clearSavedPrinter() {
|
|
354
|
+
var _a;
|
|
355
|
+
await ((_a = __classPrivateFieldGet(this, _BrotherPrinterSession_storage, "f")) === null || _a === void 0 ? void 0 : _a.remove(__classPrivateFieldGet(this, _BrotherPrinterSession_storageKey, "f")));
|
|
356
|
+
}
|
|
357
|
+
/** Register print notifications once. Callbacks stop immediately when disposed. */
|
|
358
|
+
listen(events) {
|
|
359
|
+
if (__classPrivateFieldGet(this, _BrotherPrinterSession_closed, "f"))
|
|
360
|
+
return Promise.resolve();
|
|
361
|
+
if (!__classPrivateFieldGet(this, _BrotherPrinterSession_listening, "f")) {
|
|
362
|
+
__classPrivateFieldSet(this, _BrotherPrinterSession_listeners, [
|
|
363
|
+
BrotherPrint.addListener(exports.BrotherPrintEventsEnum.onPrint, () => {
|
|
364
|
+
var _a;
|
|
365
|
+
if (!__classPrivateFieldGet(this, _BrotherPrinterSession_closed, "f"))
|
|
366
|
+
(_a = events.onPrint) === null || _a === void 0 ? void 0 : _a.call(events);
|
|
367
|
+
}),
|
|
368
|
+
BrotherPrint.addListener(exports.BrotherPrintEventsEnum.onPrintError, (info) => {
|
|
369
|
+
var _a;
|
|
370
|
+
if (!__classPrivateFieldGet(this, _BrotherPrinterSession_closed, "f"))
|
|
371
|
+
(_a = events.onPrintError) === null || _a === void 0 ? void 0 : _a.call(events, info);
|
|
372
|
+
}),
|
|
373
|
+
BrotherPrint.addListener(exports.BrotherPrintEventsEnum.onPrintFailedCommunication, (info) => {
|
|
374
|
+
var _a;
|
|
375
|
+
if (!__classPrivateFieldGet(this, _BrotherPrinterSession_closed, "f"))
|
|
376
|
+
(_a = events.onPrintFailedCommunication) === null || _a === void 0 ? void 0 : _a.call(events, info);
|
|
377
|
+
}),
|
|
378
|
+
], "f");
|
|
379
|
+
__classPrivateFieldSet(this, _BrotherPrinterSession_listening, Promise.all(__classPrivateFieldGet(this, _BrotherPrinterSession_listeners, "f")).then(() => undefined), "f");
|
|
380
|
+
}
|
|
381
|
+
return __classPrivateFieldGet(this, _BrotherPrinterSession_listening, "f");
|
|
382
|
+
}
|
|
383
|
+
/** A closed session cannot start another print. Already started native printing is awaited. */
|
|
384
|
+
async printImage(options) {
|
|
385
|
+
if (__classPrivateFieldGet(this, _BrotherPrinterSession_closed, "f"))
|
|
386
|
+
return;
|
|
387
|
+
if (__classPrivateFieldGet(this, _BrotherPrinterSession_storage, "f"))
|
|
388
|
+
await __classPrivateFieldGet(this, _BrotherPrinterSession_instances, "m", _BrotherPrinterSession_savePrinter).call(this, options).catch(() => undefined);
|
|
389
|
+
if (!__classPrivateFieldGet(this, _BrotherPrinterSession_closed, "f"))
|
|
390
|
+
await BrotherPrint.printImage(options);
|
|
391
|
+
}
|
|
392
|
+
/** Invalidate pending work immediately, then remove this session's print listeners. */
|
|
393
|
+
dispose() {
|
|
394
|
+
var _a;
|
|
395
|
+
__classPrivateFieldSet(this, _BrotherPrinterSession_closed, true, "f");
|
|
396
|
+
__classPrivateFieldSet(this, _BrotherPrinterSession_printers, [], "f");
|
|
397
|
+
__classPrivateFieldSet(this, _BrotherPrinterSession_disposal, (_a = __classPrivateFieldGet(this, _BrotherPrinterSession_disposal, "f")) !== null && _a !== void 0 ? _a : Promise.all(__classPrivateFieldGet(this, _BrotherPrinterSession_listeners, "f").map((listener) => listener.then((handle) => handle.remove()))).then(() => undefined), "f");
|
|
398
|
+
return __classPrivateFieldGet(this, _BrotherPrinterSession_disposal, "f");
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
_BrotherPrinterSession_closed = new WeakMap(), _BrotherPrinterSession_printers = new WeakMap(), _BrotherPrinterSession_listeners = new WeakMap(), _BrotherPrinterSession_listening = new WeakMap(), _BrotherPrinterSession_disposal = new WeakMap(), _BrotherPrinterSession_storage = new WeakMap(), _BrotherPrinterSession_storageKey = new WeakMap(), _BrotherPrinterSession_instances = new WeakSet(), _BrotherPrinterSession_readSavedPrinter = async function _BrotherPrinterSession_readSavedPrinter() {
|
|
402
|
+
var _a;
|
|
403
|
+
const value = await ((_a = __classPrivateFieldGet(this, _BrotherPrinterSession_storage, "f")) === null || _a === void 0 ? void 0 : _a.get(__classPrivateFieldGet(this, _BrotherPrinterSession_storageKey, "f")));
|
|
404
|
+
if (!value)
|
|
405
|
+
return undefined;
|
|
406
|
+
const channel = JSON.parse(value);
|
|
407
|
+
if (channel &&
|
|
408
|
+
Object.values(exports.BRLMPrinterPort).includes(channel.port) &&
|
|
409
|
+
['modelName', 'channelInfo', 'serialNumber', 'macAddress', 'nodeName', 'location'].every((key) => typeof channel[key] === 'string'))
|
|
410
|
+
return channel;
|
|
411
|
+
return undefined;
|
|
412
|
+
}, _BrotherPrinterSession_savePrinter = async function _BrotherPrinterSession_savePrinter(options) {
|
|
413
|
+
var _a;
|
|
414
|
+
if (!__classPrivateFieldGet(this, _BrotherPrinterSession_storage, "f") || !options.port || !((_a = options.channelInfo) === null || _a === void 0 ? void 0 : _a.trim()))
|
|
415
|
+
return;
|
|
416
|
+
const found = __classPrivateFieldGet(this, _BrotherPrinterSession_printers, "f").find((printer) => printer.port === options.port && printer.channelInfo === options.channelInfo);
|
|
417
|
+
const channel = Object.assign(Object.assign({ serialNumber: '', macAddress: '', nodeName: '', location: '' }, found), { port: options.port, channelInfo: options.channelInfo, modelName: options.modelName });
|
|
418
|
+
await __classPrivateFieldGet(this, _BrotherPrinterSession_storage, "f").set(__classPrivateFieldGet(this, _BrotherPrinterSession_storageKey, "f"), JSON.stringify(channel));
|
|
419
|
+
}, _BrotherPrinterSession_discover = function _BrotherPrinterSession_discover(run) {
|
|
420
|
+
return queueConnection(async () => {
|
|
421
|
+
if (__classPrivateFieldGet(this, _BrotherPrinterSession_closed, "f"))
|
|
422
|
+
return [];
|
|
423
|
+
__classPrivateFieldSet(this, _BrotherPrinterSession_printers, [], "f");
|
|
424
|
+
return run().then((printers) => {
|
|
425
|
+
if (__classPrivateFieldGet(this, _BrotherPrinterSession_closed, "f"))
|
|
426
|
+
return [];
|
|
427
|
+
__classPrivateFieldSet(this, _BrotherPrinterSession_printers, printers, "f");
|
|
428
|
+
return printers;
|
|
429
|
+
});
|
|
430
|
+
});
|
|
431
|
+
};
|
|
200
432
|
|
|
201
433
|
exports.BrotherPrint = BrotherPrint;
|
|
202
434
|
exports.BrotherPrintWeb = BrotherPrintWeb;
|
|
435
|
+
exports.BrotherPrinterSession = BrotherPrinterSession;
|
|
436
|
+
exports.brotherPrinterModel = brotherPrinterModel;
|
|
437
|
+
exports.brotherPrinterPortLabel = brotherPrinterPortLabel;
|
|
438
|
+
exports.brotherPrinterPorts = brotherPrinterPorts;
|
|
439
|
+
exports.checkBrotherPrinterChannel = checkBrotherPrinterChannel;
|
|
440
|
+
exports.prepareBrotherPrinters = prepareBrotherPrinters;
|
|
441
|
+
exports.resolveBrotherPrinterPort = resolveBrotherPrinterPort;
|
|
442
|
+
exports.searchBrotherPrinters = searchBrotherPrinters;
|
|
203
443
|
|
|
204
444
|
return exports;
|
|
205
445
|
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/web.js","esm/events.enum.js","esm/brother-printer.enum.js","esm/index.js"],"sourcesContent":["import { WebPlugin } from '@capacitor/core';\nexport class BrotherPrintWeb extends WebPlugin {\n async printImage(options) {\n console.log('printImage', options);\n }\n async isChannelAvailable(options) {\n console.log('isChannelAvailable', options);\n return {\n result: false,\n };\n }\n async search(options) {\n console.log('search', options);\n }\n async cancelSearchWiFiPrinter() {\n console.log('cancelSearchWiFiPrinter');\n }\n async cancelSearchBluetoothPrinter() {\n console.log('cancelSearchBluetoothPrinter');\n }\n}\n//# sourceMappingURL=web.js.map","export var BrotherPrintEventsEnum;\n(function (BrotherPrintEventsEnum) {\n BrotherPrintEventsEnum[\"onPrinterAvailable\"] = \"onPrinterAvailable\";\n BrotherPrintEventsEnum[\"onPrint\"] = \"onPrint\";\n BrotherPrintEventsEnum[\"onPrintFailedCommunication\"] = \"onPrintFailedCommunication\";\n BrotherPrintEventsEnum[\"onPrintError\"] = \"onPrintError\";\n})(BrotherPrintEventsEnum || (BrotherPrintEventsEnum = {}));\n//# sourceMappingURL=events.enum.js.map","export var BRLMPrinterPort;\n(function (BRLMPrinterPort) {\n BRLMPrinterPort[\"usb\"] = \"usb\";\n BRLMPrinterPort[\"wifi\"] = \"wifi\";\n BRLMPrinterPort[\"bluetooth\"] = \"bluetooth\";\n BRLMPrinterPort[\"bluetoothLowEnergy\"] = \"bluetoothLowEnergy\";\n})(BRLMPrinterPort || (BRLMPrinterPort = {}));\nexport var BRLMPrinterCustomPaperUnit;\n(function (BRLMPrinterCustomPaperUnit) {\n BRLMPrinterCustomPaperUnit[\"mm\"] = \"mm\";\n BRLMPrinterCustomPaperUnit[\"inch\"] = \"inch\";\n})(BRLMPrinterCustomPaperUnit || (BRLMPrinterCustomPaperUnit = {}));\nexport var BRLMPrinterCustomPaperType;\n(function (BRLMPrinterCustomPaperType) {\n BRLMPrinterCustomPaperType[\"rollPaper\"] = \"rollPaper\";\n BRLMPrinterCustomPaperType[\"dieCutPaper\"] = \"dieCutPaper\";\n BRLMPrinterCustomPaperType[\"markRollPaper\"] = \"markRollPaper\";\n})(BRLMPrinterCustomPaperType || (BRLMPrinterCustomPaperType = {}));\n/**\n * Note: If you update this file, you should update the following files:\n * - ios/Plugin/Model/PrinterModel.swift\n *\n * And name is follow android naming convention.\n * Android naming: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printermodel.html\n */\nexport var BRLMPrinterModelName;\n(function (BRLMPrinterModelName) {\n BRLMPrinterModelName[\"QL_800\"] = \"QL_800\";\n BRLMPrinterModelName[\"QL_810W\"] = \"QL_810W\";\n BRLMPrinterModelName[\"QL_820NWB\"] = \"QL_820NWB\";\n BRLMPrinterModelName[\"TD_2320D_203\"] = \"TD_2320D_203\";\n BRLMPrinterModelName[\"TD_2030AD\"] = \"TD_2030AD\";\n BRLMPrinterModelName[\"TD_2350D_300\"] = \"TD_2350D_300\";\n})(BRLMPrinterModelName || (BRLMPrinterModelName = {}));\n/**\n * Android naming: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android/labelinfo.html\n */\nexport var BRLMPrinterLabelName;\n(function (BRLMPrinterLabelName) {\n BRLMPrinterLabelName[\"DieCutW17H54\"] = \"DieCutW17H54\";\n BRLMPrinterLabelName[\"DieCutW17H87\"] = \"DieCutW17H87\";\n BRLMPrinterLabelName[\"DieCutW23H23\"] = \"DieCutW23H23\";\n BRLMPrinterLabelName[\"DieCutW29H42\"] = \"DieCutW29H42\";\n BRLMPrinterLabelName[\"DieCutW29H90\"] = \"DieCutW29H90\";\n BRLMPrinterLabelName[\"DieCutW38H90\"] = \"DieCutW38H90\";\n BRLMPrinterLabelName[\"DieCutW39H48\"] = \"DieCutW39H48\";\n BRLMPrinterLabelName[\"DieCutW52H29\"] = \"DieCutW52H29\";\n BRLMPrinterLabelName[\"DieCutW62H29\"] = \"DieCutW62H29\";\n BRLMPrinterLabelName[\"DieCutW62H60\"] = \"DieCutW62H60\";\n BRLMPrinterLabelName[\"DieCutW62H75\"] = \"DieCutW62H75\";\n BRLMPrinterLabelName[\"DieCutW62H100\"] = \"DieCutW62H100\";\n BRLMPrinterLabelName[\"DieCutW60H86\"] = \"DieCutW60H86\";\n BRLMPrinterLabelName[\"DieCutW54H29\"] = \"DieCutW54H29\";\n BRLMPrinterLabelName[\"DieCutW102H51\"] = \"DieCutW102H51\";\n BRLMPrinterLabelName[\"DieCutW102H152\"] = \"DieCutW102H152\";\n BRLMPrinterLabelName[\"DieCutW103H164\"] = \"DieCutW103H164\";\n BRLMPrinterLabelName[\"RollW12\"] = \"RollW12\";\n BRLMPrinterLabelName[\"RollW29\"] = \"RollW29\";\n BRLMPrinterLabelName[\"RollW38\"] = \"RollW38\";\n BRLMPrinterLabelName[\"RollW50\"] = \"RollW50\";\n BRLMPrinterLabelName[\"RollW54\"] = \"RollW54\";\n BRLMPrinterLabelName[\"RollW62\"] = \"RollW62\";\n BRLMPrinterLabelName[\"RollW62RB\"] = \"RollW62RB\";\n BRLMPrinterLabelName[\"RollW102\"] = \"RollW102\";\n BRLMPrinterLabelName[\"RollW103\"] = \"RollW103\";\n BRLMPrinterLabelName[\"DTRollW90\"] = \"DTRollW90\";\n BRLMPrinterLabelName[\"DTRollW102\"] = \"DTRollW102\";\n BRLMPrinterLabelName[\"DTRollW102H51\"] = \"DTRollW102H51\";\n BRLMPrinterLabelName[\"DTRollW102H152\"] = \"DTRollW102H152\";\n BRLMPrinterLabelName[\"RoundW12DIA\"] = \"RoundW12DIA\";\n BRLMPrinterLabelName[\"RoundW24DIA\"] = \"RoundW24DIA\";\n BRLMPrinterLabelName[\"RoundW58DIA\"] = \"RoundW58DIA\";\n /**\n * For TD series\n * @url https://www.brother.co.jp/product/labelprinter/td2350d/accessory/index.aspx\n */\n BRLMPrinterLabelName[\"RDDieCutW60H60\"] = \"RDDieCutW60H60\";\n BRLMPrinterLabelName[\"RDDieCutW50H30\"] = \"RDDieCutW50H30\";\n BRLMPrinterLabelName[\"RDDieCutW40H60\"] = \"RDDieCutW40H60\";\n BRLMPrinterLabelName[\"RDDieCutW40H50\"] = \"RDDieCutW40H50\";\n BRLMPrinterLabelName[\"RDDieCutW40H40\"] = \"RDDieCutW40H40\";\n BRLMPrinterLabelName[\"RDDieCutW30H30\"] = \"RDDieCutW30H30\";\n BRLMPrinterLabelName[\"RDDieCutW50H35\"] = \"RDDieCutW50H35\";\n BRLMPrinterLabelName[\"RDDieCutW60H80\"] = \"RDDieCutW60H80\";\n BRLMPrinterLabelName[\"RDDieCutW60H100\"] = \"RDDieCutW60H100\";\n})(BRLMPrinterLabelName || (BRLMPrinterLabelName = {}));\n/**\n * @url https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#imagerotation\n */\nexport var BRLMPrinterImageRotation;\n(function (BRLMPrinterImageRotation) {\n BRLMPrinterImageRotation[\"Rotate0\"] = \"Rotate0\";\n BRLMPrinterImageRotation[\"Rotate90\"] = \"Rotate90\";\n BRLMPrinterImageRotation[\"Rotate180\"] = \"Rotate180\";\n BRLMPrinterImageRotation[\"Rotate270\"] = \"Rotate270\";\n})(BRLMPrinterImageRotation || (BRLMPrinterImageRotation = {}));\n/**\n * url https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#scalemode\n */\nexport var BRLMPrinterScaleMode;\n(function (BRLMPrinterScaleMode) {\n BRLMPrinterScaleMode[\"ActualSize\"] = \"ActualSize\";\n BRLMPrinterScaleMode[\"FitPageAspect\"] = \"FitPageAspect\";\n BRLMPrinterScaleMode[\"FitPaperAspect\"] = \"FitPaperAspect\";\n BRLMPrinterScaleMode[\"ScaleValue\"] = \"ScaleValue\";\n})(BRLMPrinterScaleMode || (BRLMPrinterScaleMode = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#halftone\n */\nexport var BRLMPrinterHalftone;\n(function (BRLMPrinterHalftone) {\n BRLMPrinterHalftone[\"Threshold\"] = \"Threshold\";\n BRLMPrinterHalftone[\"ErrorDiffusion\"] = \"ErrorDiffusion\";\n BRLMPrinterHalftone[\"PatternDither\"] = \"PatternDither\";\n})(BRLMPrinterHalftone || (BRLMPrinterHalftone = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#verticalalignment\n */\nexport var BRLMPrinterVerticalAlignment;\n(function (BRLMPrinterVerticalAlignment) {\n BRLMPrinterVerticalAlignment[\"Top\"] = \"Top\";\n BRLMPrinterVerticalAlignment[\"Center\"] = \"Center\";\n BRLMPrinterVerticalAlignment[\"Bottom\"] = \"Bottom\";\n})(BRLMPrinterVerticalAlignment || (BRLMPrinterVerticalAlignment = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#horizontalalignment\n */\nexport var BRLMPrinterHorizontalAlignment;\n(function (BRLMPrinterHorizontalAlignment) {\n BRLMPrinterHorizontalAlignment[\"Left\"] = \"Left\";\n BRLMPrinterHorizontalAlignment[\"Center\"] = \"Center\";\n BRLMPrinterHorizontalAlignment[\"Right\"] = \"Right\";\n})(BRLMPrinterHorizontalAlignment || (BRLMPrinterHorizontalAlignment = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#compressmode\n */\nexport var BRLMPrinterCompressMode;\n(function (BRLMPrinterCompressMode) {\n BRLMPrinterCompressMode[\"None\"] = \"None\";\n BRLMPrinterCompressMode[\"Tiff\"] = \"Tiff\";\n BRLMPrinterCompressMode[\"Mode9\"] = \"Mode9\";\n})(BRLMPrinterCompressMode || (BRLMPrinterCompressMode = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#printquality\n */\nexport var BRLMPrinterPrintQuality;\n(function (BRLMPrinterPrintQuality) {\n BRLMPrinterPrintQuality[\"Best\"] = \"Best\";\n BRLMPrinterPrintQuality[\"Fast\"] = \"Fast\";\n})(BRLMPrinterPrintQuality || (BRLMPrinterPrintQuality = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#resolution\n */\n// export enum BRLMPrinterPrintResolution {\n// Low = 'Low',\n// Normal = 'Normal',\n// High = 'High',\n// }\n//# sourceMappingURL=brother-printer.enum.js.map","import { registerPlugin } from '@capacitor/core';\nconst BrotherPrint = registerPlugin('BrotherPrint', {\n web: () => import('./web').then((m) => new m.BrotherPrintWeb()),\n});\nexport * from './definitions';\nexport * from './web';\nexport * from './events.enum';\nexport * from './interfaces';\nexport * from './brother-printer.enum';\nexport { BrotherPrint };\n//# sourceMappingURL=index.js.map"],"names":["WebPlugin","BrotherPrintEventsEnum","BRLMPrinterPort","BRLMPrinterCustomPaperUnit","BRLMPrinterCustomPaperType","BRLMPrinterModelName","BRLMPrinterLabelName","BRLMPrinterImageRotation","BRLMPrinterScaleMode","BRLMPrinterHalftone","BRLMPrinterVerticalAlignment","BRLMPrinterHorizontalAlignment","BRLMPrinterCompressMode","BRLMPrinterPrintQuality","registerPlugin"],"mappings":";;;IACO,MAAM,eAAe,SAASA,cAAS,CAAC;IAC/C,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;IAC9B,QAAQ,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC;IAC1C,IAAI;IACJ,IAAI,MAAM,kBAAkB,CAAC,OAAO,EAAE;IACtC,QAAQ,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,OAAO,CAAC;IAClD,QAAQ,OAAO;IACf,YAAY,MAAM,EAAE,KAAK;IACzB,SAAS;IACT,IAAI;IACJ,IAAI,MAAM,MAAM,CAAC,OAAO,EAAE;IAC1B,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC;IACtC,IAAI;IACJ,IAAI,MAAM,uBAAuB,GAAG;IACpC,QAAQ,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC;IAC9C,IAAI;IACJ,IAAI,MAAM,4BAA4B,GAAG;IACzC,QAAQ,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC;IACnD,IAAI;IACJ;;;;;;;ACpBWC;IACX,CAAC,UAAU,sBAAsB,EAAE;IACnC,IAAI,sBAAsB,CAAC,oBAAoB,CAAC,GAAG,oBAAoB;IACvE,IAAI,sBAAsB,CA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oCAA4B,KAAKA,oCAA4B,GAAG,EAAE,CAAC,CAAC;IACvE;IACA;IACA;AACWC;IACX,CAAC,UAAU,8BAA8B,EAAE;IAC3C,IAAI,8BAA8B,CAAC,MAAM,CAAC,GAAG,MAAM;IACnD,IAAI,8BAA8B,CAAC,QAAQ,CAAC,GAAG,QAAQ;IACvD,IAAI,8BAA8B,CAAC,OAAO,CAAC,GAAG,OAAO;IACrD,CAAC,EAAEA,sCAA8B,KAAKA,sCAA8B,GAAG,EAAE,CAAC,CAAC;IAC3E;IACA;IACA;AACWC;IACX,CAAC,UAAU,uBAAuB,EAAE;IACpC,IAAI,uBAAuB,CAAC,MAAM,CAAC,GAAG,MAAM;IAC5C,IAAI,uBAAuB,CAAC,MAAM,CAAC,GAAG,MAAM;IAC5C,IAAI,uBAAuB,CAAC,OAAO,CAAC,GAAG,OAAO;IAC9C,CAAC,EAAEA,+BAAuB,KAAKA,+BAAuB,GAAG,EAAE,CAAC,CAAC;IAC7D;IACA;IACA;AACWC;IACX,CAAC,UAAU,uBAAuB,EAAE;IACpC,IAAI,uBAAuB,CAAC,MAAM,CAAC,GAAG,MAAM;IAC5C,IAAI,uBAAuB,CAAC,MAAM,CAAC,GAAG,MAAM;IAC5C,CAAC,EAAEA,+BAAuB,KAAKA,+BAAuB,GAAG,EAAE,CAAC,CAAC;IAC7D;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;AC5JK,UAAC,YAAY,GAAGC,mBAAc,CAAC,cAAc,EAAE;IACpD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACnE,CAAC;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/brother-printer.enum.js","esm/events.enum.js","esm/models.js","esm/printer.js","esm/web.js","esm/index.js"],"sourcesContent":["export var BRLMPrinterPort;\n(function (BRLMPrinterPort) {\n BRLMPrinterPort[\"usb\"] = \"usb\";\n BRLMPrinterPort[\"wifi\"] = \"wifi\";\n BRLMPrinterPort[\"bluetooth\"] = \"bluetooth\";\n BRLMPrinterPort[\"bluetoothLowEnergy\"] = \"bluetoothLowEnergy\";\n})(BRLMPrinterPort || (BRLMPrinterPort = {}));\nexport var BRLMPrinterCustomPaperUnit;\n(function (BRLMPrinterCustomPaperUnit) {\n BRLMPrinterCustomPaperUnit[\"mm\"] = \"mm\";\n BRLMPrinterCustomPaperUnit[\"inch\"] = \"inch\";\n})(BRLMPrinterCustomPaperUnit || (BRLMPrinterCustomPaperUnit = {}));\nexport var BRLMPrinterCustomPaperType;\n(function (BRLMPrinterCustomPaperType) {\n BRLMPrinterCustomPaperType[\"rollPaper\"] = \"rollPaper\";\n BRLMPrinterCustomPaperType[\"dieCutPaper\"] = \"dieCutPaper\";\n BRLMPrinterCustomPaperType[\"markRollPaper\"] = \"markRollPaper\";\n})(BRLMPrinterCustomPaperType || (BRLMPrinterCustomPaperType = {}));\n/**\n * Note: If you update this file, you should update the following files:\n * - ios/Plugin/Model/PrinterModel.swift\n *\n * And name is follow android naming convention.\n * Android naming: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printermodel.html\n */\nexport var BRLMPrinterModelName;\n(function (BRLMPrinterModelName) {\n BRLMPrinterModelName[\"QL_800\"] = \"QL_800\";\n BRLMPrinterModelName[\"QL_810W\"] = \"QL_810W\";\n BRLMPrinterModelName[\"QL_820NWB\"] = \"QL_820NWB\";\n BRLMPrinterModelName[\"TD_2320D_203\"] = \"TD_2320D_203\";\n BRLMPrinterModelName[\"TD_2030AD\"] = \"TD_2030AD\";\n BRLMPrinterModelName[\"TD_2350D_300\"] = \"TD_2350D_300\";\n})(BRLMPrinterModelName || (BRLMPrinterModelName = {}));\n/**\n * Android naming: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android/labelinfo.html\n */\nexport var BRLMPrinterLabelName;\n(function (BRLMPrinterLabelName) {\n BRLMPrinterLabelName[\"DieCutW17H54\"] = \"DieCutW17H54\";\n BRLMPrinterLabelName[\"DieCutW17H87\"] = \"DieCutW17H87\";\n BRLMPrinterLabelName[\"DieCutW23H23\"] = \"DieCutW23H23\";\n BRLMPrinterLabelName[\"DieCutW29H42\"] = \"DieCutW29H42\";\n BRLMPrinterLabelName[\"DieCutW29H90\"] = \"DieCutW29H90\";\n BRLMPrinterLabelName[\"DieCutW38H90\"] = \"DieCutW38H90\";\n BRLMPrinterLabelName[\"DieCutW39H48\"] = \"DieCutW39H48\";\n BRLMPrinterLabelName[\"DieCutW52H29\"] = \"DieCutW52H29\";\n BRLMPrinterLabelName[\"DieCutW62H29\"] = \"DieCutW62H29\";\n BRLMPrinterLabelName[\"DieCutW62H60\"] = \"DieCutW62H60\";\n BRLMPrinterLabelName[\"DieCutW62H75\"] = \"DieCutW62H75\";\n BRLMPrinterLabelName[\"DieCutW62H100\"] = \"DieCutW62H100\";\n BRLMPrinterLabelName[\"DieCutW60H86\"] = \"DieCutW60H86\";\n BRLMPrinterLabelName[\"DieCutW54H29\"] = \"DieCutW54H29\";\n BRLMPrinterLabelName[\"DieCutW102H51\"] = \"DieCutW102H51\";\n BRLMPrinterLabelName[\"DieCutW102H152\"] = \"DieCutW102H152\";\n BRLMPrinterLabelName[\"DieCutW103H164\"] = \"DieCutW103H164\";\n BRLMPrinterLabelName[\"RollW12\"] = \"RollW12\";\n BRLMPrinterLabelName[\"RollW29\"] = \"RollW29\";\n BRLMPrinterLabelName[\"RollW38\"] = \"RollW38\";\n BRLMPrinterLabelName[\"RollW50\"] = \"RollW50\";\n BRLMPrinterLabelName[\"RollW54\"] = \"RollW54\";\n BRLMPrinterLabelName[\"RollW62\"] = \"RollW62\";\n BRLMPrinterLabelName[\"RollW62RB\"] = \"RollW62RB\";\n BRLMPrinterLabelName[\"RollW102\"] = \"RollW102\";\n BRLMPrinterLabelName[\"RollW103\"] = \"RollW103\";\n BRLMPrinterLabelName[\"DTRollW90\"] = \"DTRollW90\";\n BRLMPrinterLabelName[\"DTRollW102\"] = \"DTRollW102\";\n BRLMPrinterLabelName[\"DTRollW102H51\"] = \"DTRollW102H51\";\n BRLMPrinterLabelName[\"DTRollW102H152\"] = \"DTRollW102H152\";\n BRLMPrinterLabelName[\"RoundW12DIA\"] = \"RoundW12DIA\";\n BRLMPrinterLabelName[\"RoundW24DIA\"] = \"RoundW24DIA\";\n BRLMPrinterLabelName[\"RoundW58DIA\"] = \"RoundW58DIA\";\n /**\n * For TD series\n * @url https://www.brother.co.jp/product/labelprinter/td2350d/accessory/index.aspx\n */\n BRLMPrinterLabelName[\"RDDieCutW60H60\"] = \"RDDieCutW60H60\";\n BRLMPrinterLabelName[\"RDDieCutW50H30\"] = \"RDDieCutW50H30\";\n BRLMPrinterLabelName[\"RDDieCutW40H60\"] = \"RDDieCutW40H60\";\n BRLMPrinterLabelName[\"RDDieCutW40H50\"] = \"RDDieCutW40H50\";\n BRLMPrinterLabelName[\"RDDieCutW40H40\"] = \"RDDieCutW40H40\";\n BRLMPrinterLabelName[\"RDDieCutW30H30\"] = \"RDDieCutW30H30\";\n BRLMPrinterLabelName[\"RDDieCutW50H35\"] = \"RDDieCutW50H35\";\n BRLMPrinterLabelName[\"RDDieCutW60H80\"] = \"RDDieCutW60H80\";\n BRLMPrinterLabelName[\"RDDieCutW60H100\"] = \"RDDieCutW60H100\";\n})(BRLMPrinterLabelName || (BRLMPrinterLabelName = {}));\n/**\n * @url https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#imagerotation\n */\nexport var BRLMPrinterImageRotation;\n(function (BRLMPrinterImageRotation) {\n BRLMPrinterImageRotation[\"Rotate0\"] = \"Rotate0\";\n BRLMPrinterImageRotation[\"Rotate90\"] = \"Rotate90\";\n BRLMPrinterImageRotation[\"Rotate180\"] = \"Rotate180\";\n BRLMPrinterImageRotation[\"Rotate270\"] = \"Rotate270\";\n})(BRLMPrinterImageRotation || (BRLMPrinterImageRotation = {}));\n/**\n * url https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#scalemode\n */\nexport var BRLMPrinterScaleMode;\n(function (BRLMPrinterScaleMode) {\n BRLMPrinterScaleMode[\"ActualSize\"] = \"ActualSize\";\n BRLMPrinterScaleMode[\"FitPageAspect\"] = \"FitPageAspect\";\n BRLMPrinterScaleMode[\"FitPaperAspect\"] = \"FitPaperAspect\";\n BRLMPrinterScaleMode[\"ScaleValue\"] = \"ScaleValue\";\n})(BRLMPrinterScaleMode || (BRLMPrinterScaleMode = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#halftone\n */\nexport var BRLMPrinterHalftone;\n(function (BRLMPrinterHalftone) {\n BRLMPrinterHalftone[\"Threshold\"] = \"Threshold\";\n BRLMPrinterHalftone[\"ErrorDiffusion\"] = \"ErrorDiffusion\";\n BRLMPrinterHalftone[\"PatternDither\"] = \"PatternDither\";\n})(BRLMPrinterHalftone || (BRLMPrinterHalftone = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#verticalalignment\n */\nexport var BRLMPrinterVerticalAlignment;\n(function (BRLMPrinterVerticalAlignment) {\n BRLMPrinterVerticalAlignment[\"Top\"] = \"Top\";\n BRLMPrinterVerticalAlignment[\"Center\"] = \"Center\";\n BRLMPrinterVerticalAlignment[\"Bottom\"] = \"Bottom\";\n})(BRLMPrinterVerticalAlignment || (BRLMPrinterVerticalAlignment = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#horizontalalignment\n */\nexport var BRLMPrinterHorizontalAlignment;\n(function (BRLMPrinterHorizontalAlignment) {\n BRLMPrinterHorizontalAlignment[\"Left\"] = \"Left\";\n BRLMPrinterHorizontalAlignment[\"Center\"] = \"Center\";\n BRLMPrinterHorizontalAlignment[\"Right\"] = \"Right\";\n})(BRLMPrinterHorizontalAlignment || (BRLMPrinterHorizontalAlignment = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#compressmode\n */\nexport var BRLMPrinterCompressMode;\n(function (BRLMPrinterCompressMode) {\n BRLMPrinterCompressMode[\"None\"] = \"None\";\n BRLMPrinterCompressMode[\"Tiff\"] = \"Tiff\";\n BRLMPrinterCompressMode[\"Mode9\"] = \"Mode9\";\n})(BRLMPrinterCompressMode || (BRLMPrinterCompressMode = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#printquality\n */\nexport var BRLMPrinterPrintQuality;\n(function (BRLMPrinterPrintQuality) {\n BRLMPrinterPrintQuality[\"Best\"] = \"Best\";\n BRLMPrinterPrintQuality[\"Fast\"] = \"Fast\";\n})(BRLMPrinterPrintQuality || (BRLMPrinterPrintQuality = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#resolution\n */\n// export enum BRLMPrinterPrintResolution {\n// Low = 'Low',\n// Normal = 'Normal',\n// High = 'High',\n// }\n//# sourceMappingURL=brother-printer.enum.js.map","export var BrotherPrintEventsEnum;\n(function (BrotherPrintEventsEnum) {\n BrotherPrintEventsEnum[\"onPrinterAvailable\"] = \"onPrinterAvailable\";\n BrotherPrintEventsEnum[\"onPrint\"] = \"onPrint\";\n BrotherPrintEventsEnum[\"onPrintFailedCommunication\"] = \"onPrintFailedCommunication\";\n BrotherPrintEventsEnum[\"onPrintError\"] = \"onPrintError\";\n})(BrotherPrintEventsEnum || (BrotherPrintEventsEnum = {}));\n//# sourceMappingURL=events.enum.js.map","import { BRLMPrinterModelName as Model, BRLMPrinterPort as Port } from './brother-printer.enum';\nexport const printerPorts = {\n [Model.QL_800]: [Port.usb],\n [Model.QL_810W]: [Port.wifi, Port.usb],\n [Model.QL_820NWB]: [Port.wifi, Port.bluetooth, Port.usb],\n [Model.TD_2320D_203]: [Port.wifi, Port.usb],\n [Model.TD_2030AD]: [Port.usb],\n [Model.TD_2350D_300]: [Port.wifi, Port.bluetooth, Port.usb, Port.bluetoothLowEnergy],\n};\n//# sourceMappingURL=models.js.map","import { Capacitor } from '@capacitor/core';\nimport { BRLMPrinterModelName, BRLMPrinterPort } from './brother-printer.enum';\nimport { printerPorts } from './models';\n/** Common display names for connection transports. */\nexport function brotherPrinterPortLabel(port) {\n switch (port) {\n case BRLMPrinterPort.wifi:\n return 'Wi-Fi';\n case BRLMPrinterPort.bluetooth:\n return 'Bluetooth';\n case BRLMPrinterPort.bluetoothLowEnergy:\n return 'Bluetooth LE';\n case BRLMPrinterPort.usb:\n return 'USB';\n default:\n return '';\n }\n}\n/** Connection choices for the existing models. USB is Android-only; wifi also covers Ethernet. */\nexport function brotherPrinterPorts(model, isAndroid = Capacitor.getPlatform() === 'android') {\n if (!Object.values(BRLMPrinterModelName).includes(model))\n return [];\n return printerPorts[model].filter((port) => isAndroid || port !== BRLMPrinterPort.usb);\n}\n/** Keep a supported saved port; otherwise prefer USB for QL-800/810W on Android. */\nexport function resolveBrotherPrinterPort(model, saved) {\n const ports = brotherPrinterPorts(model);\n if (saved && ports.includes(saved))\n return saved;\n if (ports.includes(BRLMPrinterPort.usb) &&\n (model === BRLMPrinterModelName.QL_800 || model === BRLMPrinterModelName.QL_810W))\n return BRLMPrinterPort.usb;\n return ports[0];\n}\n/** Match discovery names to an existing model enum, including documented product aliases. */\nexport function brotherPrinterModel(name) {\n const key = name\n .trim()\n .toUpperCase()\n .replace(/^BROTHER\\s+/, '')\n .replace(/[-_ ]/g, '');\n // Product names omit TD resolution; QL-820NWBc and TD-2030A use the existing enum spellings.\n const product = key === 'QL820NWBC' ? 'QL820NWB' : key === 'TD2030A' ? 'TD2030AD' : key;\n return Object.values(BRLMPrinterModelName).find((model) => model.replace(/_/g, '') === product || model.replace(/_(203|300)$/, '').replace(/_/g, '') === product);\n}\n//# sourceMappingURL=printer.js.map","import { WebPlugin } from '@capacitor/core';\nexport class BrotherPrintWeb extends WebPlugin {\n async printImage(options) {\n console.log('printImage', options);\n }\n async isChannelAvailable(options) {\n console.log('isChannelAvailable', options);\n return {\n result: false,\n };\n }\n async search(options) {\n console.log('search', options);\n }\n async cancelSearchWiFiPrinter() {\n console.log('cancelSearchWiFiPrinter');\n }\n async cancelSearchBluetoothPrinter() {\n console.log('cancelSearchBluetoothPrinter');\n }\n}\n//# sourceMappingURL=web.js.map","var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _BrotherPrinterSession_instances, _BrotherPrinterSession_closed, _BrotherPrinterSession_printers, _BrotherPrinterSession_listeners, _BrotherPrinterSession_listening, _BrotherPrinterSession_disposal, _BrotherPrinterSession_storage, _BrotherPrinterSession_storageKey, _BrotherPrinterSession_readSavedPrinter, _BrotherPrinterSession_savePrinter, _BrotherPrinterSession_discover;\nimport { registerPlugin } from '@capacitor/core';\nimport { BRLMPrinterPort } from './brother-printer.enum';\nimport { BrotherPrintEventsEnum } from './events.enum';\nimport { brotherPrinterModel } from './printer';\nconst BrotherPrint = registerPlugin('BrotherPrint', {\n web: () => import('./web').then((m) => new m.BrotherPrintWeb()),\n});\nexport * from './definitions';\nexport * from './web';\nexport * from './events.enum';\nexport * from './interfaces';\nexport * from './brother-printer.enum';\nexport { BrotherPrint };\nexport * from './printer';\n// Native discovery events are shared. Keep each helper call's listener scoped to its turn.\nlet connectionQueue = Promise.resolve();\nfunction queueConnection(run) {\n const result = connectionQueue.then(run);\n connectionQueue = result.catch(() => undefined);\n return result;\n}\n/** Collect discovery results, waiting for earlier helper calls to finish. */\nexport function searchBrotherPrinters(options, model) {\n return queueConnection(() => discoverPrinters(options, model));\n}\n/**\n * Reuse a matching, available previous channel; otherwise discover printers.\n * The caller owns storage. USB always discovers again through the native permission flow.\n * Availability errors propagate; only an unavailable channel triggers discovery.\n */\nexport function prepareBrotherPrinters(options, model, previous) {\n return queueConnection(() => preparePrinters(options, model, previous));\n}\n/**\n * Check an explicitly selected address without discovery or fallback to another printer.\n * Port must be supplied; an address does not identify its transport or printer model.\n */\nexport function checkBrotherPrinterChannel(channel) {\n return queueConnection(async () => {\n const { result } = await BrotherPrint.isChannelAvailable(Object.assign({ modelName: '', serialNumber: '', macAddress: '', nodeName: '', location: '' }, channel));\n return result;\n });\n}\nasync function discoverPrinters(options, model, active = () => true) {\n const printers = [];\n const listener = await BrotherPrint.addListener(BrotherPrintEventsEnum.onPrinterAvailable, (printer) => {\n if (printer.port !== options.port)\n return;\n if (printer.port !== BRLMPrinterPort.usb && model !== undefined && brotherPrinterModel(printer.modelName) !== model)\n return;\n const index = printers.findIndex((current) => current.port === printer.port && current.channelInfo === printer.channelInfo);\n if (index < 0)\n printers.push(printer);\n else\n printers[index] = printer;\n });\n await (active() ? BrotherPrint.search(options) : Promise.resolve()).finally(() => listener.remove());\n return printers;\n}\nasync function preparePrinters(options, model, previous, active = () => true) {\n if (options.port !== BRLMPrinterPort.usb &&\n (previous === null || previous === void 0 ? void 0 : previous.port) === options.port &&\n previous.channelInfo.trim() &&\n brotherPrinterModel(previous.modelName) === model) {\n const available = await BrotherPrint.isChannelAvailable(previous);\n if (available.result)\n return [previous];\n }\n return active() ? discoverPrinters(options, model, active) : [];\n}\n/** One print screen's discovery results and event subscriptions. Create a new session after disposal. */\nexport class BrotherPrinterSession {\n constructor(options = {}) {\n var _a;\n _BrotherPrinterSession_instances.add(this);\n _BrotherPrinterSession_closed.set(this, false);\n _BrotherPrinterSession_printers.set(this, []);\n _BrotherPrinterSession_listeners.set(this, []);\n _BrotherPrinterSession_listening.set(this, void 0);\n _BrotherPrinterSession_disposal.set(this, void 0);\n _BrotherPrinterSession_storage.set(this, void 0);\n _BrotherPrinterSession_storageKey.set(this, void 0);\n __classPrivateFieldSet(this, _BrotherPrinterSession_storage, options.storage, \"f\");\n __classPrivateFieldSet(this, _BrotherPrinterSession_storageKey, `${(_a = options.storagePrefix) !== null && _a !== void 0 ? _a : 'brotherprint:'}last-printer`, \"f\");\n }\n get closed() {\n return __classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\");\n }\n get printers() {\n return __classPrivateFieldGet(this, _BrotherPrinterSession_printers, \"f\");\n }\n search(options, model) {\n return __classPrivateFieldGet(this, _BrotherPrinterSession_instances, \"m\", _BrotherPrinterSession_discover).call(this, () => discoverPrinters(options, model, () => !__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\")));\n }\n prepare(options, model, previous) {\n return __classPrivateFieldGet(this, _BrotherPrinterSession_instances, \"m\", _BrotherPrinterSession_discover).call(this, async () => {\n const saved = previous === undefined ? await __classPrivateFieldGet(this, _BrotherPrinterSession_instances, \"m\", _BrotherPrinterSession_readSavedPrinter).call(this).catch(() => undefined) : previous;\n if (__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n return [];\n return preparePrinters(options, model, saved, () => !__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"));\n });\n }\n /** Forget the remembered connection. Storage removal errors propagate to the caller. */\n async clearSavedPrinter() {\n var _a;\n await ((_a = __classPrivateFieldGet(this, _BrotherPrinterSession_storage, \"f\")) === null || _a === void 0 ? void 0 : _a.remove(__classPrivateFieldGet(this, _BrotherPrinterSession_storageKey, \"f\")));\n }\n /** Register print notifications once. Callbacks stop immediately when disposed. */\n listen(events) {\n if (__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n return Promise.resolve();\n if (!__classPrivateFieldGet(this, _BrotherPrinterSession_listening, \"f\")) {\n __classPrivateFieldSet(this, _BrotherPrinterSession_listeners, [\n BrotherPrint.addListener(BrotherPrintEventsEnum.onPrint, () => {\n var _a;\n if (!__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n (_a = events.onPrint) === null || _a === void 0 ? void 0 : _a.call(events);\n }),\n BrotherPrint.addListener(BrotherPrintEventsEnum.onPrintError, (info) => {\n var _a;\n if (!__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n (_a = events.onPrintError) === null || _a === void 0 ? void 0 : _a.call(events, info);\n }),\n BrotherPrint.addListener(BrotherPrintEventsEnum.onPrintFailedCommunication, (info) => {\n var _a;\n if (!__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n (_a = events.onPrintFailedCommunication) === null || _a === void 0 ? void 0 : _a.call(events, info);\n }),\n ], \"f\");\n __classPrivateFieldSet(this, _BrotherPrinterSession_listening, Promise.all(__classPrivateFieldGet(this, _BrotherPrinterSession_listeners, \"f\")).then(() => undefined), \"f\");\n }\n return __classPrivateFieldGet(this, _BrotherPrinterSession_listening, \"f\");\n }\n /** A closed session cannot start another print. Already started native printing is awaited. */\n async printImage(options) {\n if (__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n return;\n if (__classPrivateFieldGet(this, _BrotherPrinterSession_storage, \"f\"))\n await __classPrivateFieldGet(this, _BrotherPrinterSession_instances, \"m\", _BrotherPrinterSession_savePrinter).call(this, options).catch(() => undefined);\n if (!__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n await BrotherPrint.printImage(options);\n }\n /** Invalidate pending work immediately, then remove this session's print listeners. */\n dispose() {\n var _a;\n __classPrivateFieldSet(this, _BrotherPrinterSession_closed, true, \"f\");\n __classPrivateFieldSet(this, _BrotherPrinterSession_printers, [], \"f\");\n __classPrivateFieldSet(this, _BrotherPrinterSession_disposal, (_a = __classPrivateFieldGet(this, _BrotherPrinterSession_disposal, \"f\")) !== null && _a !== void 0 ? _a : Promise.all(__classPrivateFieldGet(this, _BrotherPrinterSession_listeners, \"f\").map((listener) => listener.then((handle) => handle.remove()))).then(() => undefined), \"f\");\n return __classPrivateFieldGet(this, _BrotherPrinterSession_disposal, \"f\");\n }\n}\n_BrotherPrinterSession_closed = new WeakMap(), _BrotherPrinterSession_printers = new WeakMap(), _BrotherPrinterSession_listeners = new WeakMap(), _BrotherPrinterSession_listening = new WeakMap(), _BrotherPrinterSession_disposal = new WeakMap(), _BrotherPrinterSession_storage = new WeakMap(), _BrotherPrinterSession_storageKey = new WeakMap(), _BrotherPrinterSession_instances = new WeakSet(), _BrotherPrinterSession_readSavedPrinter = async function _BrotherPrinterSession_readSavedPrinter() {\n var _a;\n const value = await ((_a = __classPrivateFieldGet(this, _BrotherPrinterSession_storage, \"f\")) === null || _a === void 0 ? void 0 : _a.get(__classPrivateFieldGet(this, _BrotherPrinterSession_storageKey, \"f\")));\n if (!value)\n return undefined;\n const channel = JSON.parse(value);\n if (channel &&\n Object.values(BRLMPrinterPort).includes(channel.port) &&\n ['modelName', 'channelInfo', 'serialNumber', 'macAddress', 'nodeName', 'location'].every((key) => typeof channel[key] === 'string'))\n return channel;\n return undefined;\n}, _BrotherPrinterSession_savePrinter = async function _BrotherPrinterSession_savePrinter(options) {\n var _a;\n if (!__classPrivateFieldGet(this, _BrotherPrinterSession_storage, \"f\") || !options.port || !((_a = options.channelInfo) === null || _a === void 0 ? void 0 : _a.trim()))\n return;\n const found = __classPrivateFieldGet(this, _BrotherPrinterSession_printers, \"f\").find((printer) => printer.port === options.port && printer.channelInfo === options.channelInfo);\n const channel = Object.assign(Object.assign({ serialNumber: '', macAddress: '', nodeName: '', location: '' }, found), { port: options.port, channelInfo: options.channelInfo, modelName: options.modelName });\n await __classPrivateFieldGet(this, _BrotherPrinterSession_storage, \"f\").set(__classPrivateFieldGet(this, _BrotherPrinterSession_storageKey, \"f\"), JSON.stringify(channel));\n}, _BrotherPrinterSession_discover = function _BrotherPrinterSession_discover(run) {\n return queueConnection(async () => {\n if (__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n return [];\n __classPrivateFieldSet(this, _BrotherPrinterSession_printers, [], \"f\");\n return run().then((printers) => {\n if (__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n return [];\n __classPrivateFieldSet(this, _BrotherPrinterSession_printers, printers, \"f\");\n return printers;\n });\n });\n};\n//# sourceMappingURL=index.js.map"],"names":["BRLMPrinterPort","BRLMPrinterCustomPaperUnit","BRLMPrinterCustomPaperType","BRLMPrinterModelName","BRLMPrinterLabelName","BRLMPrinterImageRotation","BRLMPrinterScaleMode","BRLMPrinterHalftone","BRLMPrinterVerticalAlignment","BRLMPrinterHorizontalAlignment","BRLMPrinterCompressMode","BRLMPrinterPrintQuality","BrotherPrintEventsEnum","Model","Port","Capacitor","WebPlugin","this","registerPlugin"],"mappings":";;;AAAWA;IACX,CAAC,UAAU,eAAe,EAAE;IAC5B,IAAI,eAAe,CAAC,KAAK,CAAC,GAAG,KAAK;IAClC,IAAI,eAAe,CAAC,MAAM,CAAC,GAAG,MAAM;IACpC,IAAI,eAAe,CAAC,WAAW,CAAC,GAAG,WAAW;IAC9C,IAAI,eAAe,CAAC,oBAAoB,CAAC,GAAG,oBAAoB;IAChE,CAAC,EAAEA,uBAAe,KAAKA,uBAAe,GAAG,EAAE,CAAC,CAAC;AAClCC;IACX,CAAC,UAAU,0BAA0B,EAAE;IACvC,IAAI,0BAA0B,CAAC,IAAI,CAAC,GAAG,IAAI;IAC3C,IAAI,0BAA0B,CAAC,MAAM,CAAC,GAAG,MAAM;IAC/C,CAAC,EAAEA,kCAA0B,KAAKA,kCAA0B,GAAG,EAAE,CAAC,CAAC;AACxDC;IACX,CAAC,UAAU,0BAA0B,EAAE;IACvC,IAAI,0BAA0B,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|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# JavaScript printer helpers
|
|
2
|
+
|
|
3
|
+
These functions wrap the existing plugin API without changing native behavior.
|
|
4
|
+
They have no Angular or Ionic dependency. Sessions optionally remember connections through
|
|
5
|
+
application-supplied storage callbacks. All helpers share a queue to prevent overlapping
|
|
6
|
+
discovery and connection checks.
|
|
7
|
+
|
|
8
|
+
- `brotherPrinterPorts(model, isAndroid?)` returns connection choices for an existing
|
|
9
|
+
model enum, using `Capacitor.getPlatform()` when the override is omitted. USB is
|
|
10
|
+
Android-only. `wifi` also covers wired Ethernet. Unknown models return an empty array.
|
|
11
|
+
- `resolveBrotherPrinterPort(model, saved?)` keeps a supported saved connection.
|
|
12
|
+
Otherwise it prefers USB for QL-800/QL-810W on Android, then the first supported
|
|
13
|
+
connection. It returns `undefined` when no connection is supported.
|
|
14
|
+
- `brotherPrinterPortLabel(port)` returns a common display name: Wi-Fi, Bluetooth,
|
|
15
|
+
Bluetooth LE or USB. An undefined or unknown port returns an empty string.
|
|
16
|
+
- `brotherPrinterModel(name)` matches a discovery name to the existing model enum,
|
|
17
|
+
including product aliases such as QL-820NWBc. Unknown names return `undefined`.
|
|
18
|
+
- `searchBrotherPrinters(options, model?)` collects discovery events into an
|
|
19
|
+
array. It registers its listener before searching and removes it when the search
|
|
20
|
+
succeeds or fails. No results returns an empty array; native errors propagate.
|
|
21
|
+
- `prepareBrotherPrinters(options, model, previous?)` first checks a saved channel
|
|
22
|
+
when its model and port match. If available, it returns `[previous]`; otherwise it
|
|
23
|
+
discovers again. USB always discovers through the native permission flow. A rejected
|
|
24
|
+
availability check propagates its error rather than silently starting discovery.
|
|
25
|
+
|
|
26
|
+
- `checkBrotherPrinterChannel({ port, channelInfo })` checks an explicitly selected
|
|
27
|
+
or manually entered address without requiring discovery metadata. It returns a
|
|
28
|
+
boolean and never discovers or switches to another printer. Native errors propagate.
|
|
29
|
+
A successful check confirms connectivity, not the printer model or loaded paper.
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import {
|
|
33
|
+
searchBrotherPrinters,
|
|
34
|
+
BRLMPrinterPort, BRLMPrinterModelName,
|
|
35
|
+
} from '@rdlabo/capacitor-brotherprint';
|
|
36
|
+
|
|
37
|
+
const printers = await searchBrotherPrinters(
|
|
38
|
+
{ port: BRLMPrinterPort.wifi, searchDuration: 10 },
|
|
39
|
+
BRLMPrinterModelName.QL_820NWB,
|
|
40
|
+
);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Search, preparation and explicit connection checks share a queue. The next call begins after the previous
|
|
44
|
+
native operation and listener cleanup finish, even if the previous call failed. No JS
|
|
45
|
+
search timeout releases the queue early. Do not mix concurrent raw `BrotherPrint.search()`
|
|
46
|
+
or connection-check calls with these helpers: raw calls bypass this queue and native
|
|
47
|
+
events have no request ID. Printing also remains outside this queue; await connection
|
|
48
|
+
preparation before calling `printImage`.
|
|
49
|
+
The optional model filters non-USB results; USB results are retained even when the SDK
|
|
50
|
+
returns an empty model or address. Connection choices do not extend native support;
|
|
51
|
+
consult the existing README and SDK installation instructions.
|
|
52
|
+
|
|
53
|
+
When using the stateless functions, the app owns loading indicators, selection UI and caching. Pass its saved channel to
|
|
54
|
+
`prepareBrotherPrinters`, select a returned channel, and call the existing
|
|
55
|
+
`BrotherPrint.printImage()` with the selected port and address. The helper does not
|
|
56
|
+
retry printing. Store the chosen channel in the app for the next preparation.
|
|
57
|
+
|
|
58
|
+
Use `searchDuration: 3` for a short preliminary search or `10` for a normal search;
|
|
59
|
+
these are caller choices, not automatic retries. Cancellation through the existing
|
|
60
|
+
native methods affects the active search; it does not remove queued helper calls.
|
|
61
|
+
No controller instance or separate listener cleanup call is required.
|
|
62
|
+
|
|
63
|
+
See the [plain TypeScript print example](https://github.com/rdlabo-dev/capacitor-brotherprint/blob/main/examples/plain-typescript.ts).
|
|
64
|
+
In a source checkout, `npm test` tests the helpers and typechecks that example.
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
For a manually entered device, retain the selected port alongside its address. Do not
|
|
68
|
+
infer Bluetooth from punctuation: iOS Bluetooth uses a serial number and BLE uses
|
|
69
|
+
an SDK local name. Call `checkBrotherPrinterChannel` and print to that same channel
|
|
70
|
+
only if it is available. Use `prepareBrotherPrinters` for USB discovery/permissions.
|
|
71
|
+
The application supplies the model and label settings independently.
|
|
72
|
+
|
|
73
|
+
A screen can ignore a completed result after it closes. The helper still awaits native
|
|
74
|
+
completion and removes its listener. Periodic scanning intervals, screen cancellation
|
|
75
|
+
policy, known-device lists and preferred-device sorting remain application decisions.
|
|
76
|
+
|
|
77
|
+
See [design decisions](helper-design.md) for the practical scenarios behind these APIs.
|
|
78
|
+
|
|
79
|
+
## Screen lifetime
|
|
80
|
+
|
|
81
|
+
Use one `BrotherPrinterSession` for each print screen. Connection helpers use the Capacitor platform directly; the session owns discovery results, print notifications and disposal.
|
|
82
|
+
Do not reuse a disposed session. The stateless helpers remain available for
|
|
83
|
+
operations that do not have a screen lifetime.
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
import { BrotherPrinterSession, BRLMPrinterModelName, BRLMPrinterPort } from '@rdlabo/capacitor-brotherprint';
|
|
87
|
+
|
|
88
|
+
const session = new BrotherPrinterSession();
|
|
89
|
+
await session.listen({ onPrint: () => console.log('Printed') });
|
|
90
|
+
const printers = await session.prepare(
|
|
91
|
+
{ port: BRLMPrinterPort.wifi, searchDuration: 10 },
|
|
92
|
+
BRLMPrinterModelName.QL_820NWB,
|
|
93
|
+
);
|
|
94
|
+
// Select a printer, then call session.printImage with the existing native options.
|
|
95
|
+
// In the screen's exit handler:
|
|
96
|
+
await session.dispose();
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
`closed` becomes true immediately on disposal and `printers` becomes empty.
|
|
100
|
+
Queued searches are skipped and late results are ignored. Print callbacks stop
|
|
101
|
+
immediately; disposal waits for this session's print listener handles to be removed,
|
|
102
|
+
including pending registrations. Active native discovery still finishes before
|
|
103
|
+
another connection operation starts. An already started native print is not aborted.
|
|
104
|
+
After asynchronous app work (image generation, storage or a dialog), check `closed`
|
|
105
|
+
before presenting UI. Calls to `search`, `prepare` and `printImage` on a closed
|
|
106
|
+
session do not start native work. No automatic print retry is added.
|
|
107
|
+
|
|
108
|
+
## Remembering a connection
|
|
109
|
+
|
|
110
|
+
Supply three callbacks to use localStorage, sessionStorage, Ionic Storage or another
|
|
111
|
+
string store. The plugin does not detect or depend on a storage implementation.
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
const session = new BrotherPrinterSession({
|
|
115
|
+
storage: {
|
|
116
|
+
get: (key) => localStorage.getItem(key),
|
|
117
|
+
set: (key, value) => localStorage.setItem(key, value),
|
|
118
|
+
remove: (key) => localStorage.removeItem(key),
|
|
119
|
+
},
|
|
120
|
+
storagePrefix: 'labels:',
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
For an asynchronous store, pass the same callbacks returning its promises:
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
const session = new BrotherPrinterSession({
|
|
128
|
+
storage: {
|
|
129
|
+
get: (key) => storage.get(key),
|
|
130
|
+
set: (key, value) => storage.set(key, value),
|
|
131
|
+
remove: (key) => storage.remove(key),
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`get` returns a string or null/undefined; callbacks may complete synchronously or
|
|
137
|
+
asynchronously. The session serializes connection metadata as JSON under
|
|
138
|
+
`${storagePrefix}last-printer` (default: `brotherprint:last-printer`). It never stores
|
|
139
|
+
images or font/paper settings. Use the same prefix across screens to reuse a connection.
|
|
140
|
+
|
|
141
|
+
`printImage` remembers the selected port, address and configured model before printing.
|
|
142
|
+
This remembers the attempted connection, not proof of print success. `prepare` loads
|
|
143
|
+
it when the third argument is omitted, checks matching model/port and availability,
|
|
144
|
+
and otherwise discovers. USB always discovers again. An explicit channel overrides
|
|
145
|
+
storage; passing `null` skips the saved connection. Storage read/write failures and
|
|
146
|
+
invalid saved JSON are ignored; native errors still propagate. Disposal during a
|
|
147
|
+
storage operation prevents subsequent native work.
|
|
148
|
+
|
|
149
|
+
`await session.clearSavedPrinter()` removes the remembered connection; removal errors
|
|
150
|
+
propagate so the app can report failure. Without storage callbacks, sessions keep only
|
|
151
|
+
screen-local state. Stateless helpers continue to accept app-managed previous channels.
|