Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var serial = {
- xhr: new XMLHttpRequest(),
- port: null,
- response: "",
- timeout: 1000,
- host: "http://localhost:8886",
- open: function (port, baudrate) {
- var url = this.host + "/serial/open?port=" + port + "&baudrate=" + baudrate + "&timeout=" + this.timeout;
- this.xhr.open("GET", url, false);
- this.xhr.send();
- if (this.xhr.status != 200) {
- this.port = null;
- return false;
- } else {
- this.port = port;
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement