Files
librenms-librenms/LibreNMS/OS/EltexMes23xx.php
PipoCanaja 2ae0e84091 Fix redeclare of function breaking tests in OS eltex-mes23xx (#14227)
* eltex
* function in Class file
* style
2022-08-24 23:05:38 +02:00

41 lines
1.2 KiB
PHP

<?php
/**
* EltexMes23xx.php
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* @link https://www.librenms.org
*
* @copyright 2022 PipoCanaja
* @author PipoCanaja
*/
namespace LibreNMS\OS;
use LibreNMS\OS;
class EltexMes23xx extends OS
{
/**
* Specific HexToString for Eltex
*/
public function normData(string $par = ''): string
{
$tmp = str_replace([':', ' '], '', trim(strtoupper($par)));
$ret = preg_match('/^[0-9A-F]+$/', $tmp) ? hex2str($tmp) : $par; //if string is pure hex, convert to ascii
return $ret;
}
}