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.

55 lines
1.4 KiB

using EC.App.ThatService.Onvif.Impl;
using EC.Onvif;
using System.Threading.Tasks;
namespace EC.App.ThatBLL.Onvif.Impl
{
public class PTZBLL : IPTZBLL
{
private readonly OnvifClientService _ocService;
public PTZBLL(OnvifClientService onvifClientService)
{
_ocService = onvifClientService;
}
public bool IsConnected(string ip)
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
bool ret = flag && onvifClient.IsPTZContected();
return ret;
}
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.AbsoluteMove(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.RelativeMove(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.ContinuousMove(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.StopMove();
return true;
}
}
}