mirror of
https://github.com/lxsang/antd-web-apps
synced 2025-07-27 02:59:47 +02:00
first communication
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
// Generated by CoffeeScript 1.9.3
|
||||
// Generated by CoffeeScript 1.12.7
|
||||
(function() {
|
||||
var APIManager, BaseObject, MarkOn, WVNC, require,
|
||||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
@ -186,6 +186,11 @@
|
||||
WVNC.prototype.openSession = function() {
|
||||
var me;
|
||||
me = this;
|
||||
$("#stop").click(function(e) {
|
||||
if (me.socket) {
|
||||
return me.socket.close();
|
||||
}
|
||||
});
|
||||
if (this.socket) {
|
||||
this.socket.close();
|
||||
}
|
||||
@ -209,7 +214,7 @@
|
||||
|
||||
WVNC.prototype.initConnection = function() {
|
||||
var vncserver;
|
||||
vncserver = "localhost:5901";
|
||||
vncserver = "mrsang.local";
|
||||
return this.socket.send(this.buildCommand(0x01, vncserver));
|
||||
};
|
||||
|
||||
@ -233,7 +238,40 @@
|
||||
};
|
||||
|
||||
WVNC.prototype.consume = function(e) {
|
||||
return console.log(e);
|
||||
var arr, cmd, data, dec, depth, h, pass, pixels, user, w, x, y;
|
||||
data = new Uint8Array(e.data);
|
||||
cmd = data[0];
|
||||
switch (cmd) {
|
||||
case 0xFE:
|
||||
data = data.subarray(1, data.length - 1);
|
||||
dec = new TextDecoder("utf-8");
|
||||
return console.log("Error", dec.decode(data));
|
||||
case 0x82:
|
||||
console.log("Request for login");
|
||||
user = "mrsang";
|
||||
pass = "!x$@n9";
|
||||
arr = new Uint8Array(user.length + pass.length + 1);
|
||||
arr.set((new TextEncoder()).encode(user), 0);
|
||||
arr.set(['\0'], user.length);
|
||||
arr.set((new TextEncoder()).encode(pass), user.length + 1);
|
||||
return this.socket.send(this.buildCommand(0x03, arr));
|
||||
case 0x83:
|
||||
console.log("resize");
|
||||
w = data[1] | (data[2] << 8);
|
||||
h = data[3] | (data[4] << 8);
|
||||
depth = data[5];
|
||||
return console.log(w, h, depth);
|
||||
case 0x84:
|
||||
console.log("update");
|
||||
x = data[1] | (data[2] << 8);
|
||||
y = data[3] | (data[4] << 8);
|
||||
w = data[5] | (data[6] << 8);
|
||||
h = data[7] | (data[8] << 8);
|
||||
pixels = data.subarray(9, data.length - 1);
|
||||
return console.log(x, y, w, h, pixels.length);
|
||||
default:
|
||||
return console.log(cmd);
|
||||
}
|
||||
};
|
||||
|
||||
return WVNC;
|
||||
|
Reference in New Issue
Block a user