Changeset 911 for trunk


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

Legend:

Unmodified
Added
Removed
  • trunk/Application/UpdateTrace.php

    r909 r911  
    21702170  $Manager->Execute('ALTER TABLE `Member` ADD KEY (`AddressPlace`);');
    21712171  $Manager->Execute('ALTER TABLE `Member` ADD FOREIGN KEY (`AddressPlace`) REFERENCES `AddressPlace`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');
     2172}
     2173
     2174function UpdateTo911(UpdateManager $Manager): void
     2175{
     2176  $Manager->Execute('ALTER TABLE `NetworkSignal` ADD `Remote` INT NOT NULL DEFAULT "0" AFTER `Device`;');
    21722177}
    21732178
     
    22782283      885 => array('Revision' => 901, 'Function' => 'UpdateTo901'),
    22792284      901 => array('Revision' => 907, 'Function' => 'UpdateTo907'),
     2285      907 => array('Revision' => 911, 'Function' => 'UpdateTo911'),
    22802286    );
    22812287  }
  • trunk/Application/Version.php

    r907 r911  
    11<?php
    22
    3 $Revision = 907; // Subversion revision
    4 $DatabaseRevision = 907; // SQL structure revision
    5 $ReleaseTime = strtotime('2021-03-24');
     3$Revision = 911; // Subversion revision
     4$DatabaseRevision = 911; // SQL structure revision
     5$ReleaseTime = strtotime('2021-07-31');
  • trunk/Modules/FinanceBankAPI/FioAPI.php

    r888 r911  
    11<?php
    22
    3 // Specifikace API: http://www.fio.cz/docs/cz/API_Bankovnictvi.pdf
     3// Specifikace API: https://www.fio.cz/docs/cz/API_Bankovnictvi.pdf
    44
    55include('GPC.php');
  • trunk/Modules/Network/Network.php

    r909 r911  
    383383        'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => '', 'Null' => true),
    384384        'Value' => array('Type' => 'Integer', 'Caption' => 'Signál', 'Default' => '0', 'Suffix' => 'dBm'),
     385        'Remote' => array('Type' => 'Integer', 'Caption' => 'Vzdálený signál', 'Default' => '0', 'Suffix' => 'dBm'),
    385386        'RateRx' => array('Type' => 'Integer', 'Caption' => 'Rychlost Rx', 'Default' => '0', 'Suffix' => 'MHz'),
    386387        'RateTx' => array('Type' => 'Integer', 'Caption' => 'Rychlost Tx', 'Default' => '0', 'Suffix' => 'MHz'),
  • trunk/Modules/Network/NetworkModels.php

    r899 r911  
    195195    $Desc->AddReference('Interface', NetworkInterface::GetClassName());
    196196    $Desc->AddInteger('Value');
     197    $Desc->AddInteger('Remote');
    197198    $Desc->AddInteger('RateRx');
    198199    $Desc->AddInteger('RateTx');
  • 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    }
  • 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.