Added packet debug on web UI

This commit is contained in:
Deon George
2021-06-29 20:43:29 +10:00
parent dc86f7c008
commit 987b4040fb
17 changed files with 1095 additions and 792 deletions

View File

@@ -2,8 +2,34 @@
namespace App\Classes;
use Illuminate\Support\Arr;
abstract class FTN
{
public function __get($key)
{
switch ($key) {
case 'fftn':
return sprintf('%d:%d/%d.%d',
$this->fz,
$this->fn,
$this->ff,
$this->fp,
);
case 'tftn':
return sprintf('%d:%d/%d.%d',
$this->tz,
$this->tn,
$this->tf,
$this->tp,
);
default:
throw new \Exception('Unknown key: '.$key);
}
}
/**
* Determine if a line is a kludge line.
*
@@ -20,12 +46,18 @@ abstract class FTN
/**
* This function creates our unpack header
*
* @param array $pack
* @return string
*/
protected function unpackheader(array $pack)
protected function unpackheader(array $pack): string
{
return join('/',array_values(collect($pack)
->sortBy(function($k,$v) {return $k[0];})
->transform(function($k,$v) {return $k[1].$v;})->toArray()));
return join('/',
collect($pack)
->sortBy(function($k,$v) {return $k[0];})
->transform(function($k,$v) {return $k[1].$v;})
->values()
->toArray()
);
}
}