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/NetworkConfigAirOS/Generators/Signal.php

    r887 r911  
    2121      if (count($Result) > 0)
    2222      {
    23       //print_r($Result);
    24       $Array = json_decode(implode("\n", $Result), true);
    25       //print_r($Array);
    26       echo('-');
    27       foreach ($Array as $Properties)
    28       {
    29         $DbResult = $this->Database->select('NetworkInterface', 'Id', '`MAC`="'.$Properties['mac'].'"');
    30         if ($DbResult->num_rows > 0)
     23        //print_r($Result);
     24        $Array = json_decode(implode("\n", $Result), true);
     25        //print_r($Array);
     26        echo('-');
     27        foreach ($Array as $Properties)
    3128        {
    32           $DbRow = $DbResult->fetch_assoc();
    33           $Interface = $DbRow['Id'];
    34         } else $Interface = null;
     29          $DbResult = $this->Database->select('NetworkInterface', 'Id', '`MAC`="'.$Properties['mac'].'"');
     30          if ($DbResult->num_rows > 0)
     31          {
     32            $DbRow = $DbResult->fetch_assoc();
     33            $Interface = $DbRow['Id'];
     34          } else $Interface = null;
    3535
    36         $Strength = $Properties['signal'];
    37         $RateRx = $Properties['rx'];
    38         $RateTx = $Properties['tx'];
    39         $this->Database->insert('NetworkSignal', array('MAC' => $Properties['mac'],
    40           'Value' => $Strength, 'RateRx' => $RateRx, 'RateTx' => $RateTx,
    41           'Time' => TimeToMysqlDateTime($Time), 'Interface' => $Interface, 'Device' => $Device['Id']));
    42         echo('.');
    43       }
    44       echo("\n");
     36          $Strength = $Properties['signal'];
     37          $RemoteSignal = $Properties['remote']['signal'];
     38          $RateRx = $Properties['rx'];
     39          $RateTx = $Properties['tx'];
     40          $this->Database->insert('NetworkSignal', array('MAC' => $Properties['mac'],
     41            'Value' => $Strength, 'Remote' => $RemoteSignal, 'RateRx' => $RateRx, 'RateTx' => $RateTx,
     42            'Time' => TimeToMysqlDateTime($Time), 'Interface' => $Interface, 'Device' => $Device['Id']));
     43          echo('.');
     44        }
     45        echo("\n");
    4546      } else echo("Empty response\n");
    4647    }
Note: See TracChangeset for help on using the changeset viewer.