Ignore:
Timestamp:
Jul 31, 2021, 12:26:16 AM (3 years ago)
Author:
chronos
Message:
  • Modified: Record also remote signal for wireless clients.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/NetworkConfigRouterOS/Generators/Signal.php

    r887 r911  
    2121      if (!$Routerboard->Connected) continue;
    2222      $Routerboard->Write('/interface/wireless/registration-table/getall', false);
    23       $Routerboard->Write('=.proplist=signal-strength,mac-address,rx-rate,tx-rate', false);
     23      $Routerboard->Write('=.proplist=signal-strength,tx-signal-strength,mac-address,rx-rate,tx-rate', false);
    2424      $Routerboard->Write('=stats=');
    2525      $Read = $Routerboard->Read(false);
     
    3737        {
    3838          $Strength = $Properties['signal-strength'];
    39         } else {
     39        } else
     40        {
    4041          $Parts = explode('@', $Properties['signal-strength']);
    4142          if (substr($Parts[0], -3) == 'dBm')
     
    4344            else $Strength = $Parts[0];
    4445        }
     46
     47        if (array_key_exists('tx-signal-strength', $Properties))
     48        {
     49          if (strpos($Properties['tx-signal-strength'], '@') === false)
     50          {
     51            $RemoteSignal = $Properties['tx-signal-strength'];
     52          } else
     53          {
     54            $Parts = explode('@', $Properties['tx-signal-strength']);
     55            if (substr($Parts[0], -3) == 'dBm')
     56              $RemoteSignal = substr($Parts[0], 0, -3); // without dBm
     57              else $RemoteSignal = $Parts[0];
     58          }
     59        } else $RemoteSignal = 0;
     60
    4561        $RateRx = $this->StripUnits($Properties['rx-rate']);
    4662        $RateTx = $this->StripUnits($Properties['tx-rate']);
    47         $Queries[] = 'INSERT INTO `NetworkSignal` (`MAC`, `Value`, `RateRx`, `RateTx`, `Time`, `Interface`, `Device`) VALUES '.
    48           '("'.$Properties['mac-address'].'", '.$Strength.', '.$RateRx.', '.$RateTx.', "'.
     63        $Queries[] = 'INSERT INTO `NetworkSignal` (`MAC`, `Value`, `Remote`, `RateRx`, `RateTx`, `Time`, `Interface`, `Device`) VALUES '.
     64          '("'.$Properties['mac-address'].'", '.$Strength.', '.$RemoteSignal.', '.$RateRx.', '.$RateTx.', "'.
    4965          TimeToMysqlDateTime($Time).'", '.$Interface.', '.$Device['Id'].')';
    5066        /*
Note: See TracChangeset for help on using the changeset viewer.