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.

99 lines
2.4 KiB

3 years ago
using EC.App.Core;
3 years ago
using EC.App.ThatBLL.Onvif;
3 years ago
using Furion.DataValidation;
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
3 years ago
using System.Threading.Tasks;
3 years ago
namespace OnvifWebServer.Controllers.Onvif
{
/// <summary>
/// Onvif 成像参数控制
/// </summary>
[ApiController]
3 years ago
[ApiDescriptionSettings("Onvif")]
[Route("onvif/[controller]")]
3 years ago
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;
}
3 years ago
/// <summary>
/// 变焦绝对移动
/// </summary>
/// <param name="ip"></param>
/// <param name="position"></param>
/// <returns></returns>
3 years ago
[HttpPost]
3 years ago
public async Task<bool> FocusAbsoluteMove(
[FromForm][Required][DataValidation(ValidationTypes.IPv4)] string ip,
[FromForm][Required] float position)
3 years ago
{
bool ret = await _imagingBLL.FocusAbsoluteMove(ip, position);
return ret;
}
/// <summary>
/// 变焦相对移动
/// </summary>
/// <param name="ip"></param>
/// <param name="distance"></param>
/// <returns></returns>
3 years ago
[HttpPost]
3 years ago
public async Task<bool> FocusRelativeMove(
[FromForm][Required][DataValidation(ValidationTypes.IPv4)] string ip,
[FromForm][Required] float distance)
3 years ago
{
bool ret = await _imagingBLL.FocusRelativeMove(ip, distance);
return ret;
}
/// <summary>
/// 变焦持续移动
/// </summary>
/// <param name="ip"></param>
/// <param name="speed"></param>
/// <returns></returns>
3 years ago
[HttpPost]
3 years ago
public async Task<bool> FocusContinuousMove(
[FromForm][Required][DataValidation(ValidationTypes.IPv4)] string ip,
[FromForm][Required] float speed)
3 years ago
{
bool ret = await _imagingBLL.FocusContinuousMove(ip, speed);
return ret;
}
/// <summary>
/// 停止变焦
/// </summary>
/// <param name="ip">IP地址</param>
3 years ago
[HttpPost]
3 years ago
public async Task<bool> FocusStopMove(
[FromForm][Required][DataValidation(ValidationTypes.IPv4)] string ip)
3 years ago
{
bool ret = await _imagingBLL.FocusStopMove(ip);
return ret;
}
3 years ago
}
}