|
|
|
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 ImagingBLL : IImagingBLL
|
|
|
|
{
|
|
|
|
private readonly OnvifClientService _ocService;
|
|
|
|
|
|
|
|
public ImagingBLL(OnvifClientService onvifClientService)
|
|
|
|
{
|
|
|
|
_ocService = onvifClientService;
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsConnected(string ip)
|
|
|
|
{
|
|
|
|
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
|
|
|
|
bool ret = flag && onvifClient.IsImagingContected();
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
public async Task<bool> FocusAbsoluteMove(string ip, float position)
|
|
|
|
{
|
|
|
|
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
|
|
|
|
if (!flag) return false;
|
|
|
|
await onvifClient.FocusAbsoluteMove(position);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public async Task<bool> FocusRelativeMove(string ip, float distance)
|
|
|
|
{
|
|
|
|
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
|
|
|
|
if (!flag) return false;
|
|
|
|
await onvifClient.FocusRelativeMove(distance);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public async Task<bool> FocusContinuousMove(string ip, float speed)
|
|
|
|
{
|
|
|
|
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
|
|
|
|
if (!flag) return false;
|
|
|
|
await onvifClient.FocusContinuousMove(speed);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public async Task<bool> FocusStopMove(string ip)
|
|
|
|
{
|
|
|
|
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
|
|
|
|
if (!flag) return false;
|
|
|
|
await onvifClient.FocusStopMove();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|