From 1d4b030f0b8c841eb5e897ead526879d1ce87b2c Mon Sep 17 00:00:00 2001 From: dg9vh Date: Mon, 2 May 2016 17:36:19 +0200 Subject: [PATCH] first try of repeater info --- include/functions.php | 38 ++++++++++++++++++++++++++++++++------ include/repeaterinfo.php | 10 +++++----- index.php | 2 -- 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/include/functions.php b/include/functions.php index 034b045..47fb468 100644 --- a/include/functions.php +++ b/include/functions.php @@ -80,24 +80,50 @@ function getActualMode($logLines) { function getActualLink($logLines, $mode) { //M: 2016-05-02 07:04:10.504 D-Star link status set to "Verlinkt zu DCS002 S" +//M: 2016-04-03 16:16:18.638 DMR Slot 2, received network voice header from 4000 to 2625094 +//M: 2016-04-03 19:30:03.099 DMR Slot 2, received network voice header from 4020 to 2625094 array_multisort($logLines,SORT_DESC); switch ($mode) { case "D-Star": foreach ($logLines as $logLine) { if (strpos($logLine, "D-Star link status set to")) { return substr($logLine, 54, strlen($logLine) - 56); - } + } } + return "not linked"; break; case "DMR Slot 1": - return "still to be implemented"; + foreach ($logLines as $logLine) { + if(substr($logLine, 27, strpos($logLine,",") - 27) == "DMR Slot 1") { + $from = substr($logLine, strpos($logLine,"from") + 5, strpos($logLine,"to") - strpos($logLine,"from") - 6); + if (strlen($from) == 4 && startsWith($from,"4")) { + if ($from == "4000") { + return "not linked"; + } else { + return $from; + } + } + } + } + return "not linked"; break; case "DMR Slot 2": - return "still to be implemented"; + foreach ($logLines as $logLine) { + if(substr($logLine, 27, strpos($logLine,",") - 27) == "DMR Slot 2") { + $from = substr($logLine, strpos($logLine,"from") + 5, strpos($logLine,"to") - strpos($logLine,"from") - 6); + if (strlen($from) == 4 && startsWith($from,"4")) { + if ($from == "4000") { + return "not linked"; + } else { + return $from; + } + } + } + } + return "not linked"; break; -} - - return "still to be implemented"; + } + return "something went wrong!"; } //Some basic inits diff --git a/include/repeaterinfo.php b/include/repeaterinfo.php index 9f7271a..5922d72 100644 --- a/include/repeaterinfo.php +++ b/include/repeaterinfo.php @@ -1,17 +1,17 @@
Repeater Info
- +
+

Some Infos about link-states

+
- - + + "; diff --git a/index.php b/index.php index 0c061fe..0c260a2 100644 --- a/index.php +++ b/index.php @@ -12,10 +12,8 @@ include "include/functions.php"; - - MMDVM-Dashboard by DG9VH
Actual Mode D-Star linked toDMR TS1DMR TS2DMR TS1 linked toDMR TS2 linked to