Files
I150/srcs/RobotNet10/RobotApp/RobotNet10.RobotApp/Services/Robot/RobotFactsheet.cs
2026-07-03 16:37:12 +07:00

35 lines
1.1 KiB
C#

using RobotNet.VDA5050;
using RobotNet.VDA5050.Factsheet;
using RobotNet.VDA5050.Type;
using RobotNet10.RobotApp.Interfaces;
using RobotNet10.RobotApp.Services.ConfigManager;
using RobotNet10.RobotApp.Services.Robot.Connection;
namespace RobotNet10.RobotApp.Services.Robot;
public class RobotFactsheet(IConnectionConfig ConnectionConfig,
IRobotConnectionsService RobotConnection,
Logger<RobotFactsheet> Logger) : IFactsheet
{
public async Task PubFactsheet()
{
try
{
if (!RobotConnection.IsConnected) return;
var vdaConfig = ConnectionConfig.GetVDA5050Config();
FactSheetMsg factSheet = new()
{
SerialNumber = vdaConfig.SerialNumber,
Manufacturer = vdaConfig.Manufacturer,
Version = vdaConfig.Version,
};
await RobotConnection.PublishFactsheetAsync(factSheet);
}
catch (Exception ex)
{
Logger.Error($"Error publishing factsheet: {ex.Message}");
}
}
}