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
{
///
/// Onvif 移动参数控制
///
[ApiController]
[ApiDescriptionSettings("Onvif")]
[Route("onvif/[controller]")]
public class PTZController : ApiController
{
private readonly IPTZBLL _ptzBLL;
///
///
///
///
public PTZController(IPTZBLL ptzBLL)
{
this._ptzBLL = ptzBLL;
}
///
/// 是否连接
///
///
///
[HttpGet]
public bool IsConnected(
[Required][DataValidation(ValidationTypes.IPv4)] string ip)
{
bool ret = _ptzBLL.IsConnected(ip);
return ret;
}
///
/// 绝对移动
///
/// IP地址
/// 水平方向移动绝对点[-1,1]
/// 垂直方向移动绝对点[-1,1]
/// 变倍绝对点[-1,1]
///
[HttpPost]
public async Task AbsoluteMove(
[FromForm][Required][DataValidation(ValidationTypes.IPv4)] string ip,
[FromForm][Required] float pan, [FromForm][Required] float tilt, [FromForm][Required] float zoom)
{
bool ret = await _ptzBLL.AbsoluteMove(ip, pan, tilt, zoom);
return ret;
}
///
/// 相对移动
///
/// IP地址
/// 水平方向移动相对点[-1,1]
/// 垂直方向移动相对点[-1,1]
/// 变倍相对点[-1,1]
[HttpPost]
public async Task RelativeMove(
[FromForm][Required][DataValidation(ValidationTypes.IPv4)] string ip,
[FromForm][Required] float pan, [FromForm][Required] float tilt, [FromForm][Required] float zoom)
{
bool ret = await _ptzBLL.RelativeMove(ip, pan, tilt, zoom);
return ret;
}
///
/// 持续移动
///
/// IP地址
/// 水平方向移动速度[-1,1]
/// 垂直方向移动速度[-1,1]
/// 变倍移动速度[-1,1]
[HttpPost]
public async Task ContinuousMove(
[FromForm][Required][DataValidation(ValidationTypes.IPv4)] string ip,
[FromForm][Required] float pan, [FromForm][Required] float tilt, [FromForm][Required] float zoom)
{
bool ret = await _ptzBLL.ContinuousMove(ip, pan, tilt, zoom);
return ret;
}
///
/// 停止移动
///
/// IP地址
[HttpPost]
public async Task StopMove(
[FromForm][Required][DataValidation(ValidationTypes.IPv4)] string ip)
{
bool ret = await _ptzBLL.StopMove(ip);
return ret;
}
}
}