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.

56 lines
1.5 KiB

3 years ago
using EC.App.ThatBLL.Onvif.Intf;
using EC.App.ThatService.Onvif;
3 years ago
using EC.Onvif;
using System.Threading.Tasks;
3 years ago
namespace EC.App.ThatBLL.Onvif
3 years ago
{
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;
3 years ago
await onvifClient.AbsoluteMove(pan, tilt, zoom);
3 years ago
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;
3 years ago
await onvifClient.RelativeMove(pan, tilt, zoom);
3 years ago
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;
3 years ago
await onvifClient.ContinuousMove(pan, tilt, zoom);
3 years ago
return true;
}
public async Task<bool> StopMove(string ip)
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
if (!flag) return false;
3 years ago
await onvifClient.StopMove();
3 years ago
return true;
}
}
}