46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.SignalR;
|
|
using RobotNet10.RobotApp.Services.NavigationMonitor;
|
|
using RobotNet10.RobotApp.Shared.NavigationMonitor;
|
|
|
|
namespace RobotNet10.RobotApp.Hubs;
|
|
|
|
[Authorize]
|
|
public class NavigationMonitorHub(NavigationMonitorService monitorService) : Hub
|
|
{
|
|
public async Task Subscribe()
|
|
{
|
|
await Groups.AddToGroupAsync(Context.ConnectionId, "monitor");
|
|
}
|
|
|
|
public async Task Unsubscribe()
|
|
{
|
|
await Groups.RemoveFromGroupAsync(Context.ConnectionId, "monitor");
|
|
}
|
|
|
|
public void SetTelemetryEnabled(bool enabled)
|
|
{
|
|
monitorService.SetTelemetryEnabled(enabled);
|
|
}
|
|
|
|
public void SetSafetyStopEnabled(bool enabled)
|
|
{
|
|
monitorService.SetSafetyStopEnabled(enabled);
|
|
}
|
|
|
|
public void UpdateSafetyConfig(NavigationSafetyConfigDto config)
|
|
{
|
|
monitorService.UpdateSafetyConfig(config);
|
|
}
|
|
|
|
public void ReleaseSafetyStop()
|
|
{
|
|
monitorService.ReleaseSafetyStop();
|
|
}
|
|
|
|
public NavigationMonitorStateDto GetState()
|
|
{
|
|
return monitorService.GetState();
|
|
}
|
|
}
|