| | | 1 | | using System; |
| | | 2 | | |
| | | 3 | | // The communication node is an endpoint encapsulated by an agent or system like the IADS to |
| | | 4 | | // interface with the mailbox. |
| | | 5 | | public sealed class CommsNode { |
| | 27 | 6 | | public Configs.AgentType EndpointType { get; init; } |
| | | 7 | | |
| | | 8 | | // The OnReceived event handler is called when the communication node receives a message. |
| | | 9 | | public event Action<Message> OnReceived; |
| | | 10 | | |
| | 54 | 11 | | public CommsNode(Configs.AgentType endpointType) { |
| | 27 | 12 | | EndpointType = endpointType; |
| | 27 | 13 | | } |
| | | 14 | | |
| | 0 | 15 | | public void Receive(Message message) { |
| | 0 | 16 | | OnReceived?.Invoke(message); |
| | 0 | 17 | | } |
| | | 18 | | } |