<?php
//namespace Khanamiryan\QrCodeTests;

//use PHPUnit\Framework\TestCase;
use Zxing\QrReader;

include_once('c_page.php') ;
class c_page_test extends c_page
{
    var $no_view_in_setting_right=1 ;
    var $free_access=1 ;

    function check_access()  { return(1) ; }

    function block_main()
    {



	    $terminal_rec=ESMO()->get_terminal_by_id($_GET['terminal_id']) ;
	    if ($terminal_rec['pkey'])
	    { $result=DEVICE()->send_terminal_command($terminal_rec['pkey'],'check_status',array('debug'=>1,'no_check_cur_status'=>1)) ;
		damp_array($result,1,-1);
	    }
	    else echo 'терминал с ID '.$_GET['terminal_id'].' не найден' ;


return ;


//execSQL_update('truncate table obj_site_group_risk') ;

        //ACCOUNTS()->update_workgroups_viewers() ;

        //
        require _DIR_TO_ROOT . "/vendor/autoload.php";
        //$qrcode = new QrReader(_PATH_TO_SITE.'/docs/scan/2020_12/scan_879.jpg');
        //$text = $qrcode->text(); //return decoded text from QR Code
        //echo 'text='.$text ;

        $QRCodeReader = new Libern\QRCodeReader\QRCodeReader();
        //$qrcode_text = $QRCodeReader->decode(_PATH_TO_SITE.'/docs/scan/2020_12/scan_879.jpg');
        $qrcode_text = $QRCodeReader->decode('data:image/jpg;'.base64_encode(file_get_contents(_DIR_TO_ROOT.'/docs/scan/2020_12/scan_879.jpg')));
        echo $qrcode_text;
        ?><img src="<?echo _PATH_TO_SITE.'/docs/scan/2020_12/scan_879.jpg'?>"> <?

        return ;


    }


};
?>
