Ejemplo n.º 1
0
"undefined"!=typeof c?(new e(b,c,a)).run(this):a&&a(Error("argument invalid"))};f.prototype.getStates=function(b,c){b?(new g(b,c)).run(this):c&&c(Error("deviceList is null"))};f.prototype._buildCommand=function(b,c){var a=f.prototype.PARAM.replace("@1","command");b=b.split(".");a=a.replace("@2",d(b[0]+"."+(b[1]?b[1]+".":"")+c));c=f.prototype.REQ.replace("@1","ExecuteCommand");c=c.replace("@2","hcontrol");c=c.replace("@3",a);a=c.length;for(a=a.toString();8>a.length;)a="0"+a;return"MCM:PLUGIN\nXML\n"+
a+"\n"+c};f.prototype._buildStatus=function(b){var a="",e;for(e in b)if(b.hasOwnProperty(e)){var g=f.prototype.PARAM.replace("@1",d(e));g=g.replace("@2",d(b[e]));a+=g}b=f.prototype.REQ.replace("@1","GetStates");b=b.replace("@2","hcontrol");b=b.replace("@3",a);a=b.length;for(a=a.toString();8>a.length;)a="0"+a;return"MCM:PLUGIN\nXML\n"+a+"\n"+b};f.prototype._connect=function(a,c){var b=this,d={port:this.port,host:this.ip},e=!1,f=c,g=require("net").connect(d);a.__socket=g;g.setTimeout(1E4);g.setEncoding("utf8");
Ejemplo n.º 2
0
a+"\n"+c};f.prototype._buildStatus=function(b){var a="",e;for(e in b)if(b.hasOwnProperty(e)){var g=f.prototype.PARAM.replace("@1",d(e));g=g.replace("@2",d(b[e]));a+=g}b=f.prototype.REQ.replace("@1","GetStates");b=b.replace("@2","hcontrol");b=b.replace("@3",a);a=b.length;for(a=a.toString();8>a.length;)a="0"+a;return"MCM:PLUGIN\nXML\n"+a+"\n"+b};f.prototype._connect=function(a,c){var b=this,d={port:this.port,host:this.ip},e=!1,f=c,g=require("net").connect(d);a.__socket=g;g.setTimeout(1E4);g.setEncoding("utf8");