Initial commit

This commit is contained in:
2026-07-03 16:31:37 +07:00
commit 899c7c637d
1939 changed files with 641750 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
using RobotNet.VDA5050.Type;
namespace RobotNet10.FleetManager.Events.Events;
public class ConnectionStateChangedEvent : EventArgs
{
public string RobotId { get; set; } = string.Empty;
public ConnectionState ConnectionState { get; set; }
}

View File

@@ -0,0 +1,9 @@
using RobotNet.VDA5050.Factsheet;
namespace RobotNet10.FleetManager.Events.Events;
public class FactsheetMessageReceivedEvent : EventArgs
{
public string RobotId { get; set; } = string.Empty;
public FactSheetMsg FactsheetMessage { get; set; } = new();
}

View File

@@ -0,0 +1,23 @@
namespace RobotNet10.FleetManager.Events.Events;
/// <summary>
/// Event raised when a Robot's ModelId is changed
/// </summary>
public class RobotModelIdChangedEvent : EventArgs
{
/// <summary>
/// Robot ID whose model was changed
/// </summary>
public string RobotId { get; set; } = string.Empty;
/// <summary>
/// Previous ModelId
/// </summary>
public Guid? PreviousModelId { get; set; }
/// <summary>
/// New ModelId
/// </summary>
public Guid? NewModelId { get; set; }
}

View File

@@ -0,0 +1,18 @@
namespace RobotNet10.FleetManager.Events.Events;
/// <summary>
/// Event raised when a RobotModel is updated
/// </summary>
public class RobotModelUpdatedEvent : EventArgs
{
/// <summary>
/// RobotModel ID that was updated
/// </summary>
public Guid ModelId { get; set; }
/// <summary>
/// List of robot IDs that use this model (for cache invalidation)
/// </summary>
public List<string> AffectedRobotIds { get; set; } = new();
}

View File

@@ -0,0 +1,9 @@
using RobotNet.VDA5050.State;
namespace RobotNet10.FleetManager.Events.Events;
public class StateMessageReceivedEvent : EventArgs
{
public string RobotId { get; set; } = string.Empty;
public StateMsg StateMessage { get; set; } = new();
}

View File

@@ -0,0 +1,9 @@
using RobotNet.VDA5050.Visualization;
namespace RobotNet10.FleetManager.Events.Events;
public class VisualizationMessageReceivedEvent : EventArgs
{
public string RobotId { get; set; } = string.Empty;
public VisualizationMsg VisualizationMessage { get; set; } = new();
}

View File

@@ -0,0 +1,33 @@
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 for VDA5050 robot messages and domain events
/// </summary>
public interface IRobotEventBus
{
// VDA5050 Events
event EventHandler<StateMessageReceivedEvent>? StateMessageReceived;
event EventHandler<ConnectionStateChangedEvent>? ConnectionStateChanged;
event EventHandler<VisualizationMessageReceivedEvent>? VisualizationMessageReceived;
event EventHandler<FactsheetMessageReceivedEvent>? FactsheetMessageReceived;
// Domain Events
event EventHandler<RobotModelUpdatedEvent>? RobotModelUpdated;
event EventHandler<RobotModelIdChangedEvent>? RobotModelIdChanged;
// VDA5050 Event Publishers
void PublishStateMessageReceived(string robotId, StateMsg stateMsg);
void PublishConnectionStateChanged(string robotId, ConnectionState connectionState);
void PublishVisualizationMessageReceived(string robotId, VisualizationMsg visualizationMsg);
void PublishFactsheetMessageReceived(string robotId, FactSheetMsg factsheetMsg);
// Domain Event Publishers
void PublishRobotModelUpdated(RobotModelUpdatedEvent e);
void PublishRobotModelIdChanged(RobotModelIdChangedEvent e);
}

View File

@@ -0,0 +1,52 @@
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);
}
}