using EC.App.Core;
using EC.App.ThatBLL.Onvif;
using Furion.DataValidation;
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
namespace OnvifWebServer.Controllers.Onvif
{
///
/// Onvif 成像参数控制
///
[Route("onvif/[controller]")]
[ApiDescriptionSettings("Onvif")]
public class ImagingController : ApiController
{
private readonly IImagingBLL _imagingBLL;
///
///
///
///
public ImagingController(IImagingBLL imagingBLL)
{
this._imagingBLL = imagingBLL;
}
///
/// 是否连接
///
///
///
[HttpGet]
public bool IsConnected(
[Required][DataValidation(ValidationTypes.IPv4)] string ip)
{
bool ret = _imagingBLL.IsConnected(ip);
return ret;
}
///
/// 变焦绝对移动
///
///
///
///
[HttpPost]
public async Task FocusAbsoluteMove(
[Required][DataValidation(ValidationTypes.IPv4)] string ip,
[Required] float position)
{
bool ret = await _imagingBLL.FocusAbsoluteMove(ip, position);
return ret;
}
///
/// 变焦相对移动
///
///
///
///
[HttpPost]
public async Task FocusRelativeMove(
[Required][DataValidation(ValidationTypes.IPv4)] string ip,
[Required] float distance)
{
bool ret = await _imagingBLL.FocusRelativeMove(ip, distance);
return ret;
}
///
/// 变焦持续移动
///
///
///
///
[HttpPost]
public async Task FocusContinuousMove(
[Required][DataValidation(ValidationTypes.IPv4)] string ip,
[Required] float speed)
{
bool ret = await _imagingBLL.FocusContinuousMove(ip, speed);
return ret;
}
///
/// 停止变焦
///
/// IP地址
[HttpPost]
public async Task FocusStopMove(
[Required][DataValidation(ValidationTypes.IPv4)] string ip)
{
bool ret = await _imagingBLL.FocusStopMove(ip);
return ret;
}
}
}