diff --git a/www/index.php b/www/index.php
index b962b07..792ba95 100644
--- a/www/index.php
+++ b/www/index.php
@@ -38,8 +38,8 @@ $db_link = mysqli_connect ($dbhost, $dbuser, $dbpassword, $database);
echo "
". $time . " | ";
echo "". parse("service",$fms_id) . " | ";
echo "". parse("country",$fms_id) . " | ";
- echo "". $data['location'] . " | ";
- echo "". $data['vehicle'] . " | ";
+ echo "". parse("location",$fms_id) . " | ";
+ echo "". parse("vehicle",$fms_id) . " | ";
echo "". $data['status'] . " | ";
echo "". parse("direction",$fms_id) . " | ";
echo "". $data['tsi'] . " | ";
@@ -65,7 +65,7 @@ $db_link = mysqli_connect ($dbhost, $dbuser, $dbpassword, $database);
echo "";
echo "| ". $data['id'] . " | ";
echo "". $time . " | ";
- echo "". $data['zvei'] . " | ";
+ echo "". parse('zvei',$data['zvei']) . " | ";
echo "
";
}
echo "";
diff --git a/www/parser.php b/www/parser.php
index e1242ad..5a8bb00 100644
--- a/www/parser.php
+++ b/www/parser.php
@@ -1,8 +1,7 @@
"Fernwirktelegramm",
);
- //Data for Country Parsing
+ //Data for Country Parsing
$country = array(
"0" => "Sachsen",
"1" => "Bund",
@@ -43,21 +42,89 @@
"e" => "Meck-Pom/Sachsen-Anhalt",
"f" => "Brandenburg/Thüringen",
);
+
+ //Data for Location Parsing
+ $location = array(
+ "11" => "testLoc",
+ "22" => "testLoc",
+ "33" => "testLoc"
+ );
+
+ //Data for Vehicle Parsing
+ $vehicle = array(
+ "1111" => "testVeh",
+ "2222" => "testVeh",
+ "3333" => "testVeh"
+ );
+
+
+ //Data for ZVEI Parsing
+ $country = array(
+ "12345" => "testZvei",
+ "23456" => "testZvei",
+ "34567" => "testZvei",
+ );
+
switch ($mode) {
+ #Parse Service
case "service":
- return $service[substr($fms,0,1)];
+ if (array_key_exists($data, $service)) {
+ return $service[substr($data,0,1)];
+ }else
+ {
+ return $data;
+ }
break;
-
+
+ #Parse Country
case "country":
- return $country[substr($fms,1,1)];
+ if (array_key_exists($data, $country)) {
+ return $country[substr($data,1,1)];
+ }else
+ {
+ return $data;
+ }
break;
+ #Parse Location
+ case "location":
+ if (array_key_exists($data, $location)) {
+ return $location[substr($data,2,2)];
+ }else
+ {
+ return $data;
+ }
+ break;
+
+ #Parse Vehicle
+ case "vehicle":
+ if (array_key_exists($data, $vehicle)) {
+ return $vehicle[substr($data,4,4)];
+ }else
+ {
+ return $data;
+ }
+ break;
+
+ #Parse direction
case "direction":
if(substr($fms,9,1) == 1){
return "L->F";
}elseif(substr($fms,9,1) == 0){
return "F->L";
+ }else
+ return "ERR!";
+ }
+ break;
+
+ #Parse Zvei
+ case "zvei":
+ if (array_key_exists($data, $zvei)) {
+ return $data ." - ". $zvei[$data];
+ }else
+ {
+ return $data;
}
break;