Refactored TDF processing PHP code to confirm to new TDF format

This commit is contained in:
Nav
2024-02-09 23:30:47 +00:00
parent 09a5be91fd
commit c563443737
58 changed files with 1877 additions and 1762 deletions

View File

@@ -0,0 +1,45 @@
<?php
namespace Targets\TargetDescriptionFiles;
require_once __DIR__ . "/RegisterGroup.php";
require_once __DIR__ . "/RegisterGroupReference.php";
require_once __DIR__ . "/Signal.php";
class Peripheral
{
public ?string $key = null;
public ?string $name = null;
public ?string $moduleKey = null;
public ?string $moduleName = null;
/** @var RegisterGroupReference[] */
public array $registerGroupReferences = [];
/** @var Signal[] */
public array $signals = [];
public function __construct(
?string $key,
?string $name,
?string $moduleKey,
array $registerGroupReferences,
array $signals
) {
$this->key = $key;
$this->name = $name;
$this->moduleKey = $moduleKey;
$this->registerGroupReferences = $registerGroupReferences;
$this->signals = $signals;
}
public function getRegisterGroupReference(string $key): ?RegisterGroupReference
{
foreach ($this->registerGroupReferences as $reference) {
if ($reference->key === $key) {
return $reference;
}
}
return null;
}
}