Fonction : Startup
Auteur : YS - 12/11/2003
Modifie : YS - 20/07/2007 : Sequence de demarrage pour Multi-process
Description : Fonction de demarrage d'application
Appele par : Citect au startup
___________________________________________________________________________*/
FUNCTION Startup()
INT hQueAS;
INT hQueRM;
INT hQueDD;
INT hQueMC;
INT hQueBASE;
INT hQueYS;
INT hQueAV;
INT hTaskAS;
INT hTaskRM;
INT hTaskDD;
INT hTaskMC;
INT hTaskBASE;
INT hTaskYS;
INT hTaskAV;
INT iStart;
STRING sStart;
INT hWnd;
ApplicationEnRun=0;
TaskNew("blink","",4+8); //lance la fonction pour clignotement d'un bit
TagWrite("MessPatientez","@(Patientez)");
Sleep(1);
AppSimulation= StrToInt( ParameterGet("SIDEL","Simulation",0)); // Forcage pour application de simulation
// On attend d'etre on-line avant de lancer les fonctions STARTUP.
IF AppSimulation=0 THEN
WHILE StrToInt(IODeviceInfo(8,3))1 DO //"ALARME"
Sleep(1);
END
WHILE StrToInt(IODeviceInfo(9,3))1 DO //"BOOLEEN"
Sleep(1);
END
WHILE StrToInt(IODeviceInfo(10,3))1 DO //"ENTIER"
Sleep(1);
END
WHILE StrToInt(IODeviceInfo(11,3))1 DO //"REEL"
Sleep(1);
END
WHILE StrToInt(IODeviceInfo(12,3))1 DO //"COURBE"
Sleep(1);
END
WHILE StrToInt(IODeviceInfo(13,3))1 DO //"LIAISON1"
Sleep(1);
END
WHILE StrToInt(IODeviceInfo(14,3))1 DO //"LIAISON2"
Sleep(1);
END
WHILE StrToInt(IODeviceInfo(15,3))1 DO //"OPC"
Sleep(1);
END
END
MaxWindows = StrToInt( ParameterGet("PAGE","Windows",16));
TaskNew("AttenteStartUp","",0+4);
hQueAS=QueOpen("AS_Start",2);
hQueRM=QueOpen("RM_Start",2);
hQueDD=QueOpen("DD_Start",2);
hQueMC=QueOpen("MC_Start",2);
hQueBASE=QueOpen("BASE_Start",2);
hQueYS=QueOpen("YS_Start",2);
hTaskAS=TaskNew("Startup_AS","",0+4);
hTaskRM=TaskNew("Startup_RM","",0+4);
hTaskDD=TaskNew("Startup_DD","",0+4);
hTaskMC=TaskNew("Startup_MC","",0+4);
hTaskBASE=TaskNew("Startup_BASE","",0+4);
hTaskYS=TaskNew("Startup_YS","",0+4);
IF AppSimulation=1 Then
hQueAV=QueOpen("AV_Start",2);
hTaskAV=TaskNew("Startup_AV","",0+4);
End
QueRead(hQueAS,iStart,sStart,1);
QueClose(hQueAS);
Sleep(0);
QueRead(hQueRM,iStart,sStart,1);
QueClose(hQueRM);
Sleep(0);
QueRead(hQueDD,iStart,sStart,1);
QueClose(hQueDD);
Sleep(0);
QueRead(hQueMC,iStart,sStart,1);
QueClose(hQueMC);
Sleep(0);
QueRead(hQueBASE,iStart,sStart,1);
QueClose(hQueBASE);
Sleep(0);
QueRead(hQueYS,iStart,sStart,1);
QueClose(hQueYS);
Sleep(0);
IF AppSimulation=1 Then
QueRead(hQueAV,iStart,sStart,1);
QueClose(hQueAV);
End
Beep(3);
PageDisplay("BANDEAU");
SleepMS(500);
hWnd=WndFind("Citect"); // La fenêtre Citect est ouverte ?
If hWnd>0 then
SendKeys("Citect","%{f4}"); //On ferme cette fenêtre.
End
EspionInfo("@(Demarrage de l'application)");
ApplicationEnRun=1;
END
/*___________________________________________________________________________
Fonction : AttenteStartUp
Auteur : YS - 13/11/2003
Modifie :
Description :
Appele par :
___________________________________________________________________________*/
FUNCTION AttenteStartUp()
INT Cpt=0;
WHILE ((TaskHnd("Startup")-1) AND (Cpt=TimeOut THEN
QueWrite(QueOpen("AS_Start",0),1,"A");
QueWrite(QueOpen("RM_Start",0),1,"A");
QueWrite(QueOpen("DD_Start",0),1,"A");
QueWrite(QueOpen("MC_Start",0),1,"A");
QueWrite(QueOpen("BASE_Start",0),1,"A");
QueWrite(QueOpen("YS_Start",0),1,"A");
QueWrite(QueOpen("AV_Start",0),1,"A");
END
END