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.

103 lines
2.9 KiB

3 years ago
using EC.App.Core;
3 years ago
using EC.App.ThatBLL.Onvif.Intf;
3 years ago
using Furion.DataValidation;
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
namespace OnvifWebServer.Controllers.Onvif
{
/// <summary>
/// Onvif 移动参数控制
/// </summary>
[ApiController]
3 years ago
[ApiDescriptionSettings("Onvif")]
[Route("onvif/[controller]")]
3 years ago
public class PTZController : ApiController
{
private readonly IPTZBLL _ptzBLL;
/// <summary>
///
/// </summary>
/// <param name="ptzBLL"></param>
public PTZController(IPTZBLL ptzBLL)
{
this._ptzBLL = ptzBLL;
}
/// <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;
}
/// <summary>
/// 绝对移动
/// </summary>
/// <param name="ip">IP地址</param>
3 years ago
/// <param name="pan">水平方向移动绝对点[-1,1]</param>
/// <param name="tilt">垂直方向移动绝对点[-1,1]</param>
/// <param name="zoom">变倍绝对点[-1,1]</param>
3 years ago
/// <returns></returns>
3 years ago
[HttpPost]
3 years ago
public async Task<bool> AbsoluteMove(
[FromForm][Required][DataValidation(ValidationTypes.IPv4)] string ip,
[FromForm][Required] float pan, [FromForm][Required] float tilt, [FromForm][Required] float zoom)
3 years ago
{
bool ret = await _ptzBLL.AbsoluteMove(ip, pan, tilt, zoom);
return ret;
}
/// <summary>
3 years ago
/// 相对移动
3 years ago
/// </summary>
/// <param name="ip">IP地址</param>
3 years ago
/// <param name="pan">水平方向移动相对点[-1,1]</param>
/// <param name="tilt">垂直方向移动相对点[-1,1]</param>
/// <param name="zoom">变倍相对点[-1,1]</param>
[HttpPost]
3 years ago
public async Task<bool> RelativeMove(
[FromForm][Required][DataValidation(ValidationTypes.IPv4)] string ip,
[FromForm][Required] float pan, [FromForm][Required] float tilt, [FromForm][Required] float zoom)
3 years ago
{
bool ret = await _ptzBLL.RelativeMove(ip, pan, tilt, zoom);
return ret;
}
/// <summary>
/// 持续移动
/// </summary>
/// <param name="ip">IP地址</param>
3 years ago
/// <param name="pan">水平方向移动速度[-1,1]</param>
/// <param name="tilt">垂直方向移动速度[-1,1]</param>
/// <param name="zoom">变倍移动速度[-1,1]</param>
[HttpPost]
3 years ago
public async Task<bool> ContinuousMove(
[FromForm][Required][DataValidation(ValidationTypes.IPv4)] string ip,
[FromForm][Required] float pan, [FromForm][Required] float tilt, [FromForm][Required] float zoom)
3 years ago
{
bool ret = await _ptzBLL.ContinuousMove(ip, pan, tilt, zoom);
return ret;
}
/// <summary>
/// 停止移动
/// </summary>
/// <param name="ip">IP地址</param>
3 years ago
[HttpPost]
3 years ago
public async Task<bool> StopMove(
[FromForm][Required][DataValidation(ValidationTypes.IPv4)] string ip)
3 years ago
{
bool ret = await _ptzBLL.StopMove(ip);
return ret;
}
}
}