コード例 #1
0
        /// <summary>
        /// 查看相机是否连接
        /// </summary>
        /// <param name="camStatus">所以相机的连接状态列表</param>
        /// <returns>true表示所有的相机连接,false表示有相机未连接</returns>
        public static bool CamConnectStatus(out List <CamStatus> camStatus)
        {
            bool isConnect;
            bool isAllConnect = true;

            camStatus = new List <CamStatus>();
            if (!MyRun.havInit)
            {
                StrErrorMsg = "视觉模块未初始化";
                return(false);
            }
            if (HKCameraCltr.GetListUserDefinedName().Count == 0)
            {
                return(false);
            }
            foreach (var camName in HKCameraCltr.GetListUserDefinedName())
            {
                isConnect    = MyRun.IsCamConnect(camName);
                isAllConnect = isAllConnect && isConnect;
                camStatus.Add(new CamStatus()
                {
                    CamName   = camName,
                    IsConnect = isConnect
                });
            }
            return(isAllConnect);
        }
コード例 #2
0
 public static bool Init()
 {
     HOperatorSet.SetSystem("clip_region", "false");
     havInit = true;
     //连接相机
     cameraCltr = new HKCameraCltr();
     new Thread(() =>
     {
         if (!cameraCltr.Connect())
         {
             StrErrorMsg = "相机异常:" + cameraCltr.StrErrorMsg;
         }
     })
     {
         IsBackground = true
     }.Start();
     if (StrErrorMsg != null)
     {
         return(false);
     }
     return(true);
 }
コード例 #3
0
 public static bool GetCameraNameList(out List <string> CamNames)
 {
     CamNames = HKCameraCltr.GetListUserDefinedName();
     return(true);
 }
コード例 #4
0
 public static List <string> GetCameraList()
 {
     return(HKCameraCltr.GetListUserDefinedName());
 }