Changeset 674
- Timestamp:
- Jul 21, 2014, 11:09:35 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/FormClasses.php
r673 r674 772 772 'Filter' => '1', 773 773 ), 774 'TNetworkSignalListInterface' => array( 775 'Type' => 'ManyToOne', 776 'Table' => 'NetworkSignal', 777 'Id' => 'Id', 778 'Ref' => 'Interface', 779 'Filter' => '1', 780 ), 774 781 'TFinanceInvoiceItemListInvoice' => array( 775 782 'Type' => 'ManyToOne', -
trunk/Application/Version.php
r673 r674 1 1 <?php 2 2 3 $Revision = 67 3; // Subversion revision4 $DatabaseRevision = 67 1; // SQL structure revision5 $ReleaseTime = strtotime('2014-07- 19');3 $Revision = 674; // Subversion revision 4 $DatabaseRevision = 674; // SQL structure revision 5 $ReleaseTime = strtotime('2014-07-22'); -
trunk/Common/Setup/Updates.php
r671 r674 832 832 $Manager->Execute('ALTER TABLE `NetworkDevice` ADD FOREIGN KEY ( `API` ) REFERENCES `DeviceAPIType` ( 833 833 `Id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;'); 834 834 } 835 836 function UpdateTo674($Manager) 837 { 838 $Manager->Execute('ALTER TABLE `NetworkSignal` ADD `RateRx` INT NOT NULL ;'); 839 $Manager->Execute('ALTER TABLE `NetworkSignal` ADD `RateTx` INT NOT NULL ;'); 835 840 } 836 841 … … 879 884 662 => array('Revision' => 668, 'Function' => 'UpdateTo668'), 880 885 668 => array('Revision' => 671, 'Function' => 'UpdateTo671'), 886 671 => array('Revision' => 674, 'Function' => 'UpdateTo674'), 881 887 )); 882 888 } -
trunk/Modules/Network/Network.php
r671 r674 188 188 'Links2' => array('Type' => 'TNetworkLinkListInterface2', 'Caption' => 'Propojení 2', 'Default' => ''), 189 189 'UpDown' => array('Type' => 'TNetworkInterfaceUpDown', 'Caption' => 'Změny stavu', 'Default' => ''), 190 'Signal' => array('Type' => 'TNetworkSignalListInterface', 'Caption' => 'Signál', 'Default' => ''), 190 191 ), 191 192 )); … … 237 238 'MAC' => array('Type' => 'MacAddress', 'Caption' => 'Fyzická adresa (MAC)', 'Default' => ''), 238 239 'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => '', 'Null' => true), 239 'Value' => array('Type' => 'Integer', 'Caption' => 'Signál', 'Default' => '0'), 240 'Value' => array('Type' => 'Integer', 'Caption' => 'Signál', 'Default' => '0', 'Suffix' => 'dBm'), 241 'RateRx' => array('Type' => 'Integer', 'Caption' => 'Rychlost', 'Default' => '0', 'Suffix' => 'MHz'), 242 'RateTx' => array('Type' => 'Integer', 'Caption' => 'Rychlost', 'Default' => '0', 'Suffix' => 'MHz'), 240 243 ), 241 244 )); -
trunk/Modules/NetworkConfigRouterOS/Generators/Signal.php
r671 r674 19 19 echo('Waiting '.$Delay.' seconds...'."\n"); 20 20 sleep($Delay); 21 } print_r($Properties); 22 21 } 23 22 } 24 23 … … 37 36 { 38 37 echo($Device['LocalIP']."\n"); 39 $Routerboard = new Routerboard(); 40 $Routerboard->UserName = $Config['MainRouter']['UserName']; 41 $Routerboard->Timeout = $Config['MainRouter']['ConnectTimeout']; 42 $Routerboard->HostName = $Device['LocalIP']; 43 $Routerboard->Debug = true; 44 $List = $Routerboard->ListGetPrint($Path, array('mac-address', 'signal-strength'), array(), 'stats'); 45 foreach($List as $Properties) 38 $Routerboard = new RouterosAPI(); 39 $Routerboard->Connect($Device['LocalIP'], $Config['API']['UserName'], $Config['API']['Password']); 40 $Routerboard->Write('/interface/wireless/registration-table/getall', false); 41 $Routerboard->Write('=.proplist=signal-strength,mac-address,rx-rate,tx-rate', false); 42 $Routerboard->Write('=stats='); 43 $Read = $Routerboard->Read(false); 44 $Array = $Routerboard->ParseResponse($Read); 45 foreach($Array as $Properties) 46 46 { 47 print_r($Properties);48 47 $DbResult = $System->Database->select('NetworkInterface', 'Id', 'MAC="'.$Properties['mac-address'].'"'); 49 48 if($DbResult->num_rows > 0) … … 52 51 $Interface = $DbRow['Id']; 53 52 } else $Interface = null; 53 54 $Parts = explode('@', $Properties['signal-strength']); 55 $Strength = substr($Parts[0], 0, -3); // without dBm 56 $RateRx = substr($Properties['rx-rate'], 0, -3); // without MHz 57 $RateTx = substr($Properties['tx-rate'], 0, -3); // without MHz 54 58 $System->Database->insert('NetworkSignal', array('MAC' => $Properties['mac-address'], 55 'Value' => $Properties['signal-strength'], 'Time' => $Time, 'Interface' => $Interface)); 59 'Value' => $Strength, 'RateRx' => $RateRx, 'RateTx' => $RateTx, 60 'Time' => TimeToMysqlDateTime($Time), 'Interface' => $Interface)); 56 61 /* 57 62 $DbResult = $System->Database->select('Measure', 'Id', '`Name` = "'.$Properties['mac-address'].'"'); … … 72 77 } 73 78 74 RepeatFunction(60 , 'ReadWirelessRegistration');79 RepeatFunction(60 * 60, 'ReadWirelessRegistration'); -
trunk/Modules/NetworkConfigRouterOS/NetworkConfigRouterOS.php
r673 r674 2 2 3 3 include_once(dirname(__FILE__).'/Routerboard.php'); 4 include_once(dirname(__FILE__).'/RouterboardAPI.php'); 4 5 include_once(dirname(__FILE__).'/Generators/Common.php'); 5 6 -
trunk/Modules/NetworkConfigRouterOS/RouterboardAPI.php
r671 r674 11 11 var $Timeout; // Connection attempt timeout and data read timeout 12 12 var $Socket; // Variable for storing socket resource 13 var $Debug; 13 14 14 15 function __construct() … … 19 20 $this->Port = 8728; 20 21 $this->Timeout = 3; 22 $this->Debug = false; 21 23 } 22 24 … … 182 184 $Response[] = $Line; 183 185 } 184 echo($Line."\n");186 if($this->Debug) echo($Line); 185 187 // If we get a !done, make a note of it. 186 188 if ($Line == "!done") $ReceivedDone = true;
Note:
See TracChangeset
for help on using the changeset viewer.