35 lines
1.1 KiB
C#
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}");
|
|
}
|
|
}
|
|
}
|