cvs: pear /Net_Wifi/Net Wifi.php /Net_Wifi/tests Wifi_testcase.php
| From: | Christian Weiske | Date: | Fri, 27 Oct 2006 21:16:14 +0000 |
| Subject: | cvs: pear /Net_Wifi/Net Wifi.php /Net_Wifi/tests Wifi_testcase.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-42837@lists.php.net to get a copy of this message | ||
cweiske Fri Oct 27 21:16:14 2006 UTC
Modified files:
/pear/Net_Wifi/Net Wifi.php
/pear/Net_Wifi/tests Wifi_testcase.php
Log:
Adapting Net_Wifi parser to slightly changed output format in iwconfig
http://cvs.php.net/viewvc.cgi/pear/Net_Wifi/Net/Wifi.php?r1=1.3&r2=1.4&diff_format=u
Index: pear/Net_Wifi/Net/Wifi.php
diff -u pear/Net_Wifi/Net/Wifi.php:1.3 pear/Net_Wifi/Net/Wifi.php:1.4
--- pear/Net_Wifi/Net/Wifi.php:1.3 Fri Oct 27 21:06:29 2006
+++ pear/Net_Wifi/Net/Wifi.php Fri Oct 27 21:16:14 2006
@@ -16,7 +16,7 @@
* @category Net
* @package Net
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
-* @version CVS: $Id: Wifi.php,v 1.3 2006/10/27 21:06:29 cweiske Exp $
+* @version CVS: $Id: Wifi.php,v 1.4 2006/10/27 21:16:14 cweiske Exp $
*/
require_once 'Net/Wifi/Cell.php';
@@ -112,7 +112,7 @@
} else if (strpos($strAll, 'Mode:Ad-Hoc')) {
$objConfig->mode = 'ad-hoc';
}
- if (preg_match('/Bit Rate=([0-9.]+) [mk]b\\/s/i', $strAll, $arMatches)) {
+ if (preg_match('/Bit Rate[:=]([0-9.]+) [mk]b\\/s/i', $strAll, $arMatches)) {
$objConfig->rate = $arMatches[1];
}
if (preg_match('/Power=([0-9]+) dBm/', $strAll, $arMatches)) {
http://cvs.php.net/viewvc.cgi/pear/Net_Wifi/tests/Wifi_testcase.php?r1=1.2&r2=1.3&diff_format=u
Index: pear/Net_Wifi/tests/Wifi_testcase.php
diff -u pear/Net_Wifi/tests/Wifi_testcase.php:1.2 pear/Net_Wifi/tests/Wifi_testcase.php:1.3
--- pear/Net_Wifi/tests/Wifi_testcase.php:1.2 Fri Oct 27 21:09:31 2006
+++ pear/Net_Wifi/tests/Wifi_testcase.php Fri Oct 27 21:16:14 2006
@@ -82,6 +82,29 @@
$this->assertEquals( 'IEEE 802.11g' ,
$objConfig->protocol);
$this->assertEquals( -28 , $objConfig->rssi);
+ //format changed a bit
+ $strConfig = <<<EOD
+eth1 IEEE 802.11g ESSID:"wlan.informatik.uni-leipzig.de"
+ Mode:Managed Frequency:2.412 GHz Access Point: 00:07:40:A0:75:E2
+ Bit Rate:54 Mb/s Tx-Power=20 dBm Sensitivity=8/0
+ Retry limit:7 RTS thr:off Fragment thr:off
+ Power Management:off
+ Link Quality=93/100 Signal level=-35 dBm Noise level=-89 dBm
+ Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
+ Tx excessive retries:0 Invalid misc:0 Missed beacon:0
+EOD;
+ $objConfig = $this->wls->parseCurrentConfig($strConfig);
+
+ $this->assertTrue ( $objConfig->associated);
+ $this->assertTrue ( $objConfig->activated);
+ $this->assertEquals( '00:07:40:A0:75:E2' , $objConfig->ap);
+ $this->assertEquals( 'wlan.informatik.uni-leipzig.de' ,
$objConfig->ssid);
+ $this->assertEquals( 'managed' ,
$objConfig->mode);
+ $this->assertEquals( null , $objConfig->nick);
+ $this->assertEquals( 54 , $objConfig->rate);
+ $this->assertEquals( 20 , $objConfig->power);
+ $this->assertEquals( 'IEEE 802.11g' ,
$objConfig->protocol);
+ $this->assertEquals( -35 , $objConfig->rssi);
//radio off = deactivated interface
$strConfig =