blob: 0161d9c9082f7d2fc6cc3a834cb4f1433009973a [file] [log] [blame] [raw]
"use strict";
/**
* @constructor
*
* @param {BusConnector} bus
*/
function SerialTerminalAdapter(element, bus, columns, rows)
{
var serial = this;
var term_handler = function(s) {
for(var i = 0; i < s.length; i++) {
serial.bus.send("serial0-input", s.charCodeAt(i));
}
};
this.term = new Term(columns, rows, term_handler, 4096);
this.enabled = true;
this.bus = bus;
this.text = "";
this.text_new_line = false;
this.last_update = 0;
this.bus.register("serial0-output-char", function(s) { this.term.write(s); }, this);
this.destroy = function()
{
};
this.init = function()
{
this.destroy();
this.term.open(element);
};
this.init();
}