Complete rework of packet parsing and packet generation

This commit is contained in:
2024-05-17 22:10:54 +10:00
parent 1650d07d5c
commit 29710c37c2
30 changed files with 1394 additions and 1403 deletions

View File

@@ -251,12 +251,15 @@ class System extends Model
/**
* Return the packet that this system uses
*
* @param Address $ao
* @return Packet
*/
public function packet(): Packet
public function packet(Address $ao): Packet
{
return new (collect(Packet::PACKET_TYPES)
->get($this->pkt_type ?: config('fido.packet_default')));
// @todo Check that the address is one of the system's addresses
return (new (collect(Packet::PACKET_TYPES)
->get($this->pkt_type ?: config('fido.packet_default'))))->for($ao);
}
public function poll(): ?Job