-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
copytoproduction.sh | ||
utils/log.txt | ||
bower_components/ | ||
config.json | ||
**/.DS_Store | ||
.idea/ | ||
|
||
# Logs | ||
logs | ||
utils/*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules | ||
jspm_packages | ||
/bower_components | ||
bower_components/** | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional REPL history | ||
.node_repl_history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"database_user": "", | ||
"database_password": "", | ||
"web_host": "0.0.0.0", | ||
"web_port": 8002, | ||
"aprsfi_apikey": "", | ||
"serial_rotors": "/dev/ttyUSB0", | ||
"serial_transceiver_keenwoodts2000": "/dev/ttyS0", | ||
"serial_transceiver_icom9100": "/dev/ttyUSB1", | ||
"log_file": "utils/log.txt", | ||
"log_size_sent": "10000" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "cosmos-tcpserver", | ||
"version": "1.0.0", | ||
"description": "GranaSAT Dashboard", | ||
"main": "app.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/granasat/GranaSatDashboard.git" | ||
}, | ||
"author": "Granasat", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/granasat/GranaSatDashboard/issues" | ||
}, | ||
"homepage": "https://github.com/granasat/GranaSatDashboard#readme", | ||
"dependencies": { | ||
"colors": "^1.1.2", | ||
"dateformat": "^1.0.12", | ||
"mysql": "^2.11.1" | ||
}, | ||
"devDependencies": { | ||
"grunt": "^1.0.1", | ||
"grunt-wiredep": "^3.0.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
SOURCE: https://gist.github.com/tedmiston/5935757 | ||
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp | ||
server, but for some reason omit a client connecting to it. | ||
And connect with a tcp client from the command line using netcat, the *nix | ||
utility for reading and writing across tcp/udp network connections. I've only | ||
used it for debugging myself. | ||
$ netcat 127.0.0.1 1337 | ||
MODIFIED FOR SAVING INPUT DATA TO A FILE | ||
*/ | ||
|
||
//Log | ||
var log = require('./utils/logger.js').Logger; | ||
|
||
//Config | ||
var config = require('./config.json'); | ||
|
||
var net = require('net'); | ||
|
||
var server = net.createServer(function(socket) { | ||
socket.on('data', function (input) { | ||
log("Received data: " + input.toString('utf8'), "info"); | ||
}); | ||
}); | ||
|
||
server.listen(config.web_port, config.web_host); | ||
console.log("Listening on port " + config.web_port + " on " + config.web_host); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
var config = require('../config.json') | ||
var colors = require('colors') | ||
var dateFormat = require('dateformat') | ||
var fs = require('fs') | ||
|
||
|
||
exports.Logger = function(msg, type) { | ||
|
||
var d = dateFormat(new Date(), "dd/mm/yyyy HH:MM:ss"); | ||
var s = d + " -> " + msg + "\n"; | ||
|
||
fs.appendFile(config.log_file, s, function (err) { | ||
if (err){ | ||
console.log(d.grey + " Log file Error: ".red + err.red); | ||
} | ||
}); | ||
|
||
if (type == "warn") { | ||
console.log(d.grey + " Warn: ".yellow + msg.yellow.italic); | ||
} else if (type == "error") { | ||
console.log(d.grey + " Error: ".red + msg.red); | ||
} else { | ||
console.log(d.grey + " Info: ".green + msg.green); | ||
} | ||
} | ||
|
||
exports.APRSLogger = function(msg) { | ||
|
||
var d = dateFormat(new Date(), "dd/mm/yyyy HH:MM:ss"); | ||
var s = d + " -> " + msg + "\n"; | ||
|
||
fs.appendFile(config.aprs_log_file, s, function (err) { | ||
if (err) throw err; | ||
}); | ||
|
||
} |