desarrollosconsejeria/adtos-server/1.7-0/adtos/clver.pas @ 23a384b9
54e95a47 | Elisa | {
|
|
23a384b9 | Elisa | Adtos 1.0 Software de gestión de Aulas Tecnológicas
|
|
Copyright (C) 2008-2009, Consejería de Educación,Junta de Extremadura
|
|||
54e95a47 | Elisa | Programación: Manuel Narváez Martínez <mnarvaez007@gmail.com>
|
|
Diseño gráfico: Ana María Zamora Moreno
|
|||
Desarrollado con Lazarus 0.9.26
|
|||
This program is free software; you can redistribute it and/or modify
|
|||
it under the terms of the GNU General Public License as published by
|
|||
the Free Software Foundation; either version 2 of the License, or
|
|||
(at your option) any later version.
|
|||
This program is distributed in the hope that it will be useful,
|
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||
GNU General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License
|
|||
along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
}
|
|||
unit clver;
|
|||
{$mode objfpc}{$H+}
|
|||
interface
|
|||
uses
|
|||
23a384b9 | Elisa | globales,unix,Classes,StrUtils,SysUtils, IdComponent, IdTCPClient;
|
|
54e95a47 | Elisa | ||
type
|
|||
ThrVer = class(TThread)
|
|||
private
|
|||
{ Private declarations }
|
|||
fPuertoVNC,fPuerto,fminumero,fnumeroequipos:integer;
|
|||
fmodobs, ftipoven:integer;
|
|||
23a384b9 | Elisa | fAdministrador:string;
|
|
54e95a47 | Elisa | fusuario:string;
|
|
fcomando,fhost:string;
|
|||
fcliente:TIdTcpClient;
|
|||
Fwm,Fhm,Fxm,Fym:integer;
|
|||
farcontra:string;
|
|||
procedure CalcularTamanoPosVnc();
|
|||
procedure observar();
|
|||
protected
|
|||
procedure Execute; override;
|
|||
public
|
|||
23a384b9 | Elisa | constructor Create(arcontra:string;numequi,minumero:integer;comando:string;tipoven,modobs:integer;usuario,host,Administrador:string);
|
|
54e95a47 | Elisa | end;
|
|
implementation
|
|||
23a384b9 | Elisa | constructor ThrVer.Create(arcontra:string;numequi,minumero:integer;comando:string;tipoven,modobs:integer;usuario,host,Administrador:string);
|
|
54e95a47 | Elisa | begin
|
|
inherited Create(true);
|
|||
farcontra:=arcontra;
|
|||
fpuertovnc:=PUERTO_VNC;
|
|||
fnumeroequipos:=numequi;
|
|||
fminumero:=minumero;
|
|||
fmodobs:=modobs;
|
|||
ftipoven:=tipoven;
|
|||
fusuario:=usuario;
|
|||
23a384b9 | Elisa | fAdministrador:=Administrador;
|
|
54e95a47 | Elisa | fhost:=host;
|
|
fpuerto:=PUERTO_USUARIO;
|
|||
fcomando:=comando;
|
|||
FreeOnTerminate:=True;
|
|||
CalcularTamanoPosVnc();
|
|||
end;
|
|||
procedure ThrVer.observar();
|
|||
const
|
|||
ORD_VER_SILENCIOSO:string='xvnc4viewer -ViewOnly -UseLocalCursor=0 -LowColourLevel 1 -Shared -passwd %s -geometry %sx%s+%s+%s %s:%d -name %s & 2>>/dev/null';
|
|||
ORD_VER_AYUDA:string='xvnc4viewer -UseLocalCursor=0 -LowColourLevel 1 -Shared -passwd %s -geometry %sx%s+%s+%s %s:%d -name %s & 2>>/dev/null';
|
|||
var
|
|||
mil,mit,miw,mih:integer;
|
|||
orden:string;
|
|||
begin
|
|||
if ftipoven=-1 then
|
|||
begin
|
|||
mil:=Fxm;mit:=Fym;miw:=Fwm;mih:=Fhm;
|
|||
end
|
|||
else
|
|||
begin
|
|||
mil:=0;mit:=0;miw:=1020;mih:=715
|
|||
end;
|
|||
orden:=ifthen(fmodobs=0,ORD_VER_SILENCIOSO,ORD_VER_AYUDA);
|
|||
23a384b9 | Elisa | orden:=Format(orden,[farcontra,inttostr(miw),inttostr(mih),inttostr(mil),inttostr(mit),fhost,fpuertovnc,fusuario]);
|
|
fpsystem(orden);
|
|||
54e95a47 | Elisa | end;
|
|
procedure ThrVer.CalcularTamanoPosVnc();
|
|||
var
|
|||
numfilas:integer;
|
|||
numcolum:integer;
|
|||
begin
|
|||
if fnumeroequipos>36 then
|
|||
numfilas:=7
|
|||
else
|
|||
numfilas:=6;
|
|||
numcolum:=6;
|
|||
Fwm:=1024 div numcolum;
|
|||
Fhm:=740 div numfilas;
|
|||
Fxm:= (fminumero mod numcolum)*Fwm;
|
|||
Fym:= (fminumero div numfilas)*Fhm;
|
|||
end;
|
|||
procedure ThrVer.Execute;
|
|||
begin
|
|||
try
|
|||
fcliente:=TidTcpClient.create(nil);
|
|||
fcliente.Host:=fhost;
|
|||
fcliente.port:=fPuerto;
|
|||
fcliente.connect;
|
|||
try
|
|||
fcliente.GetResponse(200);
|
|||
fcliente.sendCmd(fcomando,210);
|
|||
observar();
|
|||
finally
|
|||
fcliente.Disconnect;
|
|||
fcliente.free;
|
|||
end;
|
|||
except
|
|||
writeLn('Error al enviar el comando');
|
|||
end;
|
|||
end;
|
|||
end.
|