Audiovox P965 Datasheet Page 91

  • Download
  • Add to my manuals
  • Print
  • Page
    / 280
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 90
MikroNode
88
unaltered.
channel.close(force)
Close the channel. If there are any commands still waiting to be executed, they will be completed before
closing the channel.
If force is TRUE, then the channel is immediately closed. If the channel is running, the cancel command
is sent to stop any running listen commands, or potentially long running output.
Examples
Connect to a Mikrotik, and add an address to ether1
var api = require('mikronode');
var connection = new api('192.168.0.1','admin','password');
connection.connect(function(conn) {
var chan=conn.openChannel();
chan.write(['/ip/address/add','=interface=ether1','=address=192.168.1.1'],function() {
chan.on('trap',function(data) {
console.log('Error setting IP: '+data);
});
chan.on('done',function(data) {
console.log('IP Set.');
});
chan.close();
conn.close();
});
});
Writing the program for the example API conversation on the Mikrotik Wiki
var api = require('mikronode');
var connection = new api('192.168.0.1','admin','password');
connection.connect(function(conn) {
conn.closeOnDone(true);
var chan2=conn.openChannel(2);
chan2.write('/interface/listen',function(chan) {
chan.on('read',function(data) {
packet=api.parseItems([data])[0];
console.log('Interface change: '+JSON.stringify(packet));
});
});
var chan3=conn.openChannel(3);
chan3.closeOnDone(true);
Page view 90
1 2 ... 86 87 88 89 90 91 92 93 94 95 96 ... 279 280

Comments to this Manuals

No comments