Attached Files | zebraPrinter.diff [^] (5,744 bytes) 2019-10-31 16:28 [Show Content] [Hide Content]diff --git a/src/org/openbravo/retail/posterminal/OBPOSComponentProvider.java b/src/org/openbravo/retail/posterminal/OBPOSComponentProvider.java
--- a/src/org/openbravo/retail/posterminal/OBPOSComponentProvider.java
+++ b/src/org/openbravo/retail/posterminal/OBPOSComponentProvider.java
@@ -97,6 +97,7 @@
"webprinter/usbprinters/epsontmt20", "webprinter/usbprinters/epsontmt20ii",
"webprinter/usbprinters/epsontmt88v", "webprinter/usbprinters/ncr7197",
"webprinter/usbprinters/startsp100", "webprinter/usbprinters/wincorth230",
+ "webprinter/btprinters/genericBTPrinter", "webprinter/btprinters/zebraZQ320",
"model/currencypanel", "model/country", "model/salesrepresentative", "model/discountset",
"model/bpartnerset", "model/productcharacteristicvalue", "model/characteristicvalue",
diff --git a/web/org.openbravo.retail.posterminal/js/webprinter/bluetooth.js b/web/org.openbravo.retail.posterminal/js/webprinter/bluetooth.js
--- a/web/org.openbravo.retail.posterminal/js/webprinter/bluetooth.js
+++ b/web/org.openbravo.retail.posterminal/js/webprinter/bluetooth.js
@@ -25,22 +25,30 @@
return Promise.reject('Bluetooth not supported.');
}
+ const filters = [];
+ this.printertype.devices.forEach(function(item) {
+ filters.push({
+ services: item.services,
+ characteristict: item.characteristic
+ });
+ });
+
return navigator.bluetooth
.requestDevice({
- filters: [
- {
- services: [this.printertype.device.service]
- }
- ]
+ filters: filters
})
.then(
function(device) {
this.device = device;
- this.device.addEventListener(
- 'gattserverdisconnected',
- this.onDisconnected.bind(this)
- );
- return this.printertype.device;
+ this.deviceSelected = this.printertype.devices.find(function(d) {
+ return d.genericName === device.name;
+ });
+ if (OB.UTIL.isNullOrUndefined(this.deviceSelected)) {
+ this.deviceSelected = this.printertype.devices.find(function(d) {
+ return d.genericName === 'BlueTooth Printer';
+ });
+ }
+ return this.deviceSelected;
}.bind(this)
);
};
@@ -64,13 +72,13 @@
.then(
function(server) {
this.server = server;
- return server.getPrimaryService(this.printertype.device.service);
+ return server.getPrimaryService(this.deviceSelected.services);
}.bind(this)
)
.then(
function(service) {
return service.getCharacteristic(
- this.printertype.device.characteristic
+ this.deviceSelected.characteristic
);
}.bind(this)
)
diff --git a/web/org.openbravo.retail.posterminal/js/webprinter/btprinters/genericBTPrinter.js b/web/org.openbravo.retail.posterminal/js/webprinter/btprinters/genericBTPrinter.js
new file mode 100644
--- /dev/null
+++ b/web/org.openbravo.retail.posterminal/js/webprinter/btprinters/genericBTPrinter.js
@@ -0,0 +1,19 @@
+/*
+ ************************************************************************************
+ * Copyright (C) 2019 Openbravo S.L.U.
+ * Licensed under the Openbravo Commercial License version 1.0
+ * You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
+ * or in the legal folder of this module distribution.
+ ************************************************************************************
+ */
+
+/*global OB */
+(function() {
+ OB.PRINTERTYPES.GENERICBT.register({
+ name: 'Generic Bluetooth Receipt Printer',
+ genericName: 'BlueTooth Printer',
+ services: ['e7810a71-73ae-499d-8c15-faa9aef0c3f2'],
+ characteristic: 'bef8d6c9-9c21-4c9e-b632-bd58c1009f9f',
+ ESCPOS: OB.ESCPOS.Standard
+ });
+})();
diff --git a/web/org.openbravo.retail.posterminal/js/webprinter/btprinters/zebraZQ320.js b/web/org.openbravo.retail.posterminal/js/webprinter/btprinters/zebraZQ320.js
new file mode 100644
--- /dev/null
+++ b/web/org.openbravo.retail.posterminal/js/webprinter/btprinters/zebraZQ320.js
@@ -0,0 +1,19 @@
+/*
+ ************************************************************************************
+ * Copyright (C) 2019 Openbravo S.L.U.
+ * Licensed under the Openbravo Commercial License version 1.0
+ * You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
+ * or in the legal folder of this module distribution.
+ ************************************************************************************
+ */
+
+/*global OB */
+(function() {
+ OB.PRINTERTYPES.GENERICBT.register({
+ name: 'Zebra ZQ 320 Printer',
+ genericName: 'XXZFJ172400372',
+ services: ['38eb4a80-c570-11e3-9507-0002a5d5c51b'],
+ characteristic: '38eb4a82-c570-11e3-9507-0002a5d5c51b',
+ ESCPOS: OB.ESCPOS.Standard
+ });
+})();
diff --git a/web/org.openbravo.retail.posterminal/js/webprinter/standardprinters.js b/web/org.openbravo.retail.posterminal/js/webprinter/standardprinters.js
--- a/web/org.openbravo.retail.posterminal/js/webprinter/standardprinters.js
+++ b/web/org.openbravo.retail.posterminal/js/webprinter/standardprinters.js
@@ -17,11 +17,9 @@
GENERICBT: {
WebDevice: OB.Bluetooth,
buffersize: 20,
- device: {
- name: 'Generic Bluetooth Receipt Printer',
- service: 'e7810a71-73ae-499d-8c15-faa9aef0c3f2',
- characteristic: 'bef8d6c9-9c21-4c9e-b632-bd58c1009f9f',
- ESCPOS: OB.ESCPOS.Standard
+ devices: [],
+ register: function(printerusb) {
+ this.devices.push(printerusb);
}
},
GENERICUSB: {
|