cvs: pear /Net_Wifi package.xml /Net_Wifi/Net Wifi.php /Net_Wifi/Net/Wifi Cell.php Config.php
| From: | Christian Weiske | Date: | Fri, 27 Oct 2006 21:01:48 +0000 |
| Subject: | cvs: pear /Net_Wifi package.xml /Net_Wifi/Net Wifi.php /Net_Wifi/Net/Wifi Cell.php Config.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-42836@lists.php.net to get a copy of this message | ||
cweiske Fri Oct 27 21:01:48 2006 UTC
Added files:
/pear/Net_Wifi/Net/Wifi Cell.php Config.php
Modified files:
/pear/Net_Wifi package.xml
/pear/Net_Wifi/Net Wifi.php
Log:
- Moving Net_Wifi_Config and _Cell into own files
as it's default in PEAR
- Cosmetic changes; removed spaces in empty lines
http://cvs.php.net/viewvc.cgi/pear/Net_Wifi/package.xml?r1=1.2&r2=1.3&diff_format=u Index: pear/Net_Wifi/package.xml diff -u pear/Net_Wifi/package.xml:1.2 pear/Net_Wifi/package.xml:1.3 --- pear/Net_Wifi/package.xml:1.2 Fri Oct 27 20:54:13 2006 +++ pear/Net_Wifi/package.xml Fri Oct 27 21:01:47 2006 @@ -43,7 +43,11 @@ <contents> <dir name="/"> <dir name="Net"> - <file name="Wifi.php" role="php" /> + <file name="Wifi.php" role="php" /> + <dir name="Wifi"> + <file name="Cell.php" role="php" /> + <file name="Config.php" role="php" /> + </dir> </dir> <dir name="examples"> <file baseinstalldir="Net" name="Wifi_usage.php" role="doc" /> http://cvs.php.net/viewvc.cgi/pear/Net_Wifi/Net/Wifi.php?r1=1.1&r2=1.2&diff_format=u Index: pear/Net_Wifi/Net/Wifi.php diff -u pear/Net_Wifi/Net/Wifi.php:1.1 pear/Net_Wifi/Net/Wifi.php:1.2 --- pear/Net_Wifi/Net/Wifi.php:1.1 Fri Oct 27 20:54:13 2006 +++ pear/Net_Wifi/Net/Wifi.php Fri Oct 27 21:01:47 2006 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * A class for scanning wireless networks and identifying -* local wireless network interfaces +* local wireless network interfaces. * * PHP versions 4 and 5 * @@ -16,13 +16,15 @@ * @category Net * @package Net * @license http://www.php.net/license/3_0.txt PHP License 3.0 -* @version CVS: $Id: Wifi.php,v 1.1 2006/10/27 20:54:13 cweiske Exp $ +* @version CVS: $Id: Wifi.php,v 1.2 2006/10/27 21:01:47 cweiske Exp $ * * @date 2005-07-10 08:23 */ +require_once 'Net/Wifi/Cell.php'; +require_once 'Net/Wifi/Config.php'; //required for System::which() functionality -require_once('System.php'); +require_once 'System.php'; /** * This class uses tools like iwconfig and iwlist to scan @@ -41,9 +43,9 @@ 'iwlist' => '/usr/sbin/iwlist', '/proc/net/wireless' => '/proc/net/wireless' ); - - - + + + /** * Constructor which tries to guess the paths of the tools */ @@ -59,9 +61,9 @@ $this->setPathIwconfig($iwlist); } }//function Net_Wifi() - - - + + + /** * Returns an object with the current state of the interface (connected/not connected, AP,...). * @@ -78,9 +80,9 @@ return $this->parseCurrentConfig($strAll); }//function getCurrentConfig($strInterface) - - - + + + /** * Parses the iwconfig output to collect the current config information. * @@ -123,17 +125,17 @@ if (strpos($strAll, 'radio off')) { $objConfig->activated = false; } - + if (strpos($strAll, 'unassociated') === false && $objConfig->ap != null && $objConfig->ap != '00:00:00:00:00:00') { $objConfig->associated = true; } - + return $objConfig; }//function parseCurrentConfig($strAll) - - - + + + /** * Checks if a network interface is connected to an access point. * @@ -144,12 +146,12 @@ function isConnected($strInterface) { $objConfig = $this->getCurrentConfig($strInterface); - + return $objConfig->associated; }//function isConnected($strInterface) - - - + + + /** * Returns an array with the names/device files of all supported wireless lan devices. * @@ -185,12 +187,12 @@ } }//foreach line }//use iwconfig - + return $arWirelessInterfaces; }//function getSupportedInterfaces() - - - + + + /** * Scans for access points / ad hoc cells and returns them. * @@ -202,12 +204,12 @@ { $arLines = array(); exec($this->arFileLocation['iwlist'] . ' ' . escapeshellarg($strInterface) . ' scanning', $arLines); - + return $this->parseScan( $arLines); }//function scan($strInterface) - - - + + + /** * Parses the output of iwlist and returns the recognized cells. * @@ -221,7 +223,7 @@ //one line only -> no cells there return array(); } - + //split into cells $arCells = array(); $nCurrentCell = -1; @@ -231,21 +233,21 @@ if ($strLine == '') { continue; } - + if (substr($strLine, 0, 4) == 'Cell') { //we've got a new cell $nCurrentCell++; //get cell number $nCell = substr($strLine, 5, strpos($strLine, ' ', 5) - 5); $arCells[$nCurrentCell] = new Net_Wifi_Cell(); - - + + $arCells[$nCurrentCell]->cell = $nCell; - + //remove cell information from line for further interpreting $strLine = substr($strLine, strpos($strLine, '- ') + 2); } - + $nPos = strpos($strLine, ':'); $nPosEquals = strpos($strLine, '='); if ($nPosEquals !== false && ($nPos === false || $nPosEquals < $nPos)) { @@ -253,14 +255,14 @@ $nPos = $nPosEquals; } $nPos++; - + $strId = strtolower(substr($strLine, 0, $nPos - 1)); $strValue = trim(substr($strLine, $nPos)); switch ($strId) { case 'address': $arCells[$nCurrentCell]->mac = $strValue; break; - + case 'essid': if ($strValue[0] == '"') { //has quotes around @@ -269,21 +271,21 @@ $arCells[$nCurrentCell]->ssid = $strValue; } break; - + case 'bit rate': $nRate = floatval(substr($strValue, 0, strpos($strValue, 'Mb/s'))); $arCells[$nCurrentCell]->rate = $nRate; $arCells[$nCurrentCell]->rates[] = $nRate; break; - + case 'protocol': $arCells[$nCurrentCell]->protocol = $strValue; break; - + case 'channel': $arCells[$nCurrentCell]->channel = intval($strValue); break; - + case 'encryption key': if ($strValue == 'on') { $arCells[$nCurrentCell]->encryption = true; @@ -291,7 +293,7 @@ $arCells[$nCurrentCell]->encryption = false; } break; - + case 'mode': if (strtolower($strValue) == 'master') { $arCells[$nCurrentCell]->mode = 'master'; @@ -299,11 +301,11 @@ $arCells[$nCurrentCell]->mode = 'ad-hoc'; } break; - + case 'signal level': $arCells[$nCurrentCell]->rssi = substr($strValue, 0, strpos($strValue, ' ')); break; - + case 'quality': $arData = explode(' ', $strValue); $arCells[$nCurrentCell]->quality = $arData[0]; @@ -317,11 +319,11 @@ } } break; - + case 'frequency': $arCells[$nCurrentCell]->frequency = $strValue; break; - + case 'extra': $nPos = strpos($strValue, ':'); $strSubId = strtolower(trim(substr($strValue, 0, $nPos))); @@ -335,31 +337,31 @@ $arCells[$nCurrentCell]->rates[$nB] = floatval($strRate); } break; - + case 'signal': case 'rssi': //-53 dBm $arCells[$nCurrentCell]->rssi = intval(substr($strValue, 0, strpos($strValue, ' '))); break; - + case 'last beacon': //25ms ago $arCells[$nCurrentCell]->beacon = intval(substr($strValue, 0, strpos($strValue, 'ms'))); break; - + default: echo 'unknown iwconfig extra information: ' . $strSubId . "\r\n"; break; } break; - + default: echo 'unknown iwconfig information: ' . $strId . "\r\n"; break; } }//foreach line - - + + //not all outputs are sorted (note the 6) //Extra: Rates (Mb/s): 1 2 5.5 9 11 6 12 18 24 36 48 54 //additionally, some drivers have many single "Bit Rate:" fields instead of one big one @@ -368,12 +370,12 @@ $arCells[$nCurrentCell]->rates = array_unique($arCells[$nCurrentCell]->rates); } - + return $arCells; }//function parseScan($arLines) - - - + + + /** * Tells the driver to use the access point with the given MAC address only. * @@ -392,18 +394,18 @@ $arLines = array(); $nReturnVar = 0; exec($this->arFileLocation['iwconfig'] . ' ' . escapeshellarg($strInterface) . ' ap ' . escapeshellarg($strMac), $arLines, $nReturnVar); - + return $nReturnVar == 0; }//function connectToAccessPoint($strInterface, $strMac) - - - + + + /** * and now some dumb getters and setters */ - - - + + + /** * Returns the set path to /proc/wireless. * @access public @@ -413,9 +415,9 @@ { return $this->arFileLocation['/proc/net/wireless']; }//function getPathProcWireless() - - - + + + /** * Returns the set path to /proc/net/wireless. * @access public @@ -425,9 +427,9 @@ { $this->arFileLocation['/proc/net/wireless'] = $strProcWireless; }//function setPathProcWireless( $strProcWireless) - - - + + + /** * Returns the set path to iwconfig. * @access public @@ -437,9 +439,9 @@ { return $this->arFileLocation['iwconfig']; }//function getPathIwconfig() - - - + + + /** * Returns the set path to iwconfig. * @access public @@ -449,9 +451,9 @@ { $this->arFileLocation['iwconfig'] = $strPathIwconfig; }//function setPathIwconfig( $strPathIwconfig) - - - + + + /** * Returns the set path to iwlist. * @access public @@ -461,9 +463,9 @@ { return $this->arFileLocation['iwlist']; }//function getPathIwlist() - - - + + + /** * Returns the set path to iwlist. * @access public @@ -473,175 +475,8 @@ { $this->arFileLocation['iwlist'] = $strPathIwlist; }//function setPathIwlist( $strPathIwlist) - - -}//class Net_Wifi - -/** -* Cell information from a wifi scan. -*/ -class Net_Wifi_Cell -{ - /** - * The current cell number. - * Has nothing to say. - * @var int - */ - var $cell = null; - - /** - * MAC address of the cell (access point or ad-hoc station). - * example: 00:40:05:28:EB:45 - * @var string - */ - var $mac = null; - - /** - * "Service Set IDentifier" of the cell which identifies the network. - * Max. 32 alphanumeric characters - * example: "My Network" (without quotes) - * @var string - */ - var $ssid = null; - - /** - * Network type. - * can be "master" or "ad-hoc" (without quotes) - * @var string - */ - var $mode = null; - - /** - * Channel number used for communication. - * number from 1 to 12 or so - * @var int - */ - var $channel = null; - - /** - * If encryption is used. - * @var boolean - */ - var $encryption = null; - - /** - * Channel frequency. - * example: 2.412GHz - * @var string - */ - var $frequency = null; - - /** - * The protocol version used. - * example: IEEE 802.11b - * @var string - */ - var $protocol = null; - - /** - * Bit rate which is used (when connected). - * @var float - */ - var $rate = null; - - /** - * Array of supported bit rates. - * @var array(float) - */ - var $rates = array(); - - /** - * Signal strength. - * example: -59 - * @var int - */ - var $rssi = null; - - /** - * The time since the last beacon (time sync) frame has been sent, in ms. - * @var int - */ - var $beacon = null; -}//class Net_Wifi_Cell - - - -/** -* Configuration settings of a wifi network interface -*/ -class Net_Wifi_Config -{ - /** - * If the interface is activated. - * Some notebooks have a button which deactivates wifi, this is recognized here. - * Note that this setting can't be read by all drivers, and so - * it's "true" if it can't be determined. You can be sure that it's deactivated - * if this setting is false, but not that it's activated if it's true - * @var boolean - */ - var $activated = true; - - /** - * If the interface is connected to an access point or an ad-hoc network. - * @var boolean - */ - var $associated = false; - - /** - * MAC address of the associated access point. - * @var string - */ - var $ap = null; - - /** - * "Service Set IDentifier" of the cell which identifies current network. - * Max. 32 alphanumeric characters - * example: "My Network" (without quotes) - * @var string - */ - var $ssid = null; - - /** - * Network type. - * Can be "master" or "ad-hoc" (without quotes) - * @var string - */ - var $mode = null; - - /** - * The nickname which the interface (computer) uses. - * Something like a computer name - * @var string - */ - var $nick = null; - - /** - * The bit rate of the connection. - * @var float - */ - var $rate = null; - - /** - * Power setting of the interface. - * @var int - */ - var $power = null; - - /** - * Protocol version which is used for connection. - * example: "IEEE 802.11g" without quotes - * @var string - */ - var $protocol = null; - - /** - * Signal strength. - * example: -59 - * @var int - */ - var $rssi = null; -}//class Net_Wifi_Config +}//class Net_Wifi ?> \ No newline at end of file http://cvs.php.net/viewvc.cgi/pear/Net_Wifi/Net/Wifi/Cell.php?view=markup&rev=1.1 Index: pear/Net_Wifi/Net/Wifi/Cell.php +++ pear/Net_Wifi/Net/Wifi/Cell.php <?php /** * Cell information from a wifi scan. * * @author Christian Weiske <cweiske@php.net> */ class Net_Wifi_Cell { /** * The current cell number. * Has nothing to say. * @var int */ var $cell = null; /** * MAC address of the cell (access point or ad-hoc station). * example: 00:40:05:28:EB:45 * @var string */ var $mac = null; /** * "Service Set IDentifier" of the cell which identifies the network. * Max. 32 alphanumeric characters * example: "My Network" (without quotes) * @var string */ var $ssid = null; /** * Network type. * can be "master" or "ad-hoc" (without quotes) * @var string */ var $mode = null; /** * Channel number used for communication. * number from 1 to 12 or so * @var int */ var $channel = null; /** * If encryption is used. * @var boolean */ var $encryption = null; /** * Channel frequency. * example: 2.412GHz * @var string */ var $frequency = null; /** * The protocol version used. * example: IEEE 802.11b * @var string */ var $protocol = null; /** * Bit rate which is used (when connected). * @var float */ var $rate = null; /** * Array of supported bit rates. * @var array(float) */ var $rates = array(); /** * Signal strength. * example: -59 * @var int */ var $rssi = null; /** * The time since the last beacon (time sync) frame has been sent, in ms. * @var int */ var $beacon = null; }//class Net_Wifi_Cell ?> http://cvs.php.net/viewvc.cgi/pear/Net_Wifi/Net/Wifi/Config.php?view=markup&rev=1.1 Index: pear/Net_Wifi/Net/Wifi/Config.php +++ pear/Net_Wifi/Net/Wifi/Config.php <?php /** * Configuration settings of a wifi network interface. * * @author Christian Weiske <cweiske@php.net> */ class Net_Wifi_Config { /** * If the interface is activated. * Some notebooks have a button which deactivates wifi, this is recognized here. * Note that this setting can't be read by all drivers, and so * it's "true" if it can't be determined. You can be sure that it's deactivated * if this setting is false, but not that it's activated if it's true * @var boolean */ var $activated = true; /** * If the interface is connected to an access point or an ad-hoc network. * @var boolean */ var $associated = false; /** * MAC address of the associated access point. * @var string */ var $ap = null; /** * "Service Set IDentifier" of the cell which identifies current network. * Max. 32 alphanumeric characters * example: "My Network" (without quotes) * @var string */ var $ssid = null; /** * Network type. * Can be "master" or "ad-hoc" (without quotes) * @var string */ var $mode = null; /** * The nickname which the interface (computer) uses. * Something like a computer name * @var string */ var $nick = null; /** * The bit rate of the connection. * @var float */ var $rate = null; /** * Power setting of the interface. * @var int */ var $power = null; /** * Protocol version which is used for connection. * example: "IEEE 802.11g" without quotes * @var string */ var $protocol = null; /** * Signal strength. * example: -59 * @var int */ var $rssi = null; }//class Net_Wifi_Config ?>
http://cvs.php.net/viewvc.cgi/pear/Net_Wifi/package.xml?r1=1.2&r2=1.3&diff_format=u Index: pear/Net_Wifi/package.xml diff -u pear/Net_Wifi/package.xml:1.2 pear/Net_Wifi/package.xml:1.3 --- pear/Net_Wifi/package.xml:1.2 Fri Oct 27 20:54:13 2006 +++ pear/Net_Wifi/package.xml Fri Oct 27 21:01:47 2006 @@ -43,7 +43,11 @@ <contents> <dir name="/"> <dir name="Net"> - <file name="Wifi.php" role="php" /> + <file name="Wifi.php" role="php" /> + <dir name="Wifi"> + <file name="Cell.php" role="php" /> + <file name="Config.php" role="php" /> + </dir> </dir> <dir name="examples"> <file baseinstalldir="Net" name="Wifi_usage.php" role="doc" /> http://cvs.php.net/viewvc.cgi/pear/Net_Wifi/Net/Wifi.php?r1=1.1&r2=1.2&diff_format=u Index: pear/Net_Wifi/Net/Wifi.php diff -u pear/Net_Wifi/Net/Wifi.php:1.1 pear/Net_Wifi/Net/Wifi.php:1.2 --- pear/Net_Wifi/Net/Wifi.php:1.1 Fri Oct 27 20:54:13 2006 +++ pear/Net_Wifi/Net/Wifi.php Fri Oct 27 21:01:47 2006 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * A class for scanning wireless networks and identifying -* local wireless network interfaces +* local wireless network interfaces. * * PHP versions 4 and 5 * @@ -16,13 +16,15 @@ * @category Net * @package Net * @license http://www.php.net/license/3_0.txt PHP License 3.0 -* @version CVS: $Id: Wifi.php,v 1.1 2006/10/27 20:54:13 cweiske Exp $ +* @version CVS: $Id: Wifi.php,v 1.2 2006/10/27 21:01:47 cweiske Exp $ * * @date 2005-07-10 08:23 */ +require_once 'Net/Wifi/Cell.php'; +require_once 'Net/Wifi/Config.php'; //required for System::which() functionality -require_once('System.php'); +require_once 'System.php'; /** * This class uses tools like iwconfig and iwlist to scan @@ -41,9 +43,9 @@ 'iwlist' => '/usr/sbin/iwlist', '/proc/net/wireless' => '/proc/net/wireless' ); - - - + + + /** * Constructor which tries to guess the paths of the tools */ @@ -59,9 +61,9 @@ $this->setPathIwconfig($iwlist); } }//function Net_Wifi() - - - + + + /** * Returns an object with the current state of the interface (connected/not connected, AP,...). * @@ -78,9 +80,9 @@ return $this->parseCurrentConfig($strAll); }//function getCurrentConfig($strInterface) - - - + + + /** * Parses the iwconfig output to collect the current config information. * @@ -123,17 +125,17 @@ if (strpos($strAll, 'radio off')) { $objConfig->activated = false; } - + if (strpos($strAll, 'unassociated') === false && $objConfig->ap != null && $objConfig->ap != '00:00:00:00:00:00') { $objConfig->associated = true; } - + return $objConfig; }//function parseCurrentConfig($strAll) - - - + + + /** * Checks if a network interface is connected to an access point. * @@ -144,12 +146,12 @@ function isConnected($strInterface) { $objConfig = $this->getCurrentConfig($strInterface); - + return $objConfig->associated; }//function isConnected($strInterface) - - - + + + /** * Returns an array with the names/device files of all supported wireless lan devices. * @@ -185,12 +187,12 @@ } }//foreach line }//use iwconfig - + return $arWirelessInterfaces; }//function getSupportedInterfaces() - - - + + + /** * Scans for access points / ad hoc cells and returns them. * @@ -202,12 +204,12 @@ { $arLines = array(); exec($this->arFileLocation['iwlist'] . ' ' . escapeshellarg($strInterface) . ' scanning', $arLines); - + return $this->parseScan( $arLines); }//function scan($strInterface) - - - + + + /** * Parses the output of iwlist and returns the recognized cells. * @@ -221,7 +223,7 @@ //one line only -> no cells there return array(); } - + //split into cells $arCells = array(); $nCurrentCell = -1; @@ -231,21 +233,21 @@ if ($strLine == '') { continue; } - + if (substr($strLine, 0, 4) == 'Cell') { //we've got a new cell $nCurrentCell++; //get cell number $nCell = substr($strLine, 5, strpos($strLine, ' ', 5) - 5); $arCells[$nCurrentCell] = new Net_Wifi_Cell(); - - + + $arCells[$nCurrentCell]->cell = $nCell; - + //remove cell information from line for further interpreting $strLine = substr($strLine, strpos($strLine, '- ') + 2); } - + $nPos = strpos($strLine, ':'); $nPosEquals = strpos($strLine, '='); if ($nPosEquals !== false && ($nPos === false || $nPosEquals < $nPos)) { @@ -253,14 +255,14 @@ $nPos = $nPosEquals; } $nPos++; - + $strId = strtolower(substr($strLine, 0, $nPos - 1)); $strValue = trim(substr($strLine, $nPos)); switch ($strId) { case 'address': $arCells[$nCurrentCell]->mac = $strValue; break; - + case 'essid': if ($strValue[0] == '"') { //has quotes around @@ -269,21 +271,21 @@ $arCells[$nCurrentCell]->ssid = $strValue; } break; - + case 'bit rate': $nRate = floatval(substr($strValue, 0, strpos($strValue, 'Mb/s'))); $arCells[$nCurrentCell]->rate = $nRate; $arCells[$nCurrentCell]->rates[] = $nRate; break; - + case 'protocol': $arCells[$nCurrentCell]->protocol = $strValue; break; - + case 'channel': $arCells[$nCurrentCell]->channel = intval($strValue); break; - + case 'encryption key': if ($strValue == 'on') { $arCells[$nCurrentCell]->encryption = true; @@ -291,7 +293,7 @@ $arCells[$nCurrentCell]->encryption = false; } break; - + case 'mode': if (strtolower($strValue) == 'master') { $arCells[$nCurrentCell]->mode = 'master'; @@ -299,11 +301,11 @@ $arCells[$nCurrentCell]->mode = 'ad-hoc'; } break; - + case 'signal level': $arCells[$nCurrentCell]->rssi = substr($strValue, 0, strpos($strValue, ' ')); break; - + case 'quality': $arData = explode(' ', $strValue); $arCells[$nCurrentCell]->quality = $arData[0]; @@ -317,11 +319,11 @@ } } break; - + case 'frequency': $arCells[$nCurrentCell]->frequency = $strValue; break; - + case 'extra': $nPos = strpos($strValue, ':'); $strSubId = strtolower(trim(substr($strValue, 0, $nPos))); @@ -335,31 +337,31 @@ $arCells[$nCurrentCell]->rates[$nB] = floatval($strRate); } break; - + case 'signal': case 'rssi': //-53 dBm $arCells[$nCurrentCell]->rssi = intval(substr($strValue, 0, strpos($strValue, ' '))); break; - + case 'last beacon': //25ms ago $arCells[$nCurrentCell]->beacon = intval(substr($strValue, 0, strpos($strValue, 'ms'))); break; - + default: echo 'unknown iwconfig extra information: ' . $strSubId . "\r\n"; break; } break; - + default: echo 'unknown iwconfig information: ' . $strId . "\r\n"; break; } }//foreach line - - + + //not all outputs are sorted (note the 6) //Extra: Rates (Mb/s): 1 2 5.5 9 11 6 12 18 24 36 48 54 //additionally, some drivers have many single "Bit Rate:" fields instead of one big one @@ -368,12 +370,12 @@ $arCells[$nCurrentCell]->rates = array_unique($arCells[$nCurrentCell]->rates); } - + return $arCells; }//function parseScan($arLines) - - - + + + /** * Tells the driver to use the access point with the given MAC address only. * @@ -392,18 +394,18 @@ $arLines = array(); $nReturnVar = 0; exec($this->arFileLocation['iwconfig'] . ' ' . escapeshellarg($strInterface) . ' ap ' . escapeshellarg($strMac), $arLines, $nReturnVar); - + return $nReturnVar == 0; }//function connectToAccessPoint($strInterface, $strMac) - - - + + + /** * and now some dumb getters and setters */ - - - + + + /** * Returns the set path to /proc/wireless. * @access public @@ -413,9 +415,9 @@ { return $this->arFileLocation['/proc/net/wireless']; }//function getPathProcWireless() - - - + + + /** * Returns the set path to /proc/net/wireless. * @access public @@ -425,9 +427,9 @@ { $this->arFileLocation['/proc/net/wireless'] = $strProcWireless; }//function setPathProcWireless( $strProcWireless) - - - + + + /** * Returns the set path to iwconfig. * @access public @@ -437,9 +439,9 @@ { return $this->arFileLocation['iwconfig']; }//function getPathIwconfig() - - - + + + /** * Returns the set path to iwconfig. * @access public @@ -449,9 +451,9 @@ { $this->arFileLocation['iwconfig'] = $strPathIwconfig; }//function setPathIwconfig( $strPathIwconfig) - - - + + + /** * Returns the set path to iwlist. * @access public @@ -461,9 +463,9 @@ { return $this->arFileLocation['iwlist']; }//function getPathIwlist() - - - + + + /** * Returns the set path to iwlist. * @access public @@ -473,175 +475,8 @@ { $this->arFileLocation['iwlist'] = $strPathIwlist; }//function setPathIwlist( $strPathIwlist) - - -}//class Net_Wifi - -/** -* Cell information from a wifi scan. -*/ -class Net_Wifi_Cell -{ - /** - * The current cell number. - * Has nothing to say. - * @var int - */ - var $cell = null; - - /** - * MAC address of the cell (access point or ad-hoc station). - * example: 00:40:05:28:EB:45 - * @var string - */ - var $mac = null; - - /** - * "Service Set IDentifier" of the cell which identifies the network. - * Max. 32 alphanumeric characters - * example: "My Network" (without quotes) - * @var string - */ - var $ssid = null; - - /** - * Network type. - * can be "master" or "ad-hoc" (without quotes) - * @var string - */ - var $mode = null; - - /** - * Channel number used for communication. - * number from 1 to 12 or so - * @var int - */ - var $channel = null; - - /** - * If encryption is used. - * @var boolean - */ - var $encryption = null; - - /** - * Channel frequency. - * example: 2.412GHz - * @var string - */ - var $frequency = null; - - /** - * The protocol version used. - * example: IEEE 802.11b - * @var string - */ - var $protocol = null; - - /** - * Bit rate which is used (when connected). - * @var float - */ - var $rate = null; - - /** - * Array of supported bit rates. - * @var array(float) - */ - var $rates = array(); - - /** - * Signal strength. - * example: -59 - * @var int - */ - var $rssi = null; - - /** - * The time since the last beacon (time sync) frame has been sent, in ms. - * @var int - */ - var $beacon = null; -}//class Net_Wifi_Cell - - - -/** -* Configuration settings of a wifi network interface -*/ -class Net_Wifi_Config -{ - /** - * If the interface is activated. - * Some notebooks have a button which deactivates wifi, this is recognized here. - * Note that this setting can't be read by all drivers, and so - * it's "true" if it can't be determined. You can be sure that it's deactivated - * if this setting is false, but not that it's activated if it's true - * @var boolean - */ - var $activated = true; - - /** - * If the interface is connected to an access point or an ad-hoc network. - * @var boolean - */ - var $associated = false; - - /** - * MAC address of the associated access point. - * @var string - */ - var $ap = null; - - /** - * "Service Set IDentifier" of the cell which identifies current network. - * Max. 32 alphanumeric characters - * example: "My Network" (without quotes) - * @var string - */ - var $ssid = null; - - /** - * Network type. - * Can be "master" or "ad-hoc" (without quotes) - * @var string - */ - var $mode = null; - - /** - * The nickname which the interface (computer) uses. - * Something like a computer name - * @var string - */ - var $nick = null; - - /** - * The bit rate of the connection. - * @var float - */ - var $rate = null; - - /** - * Power setting of the interface. - * @var int - */ - var $power = null; - - /** - * Protocol version which is used for connection. - * example: "IEEE 802.11g" without quotes - * @var string - */ - var $protocol = null; - - /** - * Signal strength. - * example: -59 - * @var int - */ - var $rssi = null; -}//class Net_Wifi_Config +}//class Net_Wifi ?> \ No newline at end of file http://cvs.php.net/viewvc.cgi/pear/Net_Wifi/Net/Wifi/Cell.php?view=markup&rev=1.1 Index: pear/Net_Wifi/Net/Wifi/Cell.php +++ pear/Net_Wifi/Net/Wifi/Cell.php <?php /** * Cell information from a wifi scan. * * @author Christian Weiske <cweiske@php.net> */ class Net_Wifi_Cell { /** * The current cell number. * Has nothing to say. * @var int */ var $cell = null; /** * MAC address of the cell (access point or ad-hoc station). * example: 00:40:05:28:EB:45 * @var string */ var $mac = null; /** * "Service Set IDentifier" of the cell which identifies the network. * Max. 32 alphanumeric characters * example: "My Network" (without quotes) * @var string */ var $ssid = null; /** * Network type. * can be "master" or "ad-hoc" (without quotes) * @var string */ var $mode = null; /** * Channel number used for communication. * number from 1 to 12 or so * @var int */ var $channel = null; /** * If encryption is used. * @var boolean */ var $encryption = null; /** * Channel frequency. * example: 2.412GHz * @var string */ var $frequency = null; /** * The protocol version used. * example: IEEE 802.11b * @var string */ var $protocol = null; /** * Bit rate which is used (when connected). * @var float */ var $rate = null; /** * Array of supported bit rates. * @var array(float) */ var $rates = array(); /** * Signal strength. * example: -59 * @var int */ var $rssi = null; /** * The time since the last beacon (time sync) frame has been sent, in ms. * @var int */ var $beacon = null; }//class Net_Wifi_Cell ?> http://cvs.php.net/viewvc.cgi/pear/Net_Wifi/Net/Wifi/Config.php?view=markup&rev=1.1 Index: pear/Net_Wifi/Net/Wifi/Config.php +++ pear/Net_Wifi/Net/Wifi/Config.php <?php /** * Configuration settings of a wifi network interface. * * @author Christian Weiske <cweiske@php.net> */ class Net_Wifi_Config { /** * If the interface is activated. * Some notebooks have a button which deactivates wifi, this is recognized here. * Note that this setting can't be read by all drivers, and so * it's "true" if it can't be determined. You can be sure that it's deactivated * if this setting is false, but not that it's activated if it's true * @var boolean */ var $activated = true; /** * If the interface is connected to an access point or an ad-hoc network. * @var boolean */ var $associated = false; /** * MAC address of the associated access point. * @var string */ var $ap = null; /** * "Service Set IDentifier" of the cell which identifies current network. * Max. 32 alphanumeric characters * example: "My Network" (without quotes) * @var string */ var $ssid = null; /** * Network type. * Can be "master" or "ad-hoc" (without quotes) * @var string */ var $mode = null; /** * The nickname which the interface (computer) uses. * Something like a computer name * @var string */ var $nick = null; /** * The bit rate of the connection. * @var float */ var $rate = null; /** * Power setting of the interface. * @var int */ var $power = null; /** * Protocol version which is used for connection. * example: "IEEE 802.11g" without quotes * @var string */ var $protocol = null; /** * Signal strength. * example: -59 * @var int */ var $rssi = null; }//class Net_Wifi_Config ?>