Audiovox P965 Datasheet Page 90

  • Download
  • Add to my manuals
  • Print
  • Page
    / 280
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 89
MikroNode
87
TODO
Cleanup login section in connect method.
Re-design code to hide internal methods and variables.
Utilize promises.
Write tests to make sure everything keeps working while making above changes.
API
Connection Object
Calling new api(host,user,pass,options) returns a connection object.
The options argument is optional. If specified, it is an object with these fields:
timeout: number of seconds to wait before timing out due to inactivity.
debug: a value between 0 and 5. Greater value means more verbose.
port: alternative port to connect. (In case it's being mapped with a firewall)
conn.connect(callback)
Connect to the target device. The callback function is called after successful login with the current
connection object as its parameter.
conn.openChannel(id)
Open and return a new channel object. Each channel is a unique command line to the mikrotik, allowing
simultaneous execution of commands. The ID parameter is optional.
conn.isConnected()
Returns true is currently connected to a mikrotik device.
conn.closeChannel(id)
Closes an open channel. This will call the close method of the channel object.
conn closeOnDone(b)
If b == true, when a done event occurs, close the connection after all channels have been closed.
conn.close(force)
Close the connection. If force is true, force close of any open channels then close this connection.
Channel
The following methods are available for channels:
channel.closeOnDone(b)
If b == true, when a done event occurs, close the channel after all commands queued have been
executed.
channel.setSaveBuffer(b)
If b is true, then save each line received in a buffer and pass the entire buffer to the done event.
Otherwise the done event will not get all the lines, only the last line.
This is handy when following trailing output from a listen command, where the data could be endless.
channel.getConnection()
channel.getId()
channel.write(lines,writeCallback)
Lines can be a string, or an array of strings. If it is a string, then it is split on the EOL character and each
resulting line is sent as a separate word (in API speak) If lines is an array, then each element is sent
Page view 89
1 2 ... 85 86 87 88 89 90 91 92 93 94 95 ... 279 280

Comments to this Manuals

No comments