Added alarms configuration API
This commit is contained in:
@@ -164,4 +164,10 @@ namespace Step.Model.DTOModels
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
public class DTOAlarmConfigModel
|
||||
{
|
||||
public int Id;
|
||||
public bool RestoreIsEnabled;
|
||||
}
|
||||
}
|
||||
@@ -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<DTOUserSoftKeyConfigModel>());
|
||||
}
|
||||
|
||||
// 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<DTOHeadsConfigModel> heads = HeadsConfig.Select(x => new DTOHeadsConfigModel()
|
||||
{
|
||||
@@ -101,5 +98,28 @@ namespace Step.Controllers.WebApi
|
||||
return Ok(heads);
|
||||
}
|
||||
|
||||
[Route("alarms"), HttpGet]
|
||||
public IHttpActionResult GetAlarmsConfig()
|
||||
{
|
||||
List<DTOAlarmConfigModel> alarmsConfig = new List<DTOAlarmConfigModel>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user