Howto:DECT Graphical Real Time Display: Difference between revisions

From innovaphone wiki
Jump to navigation Jump to search
Line 251: Line 251:


== Related Articles ==
= Related Articles =


<!--*[[Main_Page|wiki-innovaphone]]-->
<!--*[[Main_Page|wiki-innovaphone]]-->


[[Category:Sample|{{PAGENAME}}]]
[[Category:Sample|{{PAGENAME}}]]

Revision as of 15:58, 1 March 2011

Applies To

This information applies to

  • IP1200

Build 70300.35 and earlier.


Summary

In multicell network, it's usefull to have a map of all the cells in a single view with all the sync link state in real time display.

SummaryDECTGRTD.jpg

System Requirements

For that you will need an apache server with PHP 5 at least.

You will have to activate the following extensions :

php_http, php_gd2

You must have an access to the cells from the apache server.


You must have a map of your building in jpg format with the name myDECTcoverage.jpg, and you will need a txt file with a description of each cells point with the name myDECTcoverage.txt.

Configuration

PHP scripts

You will need four php script to get this map. Put these following scripts on the same directory.

The first one, named index.php, is to be called by the browser with the site ID in http GET format : for example : http://mysite/index.php?site=myDECTcoverage <?php echo '<HTML><HEAD>'; echo '<META HTTP-EQUIV="refresh" content="5"; url="index.php">'; echo '</HEAD><BODY>'; echo "<img src='draw.php?site=".$_GET['site']."'/>"; echo '</BODY></html>'; ?>

The second one, named draw.php, provide the jpg with the map and each cells point drawn on and the link state.

<?php

include 'getsync.php'; include 'getlevel.php'; header("Content-type: image/jpg");

