renamed 'blinkstick.js' to 'controller.js'

This commit is contained in:
Daniel Sommer 2022-03-03 20:59:12 +01:00
parent 12d11aebd3
commit 91a50073da
4 changed files with 9 additions and 9 deletions

View file

@ -2,7 +2,7 @@ const logger = require('./libs/logger.js');
const util = require('./libs/util.js'); const util = require('./libs/util.js');
const cli = require('./libs/cli.js'); const cli = require('./libs/cli.js');
const server = require('./libs/server.js'); const server = require('./libs/server.js');
const blinkstick = require('./libs/blinkstick.js'); const controller = require('./libs/controller.js');
const packageJSON = require('./package'); const packageJSON = require('./package');
const INTERRUPTS = ['SIGINT', 'SIGTERM']; const INTERRUPTS = ['SIGINT', 'SIGTERM'];
@ -25,7 +25,7 @@ async function main() {
if (await cli.handleArguments()) { if (await cli.handleArguments()) {
exit(); exit();
} }
await blinkstick.findBlinkstick(); await controller.findBlinkstick();
logger.info(await server.start()); logger.info(await server.start());
server.handleRequests(); server.handleRequests();
} }

View file

@ -1,5 +1,5 @@
const logger = require('./logger.js'); const logger = require('./logger.js');
const blinkstick = require('./blinkstick.js'); const controller = require('./controller.js');
const constants = require('./constants.js'); const constants = require('./constants.js');
async function handleArguments() { async function handleArguments() {
@ -9,7 +9,7 @@ async function handleArguments() {
case constants.ARG_CONFIG: case constants.ARG_CONFIG:
continue; continue;
case constants.ARG_GET_SERIALS: case constants.ARG_GET_SERIALS:
logger.info('blinksticks: ' + JSON.stringify(await blinkstick.findBlinkstick(constants.ALL))); logger.info('blinksticks: ' + JSON.stringify(await controller.findBlinkstick(constants.ALL)));
handled++; handled++;
break; break;
} }

View file

@ -1,6 +1,6 @@
const config = require('../config.json'); const config = require('../config.json');
const logger = require('./logger.js'); const logger = require('./logger.js');
const blinkstick = require('./blinkstick.js'); const controller = require('./controller.js');
const parser = require('./parser.js'); const parser = require('./parser.js');
const constants = require('./constants.js'); const constants = require('./constants.js');
const path = require('path'); const path = require('path');
@ -65,7 +65,7 @@ function handleRequests() {
async function handleSimpleAnimation(config, response) { async function handleSimpleAnimation(config, response) {
try { try {
response.end(JSON.stringify(await blinkstick.simple(config))); response.end(JSON.stringify(await controller.simple(config)));
} catch (err) { } catch (err) {
logger.error(err); logger.error(err);
response.status(500); response.status(500);
@ -74,12 +74,12 @@ async function handleSimpleAnimation(config, response) {
} }
async function handleComplexAnimation(config, response) { async function handleComplexAnimation(config, response) {
if (blinkstick.isInfiniteAnimation(config)) { if (controller.isInfiniteAnimation(config)) {
response.end(JSON.stringify({status: 'ok', time: 'infinite'})); response.end(JSON.stringify({status: 'ok', time: 'infinite'}));
response = undefined; response = undefined;
} }
try { try {
const result = await blinkstick.complex(config); const result = await controller.complex(config);
if (response === undefined) { if (response === undefined) {
return; return;
} }
@ -96,7 +96,7 @@ async function handleComplexAnimation(config, response) {
async function handlePowerOff(config, response) { async function handlePowerOff(config, response) {
try { try {
response.end(JSON.stringify(await blinkstick.powerOff(config))); response.end(JSON.stringify(await controller.powerOff(config)));
} catch (err) { } catch (err) {
response.status(500); response.status(500);
response.end(JSON.stringify({status: 'error', error: err.message})); response.end(JSON.stringify({status: 'error', error: err.message}));