Changeset 873 for trunk/Modules/NetworkConfigRouterOS/Generators/Signal.php
- Timestamp:
- Apr 6, 2020, 11:17:40 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/NetworkConfigRouterOS/Generators/Signal.php
r851 r873 12 12 '(SELECT `LocalIP` FROM `NetworkInterface` WHERE `NetworkInterface`.`Device` = `NetworkDevice`.`Id` LIMIT 1) AS `LocalIP` '. 13 13 'FROM `NetworkDevice` WHERE (`API` = 1) AND (`Used` = 1)'); 14 while ($Device = $DbResult3->fetch_assoc())14 while ($Device = $DbResult3->fetch_assoc()) 15 15 { 16 16 echo($Device['LocalIP']."\n"); … … 19 19 //$Routerboard->Port = 8729; 20 20 $Routerboard->Connect($Device['LocalIP'], $this->System->Config['API']['UserName'], $this->System->Config['API']['Password']); 21 if (!$Routerboard->Connected) continue;21 if (!$Routerboard->Connected) continue; 22 22 $Routerboard->Write('/interface/wireless/registration-table/getall', false); 23 23 $Routerboard->Write('=.proplist=signal-strength,mac-address,rx-rate,tx-rate', false); … … 25 25 $Read = $Routerboard->Read(false); 26 26 $Array = $Routerboard->ParseResponse($Read); 27 foreach ($Array as $Properties)27 foreach ($Array as $Properties) 28 28 { 29 29 $DbResult = $this->Database->select('NetworkInterface', 'Id', 'MAC="'.$Properties['mac-address'].'"'); 30 if ($DbResult->num_rows > 0)30 if ($DbResult->num_rows > 0) 31 31 { 32 32 $DbRow = $DbResult->fetch_assoc(); … … 34 34 } else $Interface = 'NULL'; 35 35 36 if (strpos($Properties['signal-strength'], '@') === false)36 if (strpos($Properties['signal-strength'], '@') === false) 37 37 { 38 38 $Strength = $Properties['signal-strength']; 39 39 } else { 40 40 $Parts = explode('@', $Properties['signal-strength']); 41 if (substr($Parts[0], -3) == 'dBm')41 if (substr($Parts[0], -3) == 'dBm') 42 42 $Strength = substr($Parts[0], 0, -3); // without dBm 43 43 else $Strength = $Parts[0]; … … 50 50 /* 51 51 $DbResult = $this->Database->select('Measure', 'Id', '`Name` = "'.$Properties['mac-address'].'"'); 52 if ($DbResult->num_rows > 0)52 if ($DbResult->num_rows > 0) 53 53 { 54 54 $this->Database->insert('Measure', array('Name' => $Properties['mac-address'])); … … 74 74 if (substr($Value, -3, 3) == "Mbp") $Value = substr($Value, 0, -3); // without Mbp unit 75 75 if (substr($Value, -1, 1) == "M") $Value = substr($Value, 0, -1); // without M unit 76 return ($Value);76 return ($Value); 77 77 } 78 78
Note:
See TracChangeset
for help on using the changeset viewer.