53 lines
2.1 KiB
C#
53 lines
2.1 KiB
C#
using RobotNet.VDA5050.Factsheet;
|
|
using RobotNet.VDA5050.State;
|
|
using RobotNet.VDA5050.Type;
|
|
using RobotNet.VDA5050.Visualization;
|
|
using RobotNet10.FleetManager.Events.Events;
|
|
|
|
namespace RobotNet10.FleetManager.Events;
|
|
|
|
/// <summary>
|
|
/// In-memory event bus implementation for VDA5050 robot messages
|
|
/// </summary>
|
|
public class RobotEventBus : IRobotEventBus
|
|
{
|
|
public event EventHandler<StateMessageReceivedEvent>? StateMessageReceived;
|
|
public event EventHandler<ConnectionStateChangedEvent>? ConnectionStateChanged;
|
|
public event EventHandler<VisualizationMessageReceivedEvent>? VisualizationMessageReceived;
|
|
public event EventHandler<FactsheetMessageReceivedEvent>? FactsheetMessageReceived;
|
|
|
|
public void PublishStateMessageReceived(string robotId, StateMsg stateMsg)
|
|
{
|
|
StateMessageReceived?.Invoke(this, new StateMessageReceivedEvent { RobotId = robotId, StateMessage = stateMsg });
|
|
}
|
|
|
|
public void PublishConnectionStateChanged(string robotId, ConnectionState connectionState)
|
|
{
|
|
ConnectionStateChanged?.Invoke(this, new ConnectionStateChangedEvent { RobotId = robotId, ConnectionState = connectionState });
|
|
}
|
|
|
|
public void PublishVisualizationMessageReceived(string robotId, VisualizationMsg visualizationMsg)
|
|
{
|
|
VisualizationMessageReceived?.Invoke(this, new VisualizationMessageReceivedEvent { RobotId = robotId, VisualizationMessage = visualizationMsg });
|
|
}
|
|
|
|
public void PublishFactsheetMessageReceived(string robotId, FactSheetMsg factsheetMsg)
|
|
{
|
|
FactsheetMessageReceived?.Invoke(this, new FactsheetMessageReceivedEvent { RobotId = robotId, FactsheetMessage = factsheetMsg });
|
|
}
|
|
|
|
// Domain Events
|
|
public event EventHandler<RobotModelUpdatedEvent>? RobotModelUpdated;
|
|
public event EventHandler<RobotModelIdChangedEvent>? RobotModelIdChanged;
|
|
|
|
public void PublishRobotModelUpdated(RobotModelUpdatedEvent e)
|
|
{
|
|
RobotModelUpdated?.Invoke(this, e);
|
|
}
|
|
|
|
public void PublishRobotModelIdChanged(RobotModelIdChangedEvent e)
|
|
{
|
|
RobotModelIdChanged?.Invoke(this, e);
|
|
}
|
|
}
|