function drawBorne($img,$nom,$x,$y) { // Choix de la couleur de l'ellipse $col_ellipse = imagecolorallocate($img, 30, 30, 255); // On dessine l'ellipse imagefilledellipse($img, $x, $y, 20, 20, $col_ellipse); imagestring($img,3,($x+8),($y+8),$nom,$col_ellipse); }

function drawRepeater($img,$nom,$x,$y) { // Choix de la couleur de l'ellipse $col_ellipse = imagecolorallocate($img, 200, 0, 0); // On dessine l'ellipse imagefilledellipse($img, $x, $y, 15, 15, $col_ellipse); imagestring($img,3,($x+6),($y+6),$nom,$col_ellipse); }

function drawFlecheRepeater($img,$x1,$y1,$x2,$y2,$col) { // Choix de la couleur de la fleche //$col_fleche = imagecolorallocate($img, 0, 0, 0); imagesetthickness($img, 2); imageline($img, $x1, $y1, $x2, $y2, $col); }

function drawFlechePrimBorne($img,$x1,$y1,$x2,$y2,$col) { // Choix de la couleur de la fleche //$col_fleche = imagecolorallocate($img, 0, 255, 0); imagesetthickness($img, 3); imageline($img, $x1, $y1, $x2, $y2, $col); }

function drawFlecheAltBorne($img,$x1,$y1,$x2,$y2,$col) { // Choix de la couleur de la fleche //$col_fleche = imagecolorallocate($img, 255, 0, 0); imagesetthickness($img, 4); $style = Array(

               $col,
               $col,
               $col,
               $col,
               $col,
               $col,
               $col,
               $col,
               $col,
               $col,
               $col,
               $col,
               $col,
               $col,
               $col,
               $col,
               IMG_COLOR_TRANSPARENT,
               IMG_COLOR_TRANSPARENT,
               IMG_COLOR_TRANSPARENT,
               IMG_COLOR_TRANSPARENT,
               IMG_COLOR_TRANSPARENT,
               IMG_COLOR_TRANSPARENT,
               IMG_COLOR_TRANSPARENT,
               IMG_COLOR_TRANSPARENT
               );

imagesetstyle($img, $style); imageline($img, $x1, $y1, $x2, $y2, IMG_COLOR_STYLED); }

// pour définir les différentes couleurs d'alarme sur les synchro function definecolor($level,$img,$f) { if ($level=="") $col = imagecolorallocate($img, 0, 0, 0); else { if (($level)<=27) $col = imagecolorallocate($img, 255, 0, 0); if (($level>27)And($level<=30)) $col = imagecolorallocate($img, 255, 153, 51); if (($level>30)And($level<35)) $col = imagecolorallocate($img, 200, 255, 50); if (($level)>=35) $col = imagecolorallocate($img, 0, 153, 0); } //$f=fopen ('debug.txt','a+'); fwrite ($f,'Level'.$level."\r\n"); //fclose ($f); return ($col); }

//création de l'image $im=imagecreatefromjpeg($_GET['site'].".jpg"); $cartouche=imagecreatefromjpeg("cartouche.jpg"); imagecopymerge($im,$cartouche,0,0,0,0,300,100,100); //initialisation du tableau qui recevra la lecture du fichier de conf 00000_000.txt $valeur=array(); // lecture des ID présent et des positions $filename=$_GET['site'].".txt"; $file=fopen($filename,'r');

while (!feof($file)) { list($nom,$x,$y,$id,$ip,$port,)= explode(";",fgets($file, 8192)); $valeur[$id]=array($nom,$x,$y,$id,$ip,$port); } fclose ($file);

// pour debug $f=fopen ('debug.txt','w+');

// on récupères les levels de toutes les bornes dans un tableau de tableau $level=array(); foreach ($valeur as $val) { if ($val[4]!="") $level=getlevel($level,$val[3],$val[4],$val[5]); if ($val[3]==1) $sync=getsync(strval($val[4]),intval($val[5])); } unset($val);

//Pour toute les valeurs du fichier de conf : on récupère et trace les synchro borne et répéteur foreach ($valeur as $val) { if ($val[4]=="") { if ($val[3]>8) $borne=$val[3]-(64*(int)($val[3]/64)); else $borne=1; foreach ($level as $testlevel) { $levelprim=""; if ($testlevel[0]==$borne && $testlevel[1]==$val[3]) { $levelprim=$testlevel[2]; break 1; } } unset ($testlevel); drawFlecheRepeater($im,$val[1],$val[2],$valeur[strval($borne)][1],$valeur[strval($borne)][2],definecolor($levelprim,$im,$f)); } else { foreach ($sync as $b) { if ($val[3]==$b[0]) { foreach ($level as $testlevel) { $levelprim=""; if ($testlevel[0]==$val[3] And $testlevel[1]==$b[1]) { $levelprim=$testlevel[2]; break 1; } } unset ($testlevel); foreach ($level as $testlevel) { $levelalt=""; if ($testlevel[0]==$val[3] And $testlevel[1]==$b[2]) { $levelalt=$testlevel[2]; break 1; } } fwrite ($f,"B=".$b[0]." pri=".$b[1]." alt=".$b[2]." levelprim=".$levelprim." levelalt=".$levelalt."\r\n"); if ($b[1]<>$b[2]) { drawFlechePrimBorne($im,$valeur[$b[0]][1],$valeur[$b[0]][2],$valeur[$b[1]][1],$valeur[$b[1]][2],definecolor($levelprim,$im,$f)); drawFlecheAltBorne($im,$valeur[$b[0]][1],$valeur[$b[0]][2],$valeur[$b[2]][1],$valeur[$b[2]][2],definecolor($levelalt,$im,$f)); } else { if ((abs(intval($valeur[$b[1]][1])-intval($valeur[$b[0]][1])))<(abs((intval($valeur[$b[1]][2]))-intval($valeur[$b[0]][2])))) { drawFlechePrimBorne($im,$valeur[$b[0]][1]+2,$valeur[$b[0]][2],$valeur[$b[1]][1]+2,$valeur[$b[1]][2],definecolor($levelprim,$im,$f)); drawFlecheAltBorne($im,$valeur[$b[0]][1]-2,$valeur[$b[0]][2],$valeur[$b[2]][1]-2,$valeur[$b[2]][2],definecolor($levelalt,$im,$f)); } else { drawFlechePrimBorne($im,$valeur[$b[0]][1],$valeur[$b[0]][2]+2,$valeur[$b[1]][1],$valeur[$b[1]][2]+2,definecolor($levelprim,$im,$f)); drawFlecheAltBorne($im,$valeur[$b[0]][1],$valeur[$b[0]][2]-2,$valeur[$b[2]][1],$valeur[$b[2]][2]-2,definecolor($levelalt,$im,$f)); } } } } } } unset ($val);

//fclose ($f); foreach ($valeur as $val) { if ($val[0][0]=="B"||$val[0][0]=="b") drawBorne($im,$val[0],$val[1],$val[2]); if ($val[0][0]=="R"||$val[0][0]=="r") drawRepeater($im,$val[0],$val[1],$val[2]); } imagejpeg($im); imagedestroy($im); imagedestroy ($cartouche); ?>

Known Problems

Related Articles