List Wireless - siriuscrm/ejemplos GitHub Wiki
var express = require('express'); var app = express(); var api = require('mikronode');
app.get('/data', function(req, res){
var connection = new api('172.16.67.1','admin','test22a'); connection.connect(function(conn) {
var chan=conn.openChannel();
chan.write('/interface/wireless/registration-table/getall',function() {
chan.on('done',function(data) {
var pepito = exports.pepito = parsed;
var parsed = api.parseItems(data);
res.send(parsed); //replace with your data here
res.send ('global.parsed'); console.log(global.parsed);
var dat = 'mac-address';
var dat1 = 'comment';
var dat2 = 'tx-signal-strength';
// var dat3 = 'strength-at-rates';
var dat4 = 'distance';
parsed.forEach(function(item) {
console.log('Radio-Name/Uptime/Comment/Signal-Strength/Distance: '+item[dat]+"/"+item.uptime+"/"+item[dat1]+"/"+item[dat2]+"/"+item[dat4]);
// console.log("Session: %j", item);
});
chan.close();
conn.close();
});
});
});
});
app.listen(3000);