Initial commit
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user