This app provides monitoring and information features for the common freifunk user and the technical stuff of a freifunk community.
Code base is taken from a TUM Practical Course project and added here to see if Freifunk Altdorf can use it.
https://www.freifunk-altdorf.de
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
640 B
33 lines
640 B
6 years ago
|
#!/usr/bin/env node
|
||
|
|
||
|
var tty = require('tty')
|
||
|
var cursor = require('../')(process.stdout)
|
||
|
|
||
|
// listen for the queryPosition report on stdin
|
||
|
process.stdin.resume()
|
||
|
raw(true)
|
||
|
|
||
|
process.stdin.once('data', function (b) {
|
||
|
var match = /\[(\d+)\;(\d+)R$/.exec(b.toString())
|
||
|
if (match) {
|
||
|
var xy = match.slice(1, 3).reverse().map(Number)
|
||
|
console.error(xy)
|
||
|
}
|
||
|
|
||
|
// cleanup and close stdin
|
||
|
raw(false)
|
||
|
process.stdin.pause()
|
||
|
})
|
||
|
|
||
|
|
||
|
// send the query position request code to stdout
|
||
|
cursor.queryPosition()
|
||
|
|
||
|
function raw (mode) {
|
||
|
if (process.stdin.setRawMode) {
|
||
|
process.stdin.setRawMode(mode)
|
||
|
} else {
|
||
|
tty.setRawMode(mode)
|
||
|
}
|
||
|
}
|