using EC.App.ThatBLL.Onvif.Intf; using EC.App.ThatService.Onvif; 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; } public bool IsConnected(string ip) { bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient); bool ret = flag && onvifClient.IsPTZContected(); return ret; } public async Task 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 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 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 StopMove(string ip) { bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient); if (!flag) return false; await onvifClient.StopMove(); return true; } } }