Initial commit

This commit is contained in:
2026-07-03 16:37:12 +07:00
commit 63b8c1ea8b
1931 changed files with 640587 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
using RobotNet.VDA5050.Type;
using RobotNet10.RobotApp.Interfaces;
namespace RobotNet10.RobotApp.Services.Robot.Actions;
[RobotAction(ActionType.MUTED_BASE_ON,
[ActionScope.INSTANT, ActionScope.NODE, ActionScope.EDGE],
[BlockingType.NONE, BlockingType.SOFT, BlockingType.HARD],
"Bật chế độ muted base robot.",
"Robot đã bật chế độ muted base.")]
public class RobotMutedBaseOnAction(IServiceProvider ServiceProvider) : RobotAction(ServiceProvider)
{
private IPlcController? PlcController;
private const int MAX_TIMEOUT = 4000;
private int CountTimeout = 0;
protected override Task StartAction()
{
PlcController = ServiceProvider.GetRequiredService<IPlcController>();
PlcController.SetMutedBase(true);
return base.StartAction();
}
protected override Task ExecuteAction()
{
if(PlcController is not null && PlcController.MutedBase)
{
SetStatus(ActionEvent.FINISHED);
ResultDescription = string.IsNullOrEmpty(ActionAttribute.ResultDescription) ? ResultDescription : ActionAttribute.ResultDescription;
}
else if (CountTimeout++ > MAX_TIMEOUT / ActionInterval)
{
SetStatus(ActionEvent.FAILED);
ResultDescription = "Timeout action";
}
return base.ExecuteAction();
}
}