Add a decode-test action to the Node.js server.
This commit is contained in:
parent
b95505eaff
commit
46bb1d9047
2 changed files with 13 additions and 3 deletions
|
@ -16,6 +16,7 @@ ${a.fblue}${a.hicol}Usage:${a.reset}
|
||||||
|
|
||||||
${a.fblue}${a.hicol}Subcommands:${a.reset}
|
${a.fblue}${a.hicol}Subcommands:${a.reset}
|
||||||
${a.fyellow}ttn-app-server${a.reset} Starts the thing network application server
|
${a.fyellow}ttn-app-server${a.reset} Starts the thing network application server
|
||||||
|
${a.fyellow}decode-test${a.reset} Decodes a base64 encoded message
|
||||||
${a.fyellow}process-data${a.reset} Consolidates collected data from the IoT device and the TTN app server
|
${a.fyellow}process-data${a.reset} Consolidates collected data from the IoT device and the TTN app server
|
||||||
${a.fyellow}train-ai${a.reset} Trains the AI on the consolidated data
|
${a.fyellow}train-ai${a.reset} Trains the AI on the consolidated data
|
||||||
${a.fyellow}serve-map${a.reset} Serves the final output map using the trained AI
|
${a.fyellow}serve-map${a.reset} Serves the final output map using the trained AI
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
import c from './bootstrap/container.mjs';
|
import c from './bootstrap/container.mjs';
|
||||||
|
|
||||||
import show_help from './help.mjs';
|
import show_help from './help.mjs';
|
||||||
|
import { decode_payload } from './ttn-app-server/DecodePayload.mjs';
|
||||||
|
|
||||||
const settings = c.resolve("settings");
|
const settings = c.resolve("settings");
|
||||||
const a = c.resolve("ansi");
|
const a = c.resolve("ansi");
|
||||||
|
@ -46,7 +47,7 @@ if(extras.length < 1) {
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
l.log(`${a.fgreen}${a.hicol}*** LoRaWAN Signal Mapper ***`);
|
l.log(`${a.fgreen}${a.hicol}*** LoRaWAN Signal Mapper ***${a.reset}`);
|
||||||
|
|
||||||
switch(extras[0]) {
|
switch(extras[0]) {
|
||||||
case "ttn-app-server":
|
case "ttn-app-server":
|
||||||
|
@ -56,11 +57,19 @@ switch(extras[0]) {
|
||||||
app_server.run();
|
app_server.run();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "decode-test":
|
||||||
|
l.log(`${a.fgreen}${a.hicol}Decoding message${a.reset}`);
|
||||||
|
if(process.argv.length < 4) {
|
||||||
|
l.error("No message specified. Specify the message to decode in single quotes directly after 'decode-test'.");
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
l.log("Input: ", process.argv[3]);
|
||||||
|
l.log("Output: ", decode_payload(process.argv[3]));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
console.error(`${a.fred}${a.hicol}Error: Subcommand '${extras[0]}' not recognised.${a.reset}`);
|
console.error(`${a.fred}${a.hicol}Error: Subcommand '${extras[0]}' not recognised.${a.reset}`);
|
||||||
console.error( `${a.fred}Perhaps you mistyped it, or it hasn't been implemented yet?`);
|
console.error( `${a.fred}Perhaps you mistyped it, or it hasn't been implemented yet?`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5: Cleanup
|
|
||||||
|
|
Loading…
Reference in a new issue