You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
2.3 KiB

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
{
/// <summary>
/// Onvif 成像参数控制
/// </summary>
[Route("onvif/[controller]")]
[ApiDescriptionSettings("Onvif")]
public class ImagingController : ApiController
{
private readonly IImagingBLL _imagingBLL;
/// <summary>
///
/// </summary>
/// <param name="imagingBLL"></param>
public ImagingController(IImagingBLL imagingBLL)
{
this._imagingBLL = imagingBLL;
}
/// <summary>
/// 是否连接
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
[HttpGet]
public bool IsConnected(
[Required][DataValidation(ValidationTypes.IPv4)] string ip)
{
bool ret = _imagingBLL.IsConnected(ip);
return ret;
}
/// <summary>
/// 变焦绝对移动
/// </summary>
/// <param name="ip"></param>
/// <param name="position"></param>
/// <returns></returns>
[HttpPost]
public async Task<bool> FocusAbsoluteMove(
[Required][DataValidation(ValidationTypes.IPv4)] string ip,
[Required] float position)
{
bool ret = await _imagingBLL.FocusAbsoluteMove(ip, position);
return ret;
}
/// <summary>
/// 变焦相对移动
/// </summary>
/// <param name="ip"></param>
/// <param name="distance"></param>
/// <returns></returns>
[HttpPost]
public async Task<bool> FocusRelativeMove(
[Required][DataValidation(ValidationTypes.IPv4)] string ip,
[Required] float distance)
{
bool ret = await _imagingBLL.FocusRelativeMove(ip, distance);
return ret;
}
/// <summary>
/// 变焦持续移动
/// </summary>
/// <param name="ip"></param>
/// <param name="speed"></param>
/// <returns></returns>
[HttpPost]
public async Task<bool> FocusContinuousMove(
[Required][DataValidation(ValidationTypes.IPv4)] string ip,
[Required] float speed)
{
bool ret = await _imagingBLL.FocusContinuousMove(ip, speed);
return ret;
}
/// <summary>
/// 停止变焦
/// </summary>
/// <param name="ip">IP地址</param>
[HttpPost]
public async Task<bool> FocusStopMove(
[Required][DataValidation(ValidationTypes.IPv4)] string ip)
{
bool ret = await _imagingBLL.FocusStopMove(ip);
return ret;
}
}
}