Ignore:
Timestamp:
Oct 5, 2015, 11:11:38 PM (9 years ago)
Author:
chronos
Message:
  • Fixed: More robust decoding of wireless signal strenght which varies across RouterOS versions.
File:
1 edited

Legend:

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

    r738 r751  
    3939      } else $Interface = null;
    4040
    41       $Parts = explode('@', $Properties['signal-strength']);
    42       $Strength = substr($Parts[0], 0, -3); // without dBm
     41      if(strpos($Properties['signal-strength'], '@') === false)
     42      {
     43        $Strength = $Properties['signal-strength'];
     44      } else {
     45        $Parts = explode('@', $Properties['signal-strength']);
     46        if(substr($Parts[0], -3) == 'dBm')
     47          $Strength = substr($Parts[0], 0, -3); // without dBm
     48          else $Strength = $Parts[0];
     49      }
     50      echo($Properties['signal-strength'].' '.$Strength."\n");
    4351      $RateRx = substr($Properties['rx-rate'], 0, -3); // without MHz
    4452      $RateTx = substr($Properties['tx-rate'], 0, -3); // without MHz
Note: See TracChangeset for help on using the changeset viewer.