using MvCameraControl; using MvvmScaffoldFrame48.Model.HikVisionCamera; using System.Collections.Generic; namespace MvvmScaffoldFrame48.DLL.CameraTools { /// /// HIKVISION相机类 /// 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 实例 /// /// 相机列表 /// private static List CamList; #endregion #region 公共方法 /// /// 获取相机列表 /// /// /// public static void GetCameraList(out List CameraInfoList) { CamList = new List(); CameraInfoList = new List(); 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 } }