fix chiamata temperatura (1 punto alla volta)
This commit is contained in:
@@ -6,15 +6,6 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Thermo.Active.Model.DTOModels.ThWarmers
|
||||
{
|
||||
public class PointReq
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public List<ThermoPointFlir> List { get; set; } = new List<ThermoPointFlir>();
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
public class ThermoPoint
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
@@ -13,60 +13,13 @@ using static Thermo.Active.Model.Constants;
|
||||
|
||||
namespace Thermo.Active.Controllers.WebApi
|
||||
{
|
||||
// FIXME TODO ELIMINARE CLASSE!!!
|
||||
|
||||
[RoutePrefix("api/thermocamera")]
|
||||
public class ThermocameraController : ApiController
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto adapter condiviso da WebAPI
|
||||
/// </summary>
|
||||
protected static NcAdapter ncAdapter = new NcAdapter();
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Public Methods
|
||||
|
||||
[ResponseType(typeof(PointReq))]
|
||||
[Route("getTemperatures"), HttpGet]
|
||||
public IHttpActionResult GetTempAtPoints(PointReq pointRequest)
|
||||
{
|
||||
// Try connection
|
||||
CmsError libraryError = ncAdapter.Connect();
|
||||
if (libraryError.IsError())
|
||||
{
|
||||
ThermoActiveLogger.LogError($"NC Not connected! | GetTempAtPoints | {libraryError.exception}");
|
||||
return BadRequest(libraryError.localizationKey);
|
||||
}
|
||||
|
||||
PointReq results = new PointReq();
|
||||
// fake: genero casualmenteEsegui
|
||||
Random rnd = new Random();
|
||||
int numval = pointRequest != null && pointRequest.List != null && pointRequest.List.Count > 0 ? pointRequest.List.Count : 10;
|
||||
for (int i = 0; i < numval; i++)
|
||||
{
|
||||
ThermoPointFlir newVal = new ThermoPointFlir()
|
||||
{
|
||||
X = rnd.Next(0, 1500),
|
||||
Y = rnd.Next(0, 1200),
|
||||
Temperature = ((float)rnd.Next(100, 2000)) / 10
|
||||
};
|
||||
results.List.Add(newVal);
|
||||
}
|
||||
#if false
|
||||
// leggo dati gauges
|
||||
libraryError = ncAdapter.ReadValIO(out DTOChannelsIOVal ChannelsIOVal);
|
||||
if (libraryError.IsError())
|
||||
{
|
||||
ThermoActiveLogger.LogError($"GetChannelsIoVal error | {libraryError.exception}");
|
||||
return BadRequest(libraryError.localizationKey);
|
||||
}
|
||||
#endif
|
||||
|
||||
// ritorno!
|
||||
return Ok(results);
|
||||
}
|
||||
|
||||
[Route("show"), HttpPost]
|
||||
public IHttpActionResult showCamera()
|
||||
{
|
||||
|
||||
@@ -322,9 +322,9 @@ namespace Thermo.Active.Controllers.WebApi
|
||||
return Ok(currWarmers);
|
||||
}
|
||||
|
||||
[ResponseType(typeof(PointReq))]
|
||||
[Route("getTemperatures"), HttpGet]
|
||||
public IHttpActionResult GetTempAtPoints(PointReq pointRequest)
|
||||
[ResponseType(typeof(ThermoPointFlir))]
|
||||
[Route("getTempAtPoint"), HttpGet]
|
||||
public IHttpActionResult GetTempAtPoint(int posX, int posY)
|
||||
{
|
||||
// Try connection
|
||||
CmsError libraryError = ncAdapter.Connect();
|
||||
@@ -334,20 +334,15 @@ namespace Thermo.Active.Controllers.WebApi
|
||||
return BadRequest(libraryError.localizationKey);
|
||||
}
|
||||
|
||||
PointReq results = new PointReq();
|
||||
// fake: genero casualmenteEsegui
|
||||
Random rnd = new Random();
|
||||
int numval = pointRequest != null && pointRequest.List != null && pointRequest.List.Count > 0 ? pointRequest.List.Count : 10;
|
||||
for (int i = 0; i < numval; i++)
|
||||
ThermoPointFlir result = new ThermoPointFlir()
|
||||
{
|
||||
ThermoPointFlir newVal = new ThermoPointFlir()
|
||||
{
|
||||
X = rnd.Next(0, 1500),
|
||||
Y = rnd.Next(0, 1200),
|
||||
Temperature = ((float)rnd.Next(100, 2000)) / 10
|
||||
};
|
||||
results.List.Add(newVal);
|
||||
}
|
||||
X = posX,
|
||||
Y = posY,
|
||||
Temperature = ((float)rnd.Next(100, 2000)) / 10
|
||||
};
|
||||
|
||||
#if false
|
||||
// leggo dati gauges
|
||||
libraryError = ncAdapter.ReadValIO(out DTOChannelsIOVal ChannelsIOVal);
|
||||
@@ -357,9 +352,8 @@ namespace Thermo.Active.Controllers.WebApi
|
||||
return BadRequest(libraryError.localizationKey);
|
||||
}
|
||||
#endif
|
||||
|
||||
// ritorno!
|
||||
return Ok(results);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user