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 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 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 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 StopMove(string ip) { bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient); if (!flag) return false; await onvifClient.StopMoveAsync(); return true; } #endregion Move } }