|
@@ -12,51 +12,6 @@ namespace Vinno.FIS.Sonopost.WebApi.Controllers
|
|
|
[WebApiController]
|
|
|
internal class LiveController : BaseController
|
|
|
{
|
|
|
- private static List<string> _sonoHDDeviceNames;
|
|
|
- private static FISCameraInfo _sonoDevice;
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 超声高清采集卡名称列表
|
|
|
- /// </summary>
|
|
|
- public List<string> SonoDeviceNames
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- if (_sonoHDDeviceNames == null)
|
|
|
- {
|
|
|
- _sonoHDDeviceNames = SonopostSystemSettings.Instance.InputDeviceNames.ToList();
|
|
|
- }
|
|
|
- return _sonoHDDeviceNames;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 超声采集卡名称
|
|
|
- /// </summary>
|
|
|
- public FISCameraInfo SonoDevice
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- if (_sonoDevice == null)
|
|
|
- {
|
|
|
- var cameras = DeviceManager.GetCameras();
|
|
|
- if (cameras != null)
|
|
|
- {
|
|
|
- foreach (var camera in cameras)
|
|
|
- {
|
|
|
- if (SonoDeviceNames.Contains(camera.Name.Trim()))
|
|
|
- {
|
|
|
- var capbilities = camera.Capabilities.Where(x => x.Width <= 1920 && x.Height <= 1080).ToList();
|
|
|
- _sonoDevice = new FISCameraInfo(camera.Id, camera.Name, camera.HardwareId, capbilities);
|
|
|
- return _sonoDevice;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return _sonoDevice;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 获取超声机品牌集合
|
|
|
/// </summary>
|
|
@@ -97,14 +52,14 @@ namespace Vinno.FIS.Sonopost.WebApi.Controllers
|
|
|
[WebApiAction]
|
|
|
public Result GetSonoInfo()
|
|
|
{
|
|
|
- if (SonoDevice == null)
|
|
|
+ if (LiveVideoManager.SonoDevice == null)
|
|
|
{
|
|
|
return Result.Fail("DeviceNotFound");
|
|
|
}
|
|
|
var videoInfos = SonopostUserDefinedSettings.Instance.HardwareSetting.VideoDeviceInfoList;
|
|
|
var config = videoInfos?.FirstOrDefault(x => x.Category == FISLiveChannelCategory.Main);
|
|
|
|
|
|
- var model = new SonoInfoModel(config?.Id, config?.Name, SonoDevice?.HardwareId, SonoDevice?.Capabilities)
|
|
|
+ var model = new SonoInfoModel(config?.Id, config?.Name, LiveVideoManager.SonoDevice?.HardwareId, LiveVideoManager.SonoDevice?.Capabilities)
|
|
|
{
|
|
|
Width = config == null ? 0 : config.Width,
|
|
|
Height = config == null ? 0 : config.Height,
|
|
@@ -123,7 +78,7 @@ namespace Vinno.FIS.Sonopost.WebApi.Controllers
|
|
|
[WebApiAction]
|
|
|
public Result SaveSonoInfo(SonoInfoModel request)
|
|
|
{
|
|
|
- if (SonoDevice == null)
|
|
|
+ if (LiveVideoManager.SonoDevice == null)
|
|
|
{
|
|
|
return Result.Fail("DeviceNotFound");
|
|
|
}
|
|
@@ -139,8 +94,8 @@ namespace Vinno.FIS.Sonopost.WebApi.Controllers
|
|
|
videoInfos.Add(config);
|
|
|
}
|
|
|
|
|
|
- config.Id = SonoDevice.Id;
|
|
|
- config.Name = SonoDevice.Name;
|
|
|
+ config.Id = LiveVideoManager.SonoDevice.Id;
|
|
|
+ config.Name = LiveVideoManager.SonoDevice.Name;
|
|
|
config.IsEnable = request.IsEnable;
|
|
|
config.Brand = request.Brand;
|
|
|
config.Model = request.Model;
|
|
@@ -161,11 +116,11 @@ namespace Vinno.FIS.Sonopost.WebApi.Controllers
|
|
|
[WebApiAction]
|
|
|
public Result GetSonoResolutions()
|
|
|
{
|
|
|
- if (SonoDevice == null)
|
|
|
+ if (LiveVideoManager.SonoDevice == null)
|
|
|
{
|
|
|
return Result.Fail("DeviceNotFound");
|
|
|
}
|
|
|
- return Result.Success(SonoDevice.Capabilities.Select(x => new { x.Width, x.Height }));
|
|
|
+ return Result.Success(LiveVideoManager.SonoDevice.Capabilities.Select(x => new { x.Width, x.Height }));
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -176,7 +131,7 @@ namespace Vinno.FIS.Sonopost.WebApi.Controllers
|
|
|
public Result GetCameras()
|
|
|
{
|
|
|
var cameras = DeviceManager.GetCameras()
|
|
|
- ?.Where(x => !x.Name.Equals(SonoDevice?.Name)) ?? new List<FISCameraInfo>();
|
|
|
+ ?.Where(x => !x.Name.Equals(LiveVideoManager.SonoDevice?.Name)) ?? new List<FISCameraInfo>();
|
|
|
return Result.Success(cameras);
|
|
|
}
|
|
|
|
|
@@ -189,7 +144,7 @@ namespace Vinno.FIS.Sonopost.WebApi.Controllers
|
|
|
{
|
|
|
DeviceManager.RefreshCameras();
|
|
|
var cameras = DeviceManager.GetCameras()
|
|
|
- ?.Where(x => !x.Name.Equals(SonoDevice?.Name)) ?? new List<FISCameraInfo>();
|
|
|
+ ?.Where(x => !x.Name.Equals(LiveVideoManager.SonoDevice?.Name)) ?? new List<FISCameraInfo>();
|
|
|
return Result.Success(cameras);
|
|
|
}
|
|
|
|
|
@@ -517,7 +472,7 @@ namespace Vinno.FIS.Sonopost.WebApi.Controllers
|
|
|
[WebApiAction]
|
|
|
public Result GetSonoCaptureCardList()
|
|
|
{
|
|
|
- return Result.Success(SonoDeviceNames);
|
|
|
+ return Result.Success(LiveVideoManager.SonoDeviceNames);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|