123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using MvCameraControl;
- using MvvmScaffoldFrame48.Model.HikVisionCamera;
- using System.Collections.Generic;
- namespace MvvmScaffoldFrame48.DLL.CameraTools
- {
- /// <summary>
- /// HIKVISION相机类
- /// </summary>
- public static class HikVision
- {
- #region 常量
- private readonly static DeviceTLayerType enumTLayerType = DeviceTLayerType.MvGigEDevice | DeviceTLayerType.MvUsbDevice
- | DeviceTLayerType.MvGenTLGigEDevice | DeviceTLayerType.MvGenTLCXPDevice
- | DeviceTLayerType.MvGenTLCameraLinkDevice | DeviceTLayerType.MvGenTLXoFDevice;
- #endregion
- #region 变量
- #endregion
- #region 实例
- /// <summary>
- /// 相机列表
- /// </summary>
- private static List<IDeviceInfo> CamList;
- #endregion
- #region 公共方法
- /// <summary>
- /// 获取相机列表
- /// </summary>
- /// <param name="CamList"></param>
- /// <returns></returns>
- public static void GetCameraList(out List<CameraInfoModel> CameraInfoList)
- {
- CamList = new List<IDeviceInfo>();
- CameraInfoList = new List<CameraInfoModel>();
- int nRet = DeviceEnumerator.EnumDevices(enumTLayerType, out CamList);
- if (nRet != MvError.MV_OK)
- {
- return;
- }
- else
- {
- //输出相机名称及SN码以方便选择设备
- foreach (var item in CamList)
- {
- CameraInfoList.Add(new CameraInfoModel
- {
- DeviceName = item.ModelName,
- DeviceSN = item.SerialNumber,
- });
- }
- }
- return;
- }
- #endregion
- }
- }
|