|
@ -1,6 +1,7 @@ |
|
|
using Cis.Application.Cb; |
|
|
using Cis.Application.Cb; |
|
|
using Cis.Application.Cm; |
|
|
using Cis.Application.Cm; |
|
|
using Cis.Application.Tb; |
|
|
using Cis.Application.Tb; |
|
|
|
|
|
using Microsoft.Extensions.Logging; |
|
|
using System.Collections.Concurrent; |
|
|
using System.Collections.Concurrent; |
|
|
|
|
|
|
|
|
namespace Cis.Application.Core; |
|
|
namespace Cis.Application.Core; |
|
@ -13,7 +14,7 @@ public class CameraDataCenter |
|
|
private readonly SqlSugarRepository<CmMarkLabel> _cmMarkLableRep; |
|
|
private readonly SqlSugarRepository<CmMarkLabel> _cmMarkLableRep; |
|
|
private readonly SqlSugarRepository<TbPtzCamera> _tbPtzCameraRep; |
|
|
private readonly SqlSugarRepository<TbPtzCamera> _tbPtzCameraRep; |
|
|
private readonly PtzServerApi _ptzServerApi; |
|
|
private readonly PtzServerApi _ptzServerApi; |
|
|
private readonly CameraDataOptions options = App.GetOptions<CameraDataOptions>(); |
|
|
private readonly CameraDataOptions options; |
|
|
|
|
|
|
|
|
private Thread _thread { get; set; } |
|
|
private Thread _thread { get; set; } |
|
|
|
|
|
|
|
@ -50,12 +51,16 @@ public class CameraDataCenter |
|
|
|
|
|
|
|
|
#endregion Attr
|
|
|
#endregion Attr
|
|
|
|
|
|
|
|
|
|
|
|
private readonly ILogger<CameraDataCenter> _logger; |
|
|
|
|
|
|
|
|
public CameraDataCenter() |
|
|
public CameraDataCenter() |
|
|
{ |
|
|
{ |
|
|
_cbCameraRep = App.GetService<SqlSugarRepository<CbCamera>>(); |
|
|
_cbCameraRep = App.GetService<SqlSugarRepository<CbCamera>>(); |
|
|
_cmMarkLableRep = App.GetService<SqlSugarRepository<CmMarkLabel>>(); |
|
|
_cmMarkLableRep = App.GetService<SqlSugarRepository<CmMarkLabel>>(); |
|
|
_tbPtzCameraRep = App.GetService<SqlSugarRepository<TbPtzCamera>>(); |
|
|
_tbPtzCameraRep = App.GetService<SqlSugarRepository<TbPtzCamera>>(); |
|
|
_ptzServerApi = App.GetService<PtzServerApi>(); |
|
|
_ptzServerApi = App.GetService<PtzServerApi>(); |
|
|
|
|
|
options = App.GetOptions<CameraDataOptions>(); |
|
|
|
|
|
_logger = App.GetService<ILogger<CameraDataCenter>>(); |
|
|
Init(); |
|
|
Init(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -104,7 +109,7 @@ public class CameraDataCenter |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void RefreshMarkSearcher() |
|
|
private async void RefreshMarkSearcher() |
|
|
{ |
|
|
{ |
|
|
foreach (KeyValuePair<long, MarkSearcherBase> pair in _markSearcherDict) |
|
|
foreach (KeyValuePair<long, MarkSearcherBase> pair in _markSearcherDict) |
|
|
{ |
|
|
{ |
|
@ -115,7 +120,7 @@ public class CameraDataCenter |
|
|
ret = _cameraPtzInfoDict.TryGetValue(cameraIp, out PtzInfo ptzInfo); |
|
|
ret = _cameraPtzInfoDict.TryGetValue(cameraIp, out PtzInfo ptzInfo); |
|
|
if (!ret) continue; |
|
|
if (!ret) continue; |
|
|
markSearcher.UpdateCameraCalcInfo(ptzInfo); |
|
|
markSearcher.UpdateCameraCalcInfo(ptzInfo); |
|
|
List<MarkLabelCalcResult> resultList = markSearcher.Calc(); |
|
|
List<MarkLabelCalcResult> resultList = await markSearcher.CalcAsync(); |
|
|
_markLabelCalcResultListDict[cameraId] = resultList; |
|
|
_markLabelCalcResultListDict[cameraId] = resultList; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -247,7 +252,7 @@ public class CameraDataCenter |
|
|
public PtzInfo GetCameraPtzInfo(long cameraId) |
|
|
public PtzInfo GetCameraPtzInfo(long cameraId) |
|
|
{ |
|
|
{ |
|
|
PtzInfo ptzInfo = null; |
|
|
PtzInfo ptzInfo = null; |
|
|
bool ret = _cbCameraId2IpDict.TryGetValue(cameraId,out string cameraIp) && |
|
|
bool ret = _cbCameraId2IpDict.TryGetValue(cameraId, out string cameraIp) && |
|
|
_cameraPtzInfoDict.TryGetValue(cameraIp, out ptzInfo); |
|
|
_cameraPtzInfoDict.TryGetValue(cameraIp, out ptzInfo); |
|
|
return ret ? ptzInfo : null; |
|
|
return ret ? ptzInfo : null; |
|
|
} |
|
|
} |
|
|