code: function(data) {
  		//if (this.debug) console.log("Data: [" + data + "]");
  		if (this.echo) process.stdout.write(data);
  		this.instream = '' + this.instream + data.toString();
  
  		for (;;) {		// peel off full lines of input containing JSON
  			var m = this.instream.match(/\n/);
  			if (!m) break;			// no more full lines
  			var first_line = this.instream.slice(0, m.index + 1).trim();
  			this.instream = this.instream.slice(m.index + 1);
  
  			//if (this.debug) console.log('Line:', [first_line], [this.instream]);
  
  			if (first_line.match(this.prompt)) {
  				this.sendReply();
  				first_line = first_line.slice(this.promptlength);
  				this.instream = first_line + '\n' + this.instream;	// push back command text
  				continue;
  			}
  
  			if (first_line.charAt(0) == '{') {			// detect JSON update sent by Bitlash
  				var json_payload = JSON.parse(first_line);
  				//console.log('JSON upstream:', json_payload);
  				if (this.json_callback) this.json_callback(json_payload);
  			}
  			else this.reply.push(first_line);
  		}
  
  		// detect prompt indicating last command is complete
  		if (this.instream.match(this.prompt)) {
  			this.sendReply();
  			this.instream = this.instream.slice(this.promptlength);
  		}
  	}
docs: //////////////////  Serial port listener