Serial Plotter implementation (#597)

* spawn new window where to instantiate serial plotter app

* initialize serial monito web app

* connect serial plotter app with websocket

* use npm serial-plotter package

* refactor monitor connection and fix some connection issues

* fix clearConsole + refactor monitor connection

* add serial unit tests

* refactoring and cleaning code
This commit is contained in:
Alberto Iannaccone
2021-11-23 18:18:20 +01:00
committed by GitHub
parent 9863dc2f90
commit 20f7712129
40 changed files with 1670 additions and 821 deletions

View File

@@ -0,0 +1,29 @@
import * as express from 'express';
import { injectable } from 'inversify';
import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
import path = require('path');
@injectable()
export class PlotterBackendContribution
implements BackendApplicationContribution
{
async initialize(): Promise<void> {}
configure(app: express.Application): void {
const relativePath = [
'..',
'..',
'..',
'build',
'arduino-serial-plotter-webapp',
'build',
];
app.use(express.static(path.join(__dirname, ...relativePath)));
app.get('/plotter', (req, res) => {
console.log(
`Serving serial plotter on http://${req.headers.host}${req.url}`
);
res.sendFile(path.join(__dirname, ...relativePath, 'index.html'));
});
}
}