forked from fajiao/OnvifServer-CSharp
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.
39 lines
961 B
39 lines
961 B
3 years ago
|
using EC.App.ThatService.Onvif.Impl;
|
||
|
using EC.Onvif;
|
||
|
using System.Threading.Tasks;
|
||
|
|
||
|
namespace EC.App.ThatBLL.Onvif.Impl
|
||
|
{
|
||
|
public class MediaBLL : IMediaBLL
|
||
|
{
|
||
|
private readonly OnvifClientService _ocService;
|
||
|
|
||
|
public MediaBLL(OnvifClientService onvifClientService)
|
||
|
{
|
||
|
_ocService = onvifClientService;
|
||
|
}
|
||
|
|
||
|
public bool IsConnected(string ip)
|
||
|
{
|
||
|
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
|
||
|
bool ret = flag && onvifClient.IsMediaContected();
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
public async Task<string> GetStreamUri(string ip)
|
||
|
{
|
||
|
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
|
||
|
if (!flag) return string.Empty;
|
||
|
string uri = await onvifClient.GetStreamUri();
|
||
|
return uri;
|
||
|
}
|
||
|
|
||
|
public async Task<string> GetSnapshotUri(string ip)
|
||
|
{
|
||
|
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
|
||
|
if (!flag) return string.Empty;
|
||
|
string uri = await onvifClient.GetSnapshotUri();
|
||
|
return uri;
|
||
|
}
|
||
|
}
|
||
|
}
|