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.

64 lines
1.5 KiB

using EC.App.Entity.Onvif;
using EC.App.ThatBLL.Onvif.Impl;
using EC.Onvif;
using System.Threading.Tasks;
namespace EC.App.ThatBLL.Onvif
{
public class PTZBLL : IPTZBLL
{
private readonly OnvifClientService _ocService;
public PTZBLL(OnvifClientService onvifClientService)
{
_ocService = onvifClientService;
}
#region Operate
public bool IsConnected(string ip)
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
bool ret = flag && onvifClient.IsPTZContected();
return ret;
}
#endregion Operate
#region Move
public async Task<bool> AbsoluteMove(string ip, float pan, float tilt, float zoom)
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
if (!flag) return false;
await onvifClient.AbsoluteMoveAsync(pan, tilt, zoom);
return true;
}
public async Task<bool> RelativeMove(string ip, float pan, float tilt, float zoom)
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
if (!flag) return false;
await onvifClient.RelativeMoveAsync(pan, tilt, zoom);
return true;
}
public async Task<bool> ContinuousMove(string ip, float pan, float tilt, float zoom)
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
if (!flag) return false;
await onvifClient.ContinuousMoveAsync(pan, tilt, zoom);
return true;
}
public async Task<bool> StopMove(string ip)
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
if (!flag) return false;
await onvifClient.StopMoveAsync();
return true;
}
#endregion Move
}
}