From fc7425e97d417280b06288b654ecd58e24000cfc Mon Sep 17 00:00:00 2001 From: Jay Date: Fri, 1 Sep 2017 20:17:08 +0800 Subject: [PATCH] fix bug and add service file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.修正列印大小無法寫入BUG 2.加入SYSTEMD系統服務腳本 --- PrinterDev.js | 2 +- initscript/systemd/ble-server.service | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 initscript/systemd/ble-server.service diff --git a/PrinterDev.js b/PrinterDev.js index 137df75..32ac7c7 100644 --- a/PrinterDev.js +++ b/PrinterDev.js @@ -66,7 +66,7 @@ class PrinterDevice { case 's': let size = tmp.substring(2) let sarr = size.trim().split(',') - if (sarr != 2) break + if (sarr.length != 2) break if(!isFinite(sarr[0]) || !isFinite(sarr[1])) break sarr = sarr.map(t => Math.floor(t)) this._printer.size(sarr[0], sarr[1]) diff --git a/initscript/systemd/ble-server.service b/initscript/systemd/ble-server.service new file mode 100644 index 0000000..f3d07da --- /dev/null +++ b/initscript/systemd/ble-server.service @@ -0,0 +1,11 @@ +[Unit] +Description=BLE Printer Server + +[Service] +ExecStart=/usr/bin/node /usr/local/node/ble-server/app.js +Restart=always +User=root +Environment="NODE_ENV=production" + +[Install] +WantedBy=multi-user.target \ No newline at end of file