X-Git-Url: https://git.cweiske.de/linksys-wrt3g-tools.git/blobdiff_plain/23973c64318d4211a7d09a83a85fc2c662027779..6a5bf4c36f788ac0eb8112ccec0bbd371d5bbd94:/Wrt3g/HtmlParser.php diff --git a/Wrt3g/HtmlParser.php b/Wrt3g/HtmlParser.php index d420f4d..bd613ac 100644 --- a/Wrt3g/HtmlParser.php +++ b/Wrt3g/HtmlParser.php @@ -19,8 +19,11 @@ class Wrt3g_HtmlParser 'GPRS_MSG.ACQUIRING' => 'aquiring', 'GPRS_MSG.WWBEAR_GPRS' => 'GPRS', 'GPRS_MSG.WWBEAR_UMTS' => 'UMTS', + 'GPRS_MSG.None' => null, + 'GPRS_MSG.FAIR' => 'fair', 'GPRS_MSG.GOOD' => 'good', 'GPRS_MSG.EXCELLENT' => 'excellent', + 'GPRS_MSG.NOSIGNAL' => 'no signal', 'GPRS_MSG.CTIME' => 'connection time', 'GPRS_MSG.CFW' => 'card firmware', 'GPRS_MSG.CMOD' => 'card model', @@ -135,8 +138,6 @@ class Wrt3g_HtmlParser * - card revision * - card firmware * - IMSI - * - * @todo FIXME implement "connection" value as index_wstatus2() does it */ public function status_noauth($body) { @@ -150,7 +151,8 @@ class Wrt3g_HtmlParser $doc->loadHtml($body); $xpath = new DOMXPath($doc); $trs = $xpath->query('//table//table/tbody/tr'); - $arRaw = array(); + $arRaw = array('connection' => null); + $bAquiring = false; foreach ($trs as $tr) { $titleItems = $xpath->query('td[@width=125]/text()', $tr); $valueItems = $xpath->query('td[@width=296]/*[1]', $tr); @@ -165,10 +167,22 @@ class Wrt3g_HtmlParser $value = trim(strip_tags($value)); if (substr($value, 0, 8) == 'Capture(') { $value = self::$arTranslations[substr($value, 8, -1)]; + if ($value == 'aquiring') { + $bAquiring = true; + $value = null; + } } } unset($value); + if ($bAquiring) { + $arRaw['connection'] = 'connecting'; + } else if ($arRaw['type'] != null) { + $arRaw['connection'] = 'connected'; + } else { + $arRaw['connection'] = 'disconnected'; + } + if (isset($arRaw['connection time'])) { $arRaw['connection time'] = str_replace( array( @@ -188,10 +202,16 @@ class Wrt3g_HtmlParser 'TX = ', str_replace('RX = ', '', $arRaw['session usage']) ); - $arRaw['session usage'] = array( - 'received' => $arS[0], - 'sent' => $arS[1] - ); + if (count($arS) > 1) { + $arRaw['session usage'] = array( + 'received' => $arS[0], + 'sent' => $arS[1] + ); + } + } + + if (preg_match('/Capture\\(share.firmwarever\\):(.+?)