Create GatewayServer class
This commit is contained in:
parent
dcfbd2f498
commit
6e4618af37
2 changed files with 22 additions and 4 deletions
17
GatewayServer.mjs
Normal file
17
GatewayServer.mjs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
import Constants from './constants.mjs';
|
||||||
|
import Spi from 'spi';
|
||||||
|
import Gpio from 'gpio';
|
||||||
|
|
||||||
|
class GatewayServer {
|
||||||
|
constructor(in_settings) {
|
||||||
|
this.settings = in_settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default GatewayServer;
|
|
@ -1,15 +1,13 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
import Constants from './constants.mjs';
|
import GatewayServer from './GatewayServer.mjs';
|
||||||
import Spi from 'spi';
|
|
||||||
import Gpio from 'gpio';
|
|
||||||
|
|
||||||
const settings = {
|
const settings = {
|
||||||
spi_device: "/dev/spidev0.0"
|
spi_device: "/dev/spidev0.0"
|
||||||
};
|
};
|
||||||
|
|
||||||
// Skip the first 2 items - they are node file.js
|
// Skip the first 2 items - they are node file.js
|
||||||
let extras = [];
|
const extras = [];
|
||||||
for(let i = 2; i < process.argv.length; i++) {
|
for(let i = 2; i < process.argv.length; i++) {
|
||||||
if(!process.argv[i].startsWith("-")) {
|
if(!process.argv[i].startsWith("-")) {
|
||||||
extras.push(process.argv[i]);
|
extras.push(process.argv[i]);
|
||||||
|
@ -37,3 +35,6 @@ for(let i = 2; i < process.argv.length; i++) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const server = new GatewayServer(settings);
|
||||||
|
server.start();
|
||||||
|
|
Reference in a new issue