diff --git a/VERSION b/VERSION index 81340c7..6c6aa7c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.4 +0.1.0 \ No newline at end of file diff --git a/nodejs-client/delimiter_example.js b/nodejs-client/delimiter_example.js index 96b3557..abf54cf 100644 --- a/nodejs-client/delimiter_example.js +++ b/nodejs-client/delimiter_example.js @@ -12,7 +12,7 @@ const sock = new zmq.Subscriber; let desired = [0x1d, 0x56, 0x31]; // toshiba is set, epson would be: [0x1b, 0x6d] for await (const [msg] of sock) { for(const c of msg) { - // console.log(c); // uncomment if you do not know the sequence, otherwise nothing is shown + console.log(c); // uncomment if you do not know the sequence, otherwise nothing is shown buf.push(c); const expected = desired[matched]; if(expected == c) { diff --git a/nodejs-client/index.js b/nodejs-client/index.js index 7d5e388..f907f4c 100644 --- a/nodejs-client/index.js +++ b/nodejs-client/index.js @@ -1,5 +1,4 @@ const zmq = require("zeromq"); -const msgpack = require('msgpack5')(); const sock = new zmq.Subscriber; @@ -7,9 +6,27 @@ const sock = new zmq.Subscriber; sock.connect("tcp://127.0.0.1:5678"); sock.subscribe(); console.log("Subscriber connected to port 5678"); + let buf = []; + let matched = 0; + let desired = [0x1b, 0x6d]; // ESC/P cut sequence for await (const [msg] of sock) { - const msg_decoded = msgpack.decode(msg); - console.log(msg_decoded.d); + for (const c of msg) { + buf.push(c); + console.log(c); + const expected = desired[matched]; + if (expected == c) { + matched++; + } else { + matched = 0; + } + + if (matched == desired.length) { + console.log("CUT found. Receipt:\n"); + console.log(buf.map(s => String.fromCharCode(s)).join("")); + matched = 0; + buf = []; + } + } } -})(); \ No newline at end of file +})(); diff --git a/src/debian/changelog b/src/debian/changelog index 6a9b37a..feb28e4 100644 --- a/src/debian/changelog +++ b/src/debian/changelog @@ -1,3 +1,9 @@ +nesto-usbproxy (0.1.0) main; urgency=medium + + * hotpluggin, mweal fixes, greengrass binary + + -- Martin Löper Tue, 27 Apr 2021 11:13:27 +0200 + nesto-usbproxy (0.0.4) main; urgency=medium * Link libzmq dynamically