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
99 lines
2.4 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>
|
|
[ApiController]
|
|
[ApiDescriptionSettings("Onvif")]
|
|
[Route("onvif/[controller]")]
|
|
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(
|
|
[FromForm][Required][DataValidation(ValidationTypes.IPv4)] string ip,
|
|
[FromForm][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(
|
|
[FromForm][Required][DataValidation(ValidationTypes.IPv4)] string ip,
|
|
[FromForm][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(
|
|
[FromForm][Required][DataValidation(ValidationTypes.IPv4)] string ip,
|
|
[FromForm][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(
|
|
[FromForm][Required][DataValidation(ValidationTypes.IPv4)] string ip)
|
|
{
|
|
bool ret = await _imagingBLL.FocusStopMove(ip);
|
|
return ret;
|
|
}
|
|
}
|
|
}
|