API_SequentMicrosystems-RPI/Controllers/RTDDataAcquisitionControlle...

122 lines
4.0 KiB
C#
Raw Normal View History

2023-11-25 08:24:04 +00:00
using API_SequentMicrosystems.Services;
using Microsoft.AspNetCore.Mvc;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace API_SequentMicrosystems.Controllers
{
2023-11-30 15:46:33 +00:00
[Tags("RTD-8 Temperature Module")]
2023-11-30 15:46:33 +00:00
[Route("api/RTDDA")]
2023-11-25 08:24:04 +00:00
[ApiController]
public class RTDDataAcquisitionController : ControllerBase
{
private RTDDAService _RTDDAservice;
public RTDDataAcquisitionController(RTDDAService serv)
{
_RTDDAservice = serv;
}
// GET: api/<RTDDataAcquisitionController>
/// <summary>
2023-11-30 16:09:08 +00:00
/// Read data from all configured RTD cards
2023-11-25 08:24:04 +00:00
/// </summary>
2023-11-30 16:09:08 +00:00
/// <returns>SortedList with data from configured RTD-8 Cards</returns>
2023-11-25 08:24:04 +00:00
[HttpGet]
public SortedList<byte, float[]> Get()
{
return _RTDDAservice.ReadAllConfiguredCard();
}
// GET api/<RTDDataAcquisitionController>/All
/// <summary>
/// Read data from All RTD cards
/// </summary>
2023-11-30 16:09:08 +00:00
/// <returns>SortedList with data from all conected RTD-8 cards</returns>
2023-11-25 08:24:04 +00:00
[HttpGet("All")]
public SortedList<byte, float[]> GetAll()
{
return _RTDDAservice.ReadAllCard();
}
// GET api/<RTDDataAcquisitionController>/5
/// <summary>
2023-11-30 16:09:08 +00:00
/// Read data from specified by card id
2023-11-25 08:24:04 +00:00
/// </summary>
2023-11-30 16:09:08 +00:00
/// <param name="stack">0-7</param>
/// <returns>Array with data from specified card</returns>
2023-11-25 08:24:04 +00:00
[HttpGet("{stack}")]
public float[] GetAll(byte stack)
{
return _RTDDAservice.ReadCard(stack);
}
//GET api/RTDDA/Names
/// <summary>
/// Get Configured Names of Chanels
/// </summary>
2023-11-30 16:09:08 +00:00
/// <returns>Sorted List of configured Names responded with data by Ids of SortedList and array</returns>
2023-11-25 08:24:04 +00:00
[HttpGet("Names")]
public SortedList<byte, string[]> GetNames()
{
return _RTDDAservice.GetChanelsNames();
}
// POST api/<RTDDataAcquisitionController>
/// <summary>
/// Post configured names of chanels
/// </summary>
2023-11-30 16:09:08 +00:00
/// <param name="data">Sorted List of configured Names responded with data by Ids of SortedList and array</param>
2023-11-25 08:24:04 +00:00
[HttpPost("Names")]
public void PostNames([FromBody] SortedList<byte, string[]> data)
{
_RTDDAservice.SetChanelsNames(data);
}
//GET api/RTDDA/Names/Preconfigured
/// <summary>
2023-11-30 15:46:33 +00:00
/// Get preconfigured Names
2023-11-25 08:24:04 +00:00
/// </summary>
2023-11-30 16:09:08 +00:00
/// <returns>List of preconfigured names</returns>
2023-11-25 08:24:04 +00:00
[HttpGet("Names/Preconfigured")]
public List<string> GetNamesPreconfigured()
{
return _RTDDAservice.GetPreconfiguratedChanelsNames();
}
//POST api/RTDDA/Names/Preconfigured
/// <summary>
2023-11-30 15:46:33 +00:00
/// Post preconfigured names
2023-11-25 08:24:04 +00:00
/// </summary>
2023-11-30 16:09:08 +00:00
/// <param name="data">List of preconfigured names</param>
2023-11-25 08:24:04 +00:00
[HttpPost("Names/Preconfigured")]
public void PostNamesPreconfigured([FromBody] List<string> data)
{
_RTDDAservice.SetPreconfiguratedChanelsNames(data);
}
//GET api/RTDDA/Calibration
/// <summary>
/// Get Calibration data
/// </summary>
2023-11-30 16:09:08 +00:00
/// <returns>Sorted List of calibration data responded with data by Ids of SortedList and array</returns>
[HttpGet("Calibration")]
public SortedList<byte, float[]> GetCalibration()
{
return _RTDDAservice.GetCalibrationData();
}
//POST api/RTDDA/Calibration
2023-11-30 15:46:33 +00:00
/// <summary>
/// Post Calibration data
/// </summary>
2023-11-30 16:09:08 +00:00
/// <param name="data">Sorted List of calibration data responded with data by Ids of SortedList and array</param>
[HttpPost("Calibration")]
public void PostCalibration([FromBody] SortedList<byte, float[]> data)
{
_RTDDAservice.SetCalibrationData(data);
}
2023-11-25 08:24:04 +00:00
}
}