-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrenderer.js
44 lines (43 loc) · 1.34 KB
/
renderer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// // This file is required by the index.html file and will
// // be executed in the renderer process for that window.
// // All of the Node.js APIs are available in this process.
//
// const SerialPort = require('SerialPort');
// const createTable = require('data-table');
// let m;
// let port = new SerialPort('/dev/tty.usbserial', {
// parser: SerialPort.parsers.readline('\n'),
// baudrate: 19200
// });
//
// // Stream all data coming in from the serial port.
// port.on('data', function (data) {
// document.getElementById('weight').textContent = data;
// });
//
// SerialPort.list((err, ports) => {
// console.log('ports', ports);
// if (err) {
// document.getElementById('error').textContent = err.message;
// return;
// } else {
// document.getElementById('error').textContent = '';
// }
//
// if (ports.length === 0) {
// document.getElementById('error').textContent = 'No ports discovered';
// }
//
// const headers = Object.keys(ports[0]);
// const table = createTable(headers);
// tableHTML = '';
// table.on('data', data => tableHTML += data);
// table.on('end', () => document.getElementById('ports').innerHTML = tableHTML);
// ports.forEach(port => table.write(port));
// table.end();
// });
//
// let populateStorage = (dataLine) => {
//
// };
// USED ONLY FOR TESTING. ACTUAL RENDERER IS THE WEIGH STATION UI