Proyecto

General

Perfil

Descargar (4 KB) Estadísticas
| Rama: | Revisión:
{
Adtos 1.0 Software de gestión de Aulas Tecnológicas
Copyright (C) 2008-2009, Consejería de Educación,Junta de Extremadura
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
globales,unix,Classes,StrUtils,SysUtils, IdComponent, IdTCPClient;

type
ThrVer = class(TThread)
private
{ Private declarations }
fPuertoVNC,fPuerto,fminumero,fnumeroequipos:integer;
fmodobs, ftipoven:integer;
fAdministrador:string;
fusuario:string;
fcomando,fhost:string;
fcliente:TIdTcpClient;
Fwm,Fhm,Fxm,Fym:integer;
farcontra:string;
procedure CalcularTamanoPosVnc();
procedure observar();
protected
procedure Execute; override;
public
constructor Create(arcontra:string;numequi,minumero:integer;comando:string;tipoven,modobs:integer;usuario,host,Administrador:string);
end;

implementation
constructor ThrVer.Create(arcontra:string;numequi,minumero:integer;comando:string;tipoven,modobs:integer;usuario,host,Administrador:string);
begin
inherited Create(true);
farcontra:=arcontra;
fpuertovnc:=PUERTO_VNC;
fnumeroequipos:=numequi;
fminumero:=minumero;
fmodobs:=modobs;
ftipoven:=tipoven;
fusuario:=usuario;
fAdministrador:=Administrador;
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);
orden:=Format(orden,[farcontra,inttostr(miw),inttostr(mih),inttostr(mil),inttostr(mit),fhost,fpuertovnc,fusuario]);
fpsystem(orden);
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.
(25-25/57)