diff --git a/Step.Model/DTOModels/DTOAlarmsModel.cs b/Step.Model/DTOModels/DTOAlarmsModel.cs index a64a9150..7bc6f2dc 100644 --- a/Step.Model/DTOModels/DTOAlarmsModel.cs +++ b/Step.Model/DTOModels/DTOAlarmsModel.cs @@ -164,4 +164,10 @@ namespace Step.Model.DTOModels return base.GetHashCode(); } } + + public class DTOAlarmConfigModel + { + public int Id; + public bool RestoreIsEnabled; + } } \ No newline at end of file diff --git a/Step/Controllers/WebApi/ConfigurationController.cs b/Step/Controllers/WebApi/ConfigurationController.cs index 03bdaec9..1a3d518c 100644 --- a/Step/Controllers/WebApi/ConfigurationController.cs +++ b/Step/Controllers/WebApi/ConfigurationController.cs @@ -1,5 +1,4 @@ -using Step.Model.ConfigModels; -using Step.Model.DTOModels; +using Step.Model.DTOModels; using System.Collections.Generic; using System.Linq; using System.Web.Http; @@ -43,7 +42,6 @@ namespace Step.Controllers.WebApi return Ok(clientConfiguration); } - [Route("nc_softKeys"), HttpGet] public IHttpActionResult GetNcSoftKeysConfig() { @@ -60,7 +58,7 @@ namespace Step.Controllers.WebApi if (!output.ContainsKey(softKey.Category)) { // Add category if not exits - output.Add(softKey.Category, new List< DTOUserSoftKeyConfigModel>()); + output.Add(softKey.Category, new List()); } // Create subkeys dictionary for group @@ -82,14 +80,13 @@ namespace Step.Controllers.WebApi Type = softKey.Type, SubKeys = tmpSubKey }); - } return Ok(output); } [Route("heads"), HttpGet] - public IHttpActionResult GetHeadConfig() + public IHttpActionResult GetHeadsConfig() { List heads = HeadsConfig.Select(x => new DTOHeadsConfigModel() { @@ -101,5 +98,28 @@ namespace Step.Controllers.WebApi return Ok(heads); } + [Route("alarms"), HttpGet] + public IHttpActionResult GetAlarmsConfig() + { + List alarmsConfig = new List(); + bool restoreIsEnabled = false; + for (int i = 1; i <= 1024; i++) + { + var configuredAlarm = InitialAlarmsConfig.Where(x => x.PlcId == i).FirstOrDefault(); + + if (configuredAlarm == null) + restoreIsEnabled = false; + else + restoreIsEnabled = configuredAlarm.RestoreIsActive; + + alarmsConfig.Add(new DTOAlarmConfigModel + { + Id = i, + RestoreIsEnabled = restoreIsEnabled + }); + } + + return Ok(alarmsConfig); + } } } \ No newline at end of file