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.

110 lines
2.8 KiB

using EC.App.Core;
using EC.App.ThatBLL.Onvif.Impl;
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 PTZController : ApiController
{
private readonly IPTZBLL _ptzBLL;
/// <summary>
///
/// </summary>
/// <param name="ptzBLL"></param>
public PTZController(IPTZBLL ptzBLL)
{
this._ptzBLL = ptzBLL;
}
#region Operate
/// <summary>
/// 是否连接
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
[HttpGet]
public bool IsConnected(
[Required][DataValidation(ValidationTypes.IPv4)] string ip)
{
bool ret = _ptzBLL.IsConnected(ip);
return ret;
}
#endregion Operate
#region Move
/// <summary>
/// 绝对移动
/// </summary>
/// <param name="ip">IP地址</param>
/// <param name="pan">水平方向移动绝对点</param>
/// <param name="tilt">垂直方向移动绝对点</param>
/// <param name="zoom">变焦绝对点</param>
/// <returns></returns>
[HttpGet]
public async Task<bool> AbsoluteMove(
[DataValidation(ValidationTypes.IPv4)] string ip,
[Required] float pan, [Required] float tilt, [Required] float zoom)
{
bool ret = await _ptzBLL.AbsoluteMove(ip, pan, tilt, zoom);
return ret;
}
/// <summary>
/// 绝对移动
/// </summary>
/// <param name="ip">IP地址</param>
/// <param name="pan">水平方向移动绝对点</param>
/// <param name="tilt">垂直方向移动绝对点</param>
/// <param name="zoom">变焦绝对点</param>
[HttpGet]
public async Task<bool> RelativeMove(
[DataValidation(ValidationTypes.IPv4)] string ip,
[Required] float pan, [Required] float tilt, [Required] float zoom)
{
bool ret = await _ptzBLL.RelativeMove(ip, pan, tilt, zoom);
return ret;
}
/// <summary>
/// 持续移动
/// </summary>
/// <param name="ip">IP地址</param>
/// <param name="pan">水平方向移动绝对点</param>
/// <param name="tilt">垂直方向移动绝对点</param>
/// <param name="zoom">变焦绝对点</param>
[HttpGet]
public async Task<bool> ContinuousMove(
[DataValidation(ValidationTypes.IPv4)] string ip,
[Required] float pan, [Required] float tilt, [Required] float zoom)
{
bool ret = await _ptzBLL.ContinuousMove(ip, pan, tilt, zoom);
return ret;
}
/// <summary>
/// 停止移动
/// </summary>
/// <param name="ip">IP地址</param>
[HttpGet]
public async Task<bool> StopMove(
[Required][DataValidation(ValidationTypes.IPv4)] string ip)
{
bool ret = await _ptzBLL.StopMove(ip);
return ret;
}
#endregion Move
}
}