Proyecto

General

Perfil

Descargar (8,09 KB) Estadísticas
| Rama: | Revisión:
{
Aulalinex 3.0-7 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 clcsusuarionuevos;

{$mode objfpc}{$H+}

interface

uses
Classes, SysUtils, IdTCPClient,globales,globales1;

type
ThrEjecutarComandosNuevos = class(TThread)
private
{ Private declarations }
fdestino:integer;
forden:integer;
fordenEjecutar:String;
fcliente:TIdTCPClient;
fContador:integer;
festado:Boolean;
fEquipos:Array of Tequipo;
procedure refrescarDatosAlumno;
protected
procedure Execute; override;
public
constructor Create(destino:integer;orden integer,mequipos:Array of Tequipo;estado:Boolean);
end;

implementation

uses inicio;
constructor ThrEjecutarComandosNuevos.Create(destino:integer;orden integer; mequipos:Array of Tequipo;estado:Boolean);
begin
inherited Create(true);
fEquipos:=mequipos;
forden:=orden;
fdestino:=destino;
FreeOnTerminate:=True;
festado:=estado;
end;
procedure ThrEjecutarComandosNuevos.hallaOrden(morden:integer);
begin
case numpant of
0://eEncender:
begin
if mestado then
begin
encender();
end
else
begin
encenderNo();
end;
end;
1://eVer:
begin
if mestado then
begin
ver();
end
else
begin
verNo();
end;
end;
2://eMostrar:
begin
if mestado then
begin
mostrar();
end
else
begin
mostrarNo();
end;
end;
3://eMensaje:
begin
if mestado then
begin
mensaje();
end
else
begin
mensajeNo();
end;
end;
4://eArchivo:
begin
if mestado then
begin
archivo();
end
else
begin
//archivoNo();
end;
end;
5://eRecibir:
begin
if mestado then
begin
recibir();
end
else
begin
recibirNo();
end;
end;
6://eLanzar:
begin
if mestado then
begin
lanzar();
end
else
begin
lanzarNo();
end;
end;
7://eNavegar:
begin
if mestado then
begin
navegar();
end
else
begin
navegarNo();
end;
end;
8://eDevolver:
begin
if mestado then
begin
devolver();
end
else
begin
//devolverNo();
end;
end;
9://eCarpeta:
begin
if mestado then
begin
carpeta();
end
else
begin
carpetaNo();
end;
end;
10://eVideo:
begin
if mestado then
begin
video();
end
else
begin
videoNo();
end;
end;
11://ePresentar:
begin
if fMonitorPulsado[numpant]=false then
begin
// presentar(parametros);
end
else
begin
// presentarNo();
end;
end;
12://eInternet:
begin
if mestado then
begin
internetNo();
end
else
begin
internet();
end;
end;
13://bloquear teclado y ratón:
begin
if mestado then
Bloquear()
else
BloquearNo();
end;
14://raton:
begin
if mestado then
raton()
else
ratonNo();
end;
end;
end;
procedure ThrEjecutarComandosNuevos.Execute;
var j,i:integer;
ipequipo:string;
begin

SetLength(fDatosEquipos,fIPFin-fIPInicio+1);
j:=0;
try
// writeln('mi ip ' + fMiIP);
fcliente:=TIdTCPClient.create(nil);
fcliente.ConnectTimeout:=200;
fcliente.port:=37000;
for i:=fIPInicio to fIPFin do
begin
ipequipo:= fPrefijo + IntToStr(i);
if ipequipo=fMiIP then continue;
//writeln(ipequipo);
fcliente.Host:=ipequipo;
try
fcliente.connect;
fcliente.GetResponse(200);
fcliente.SendCmd('datosEquipo',317);
fDatosEquipos[j]:= trim(fcliente.LastCmdResult.text.text);
//fDatosEquipos[j]:= ipequipo;
inc(j);
fcliente.Disconnect;
except
//fcliente.Disconnect;
end;
end;

finally
SetLength(fDatosEquipos,j);
fcliente.free;
synchronize(@refrescarDatosAlumno)
end;
end;

procedure ThrEjecutarComandosNuevos.refrescarDatosAlumno;
begin
try
//frmMain.RefrescarDatosAula(fDatosEquipos);
except
writeln('Error al hallar equipos aula');
end;
end;
end.

(12-12/57)