Если я этот же метод вызываю из меню то он отробатывает до конца, но заметно что меню как бы "подвисает" (ждет завершения "метода").
Если задержки таймера в "методе" не большие то отробатывает, но если секунд 20 то все - метод потерян.
вот код "метода":
Код: Выделить всё
function timeOutResidue($title) {
$timerId = timeOutExists($title);
if ($timerId) {
$timer_job=SQLSelectOne("SELECT UNIX_TIMESTAMP(RUNTIME) as TM FROM jobs WHERE ID='".$timerId."'");
$diff=(int)$timer_job['TM']-time(); // получаем время в секундах, оставшееся до запланированного срабатывания таймера
return $diff;
} else {
return 0;
}
}
callMethod('RemoteTCL6'.'.'.'turn_On_Off');//включение bbk uno
setTimeOut('TimerRC', 'say(\'Айпитиви на кухне включено. Приятного просмотра\', 1);', 45);//запуск таймера
$step = 0;
while(timeOutResidue(TimerRC) != 0){
if(timeOutResidue(TimerRC) == 44 && $step == 0){
callMethod('RemoteTCL5.turn_On_Off');//включение ТВ приставки.
$step++;
}
if(timeOutResidue(TimerRC) == 20 && $step == 1){
callMethod('RemoteTCL5.Source');
$step++;
}
if(timeOutResidue(TimerRC) == 19 && $step == 2){
callMethod('RemoteTCL5.Right');
$step++;
}
if(timeOutResidue(TimerRC) == 18 && $step == 3){
callMethod('RemoteTCL5.Right');
$step++;
}
if(timeOutResidue(TimerRC) == 17 && $step == 4){
callMethod('RemoteTCL5.Right');
$step++;
}
if(timeOutResidue(TimerRC) == 16 && $step == 5){
callMethod('RemoteTCL5.Right');
$step++;
}
if(timeOutResidue(TimerRC) == 15 && $step == 6){
callMethod('RemoteTCL5.Right');
$step++;
}
if(timeOutResidue(TimerRC) == 14 && $step == 7){
callMethod('RemoteTCL5.Right');
$step++;
}
if(timeOutResidue(TimerRC) == 13 && $step == 8){
callMethod('RemoteTCL5.OK');
$step++;
}
if(timeOutResidue(TimerRC) == 12 && $step == 9){
callMethod('RemoteTCL5.Down');
$step++;
}
if(timeOutResidue(TimerRC) == 11 && $step == 10){
callMethod('RemoteTCL5.Down');
$step++;
}
if(timeOutResidue(TimerRC) == 10 && $step == 11){
callMethod('RemoteTCL5.Down');
$step++;
}
if(timeOutResidue(TimerRC) == 9 && $step == 12){
callMethod('RemoteTCL5.OK');
$step++;
}
if(timeOutResidue(TimerRC) == 8 && $step == 13){
callMethod('RemoteTCL5.OK');
$step++;
}
if(timeOutResidue(TimerRC) == 6 && $step == 14){
callMethod('RemoteTCL5.Up');
$step++;
}
if(timeOutResidue(TimerRC) == 5 && $step == 15){
callMethod('RemoteTCL5.OK');
$step++;
}
if(timeOutResidue(TimerRC) == 4 && $step == 16){
callMethod('RemoteTCL5.Down');
$step++;
}
if(timeOutResidue(TimerRC) == 3 && $step == 17){
callMethod('RemoteTCL5.OK');
$step++;
}
if(timeOutResidue(TimerRC) == 2 && $step == 18){
callMethod('RemoteTCL5.Down');
$step++;
}
if(timeOutResidue(TimerRC) == 1 && $step == 19){
callMethod('RemoteTCL5.Right');
$step++;
}
if(timeOutResidue(TimerRC) == 0 && $step == 20){
callMethod('RemoteTCL5.OK');
$step++;
}
}
Пробовал по разному и использовать sleep(20) и создать несколько раздельных таймеров в "методе", но везде такой баг, остановился на самом суровом варианте с использованием цикла while , но даже это не помогло - работает полностью только если из меню вызвать.