70 lines
1.7 KiB
C#
70 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNet.SignalR;
|
|
using Step.NC;
|
|
|
|
namespace Step.Controllers.SignalR
|
|
{
|
|
public class NcHub : Hub
|
|
{
|
|
public static List<string> ConnectedClients = new List<string>();
|
|
public static bool NewConnectedClients = false;
|
|
|
|
public override Task OnConnected()
|
|
{
|
|
Groups.Add(Context.ConnectionId, "ncData");
|
|
NewConnectedClients = true;
|
|
ConnectedClients.Add(Context.ConnectionId);
|
|
|
|
return base.OnConnected();
|
|
}
|
|
|
|
public override Task OnReconnected()
|
|
{
|
|
Groups.Add(Context.ConnectionId, "ncData");
|
|
NewConnectedClients = true;
|
|
ConnectedClients.Add(Context.ConnectionId);
|
|
return base.OnReconnected();
|
|
}
|
|
|
|
public override Task OnDisconnected(bool stopCalled)
|
|
{
|
|
Groups.Remove(Context.ConnectionId, "ncData");
|
|
ConnectedClients.Remove(Context.ConnectionId);
|
|
|
|
return base.OnDisconnected(stopCalled);
|
|
}
|
|
|
|
public void PutPowerOnData(uint id)
|
|
{
|
|
using (NcHandler ncHandler = new NcHandler())
|
|
{
|
|
ncHandler.Connect();
|
|
ncHandler.PutPowerOnData(id);
|
|
}
|
|
}
|
|
|
|
public void RefreshAllAlarms()
|
|
{
|
|
using (NcHandler ncHandler = new NcHandler())
|
|
{
|
|
ncHandler.Connect();
|
|
ncHandler.RefreshAllAlarms();
|
|
}
|
|
}
|
|
|
|
public void RefreshAlarm(string id)
|
|
{
|
|
|
|
}
|
|
|
|
public void RecoveryProcedure(string id)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|