diff --git a/Step.Config/serverConfig.xml b/Step.Config/serverConfig.xml index f951184c..8386e2b4 100644 --- a/Step.Config/serverConfig.xml +++ b/Step.Config/serverConfig.xml @@ -44,7 +44,7 @@ false - false + true true true diff --git a/Step.NC/NcHandler.cs b/Step.NC/NcHandler.cs index 0392734e..9da583c5 100644 --- a/Step.NC/NcHandler.cs +++ b/Step.NC/NcHandler.cs @@ -26,6 +26,11 @@ namespace Step.NC numericalControl = SetNumericalControl(); } + public void Dispose() + { + numericalControl.NC_Disconnect(); + } + public CmsError Connect() { // Connect NC @@ -271,9 +276,11 @@ namespace Step.NC return cmsError; } - public void Dispose() + public CmsError PutPowerOnData(uint id) { - numericalControl.NC_Disconnect(); + CmsError cmsError = numericalControl.Nc_WPowerOnData(id, true); + + return cmsError; } } } diff --git a/Step/Controllers/SignalR/NcHub.cs b/Step/Controllers/SignalR/NcHub.cs index 435ef4c9..458b3076 100644 --- a/Step/Controllers/SignalR/NcHub.cs +++ b/Step/Controllers/SignalR/NcHub.cs @@ -4,13 +4,10 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.AspNet.SignalR; -using Step.Attributes; -using static Step.Utils.Constants; +using Step.NC; namespace Step.Controllers.SignalR { - [SignalRAuthorize(FunctionAccess = "functionAccess", Action = ACTIONS.READ)] - public class NcHub : Hub { public static List ConnectedClients = new List(); @@ -40,5 +37,14 @@ namespace Step.Controllers.SignalR return base.OnDisconnected(stopCalled); } + + public void PutPowerOnData(uint id) + { + using (NcHandler ncHandler = new NcHandler()) + { + ncHandler.Connect(); + ncHandler.PutPowerOnData(id); + } + } } }