Ejemplo n.º 1
0
        private void TryInitCameras(object o)
        {
            WinCall.ThreadBoolRet thRet = (WinCall.ThreadBoolRet)o;

            WinCall.ThreadBoolRet thRetTick = new WinCall.ThreadBoolRet();
            thRetTick.pExtra = this;
            //(1)车票摄像头初始化
            mainWin.CreateTicketCamOper(thRetTick);

            //(2)人脸摄像头初始化
            bool bCamFace = indusCamOper.Init();

            if (!bCamFace)
            {
                PromptError("初始化人脸摄像头SDK失败");
            }
            else
            {
                bCamFace = indusCamOper.InitCamera();
                if (!bCamFace)
                {
                    PromptError("连接到人脸摄像头失败");
                }
            }

            thRet.bResult = bCamFace;
        }
Ejemplo n.º 2
0
        private void FuncInitEnv()
        {
            //初始化身份证读取模块
            WinCall.ThreadBoolRet thDataIDCard = new WinCall.ThreadBoolRet();
            Thread thIDCard = new Thread(TryInitIDCardReader)
            {
                Name         = "thIDCard",
                IsBackground = true
            };

            thIDCard.Start(thDataIDCard);

            //初始化人脸识别库
            WinCall.ThreadBoolRet thDataFaceCmp = new WinCall.ThreadBoolRet();
            Thread thFaceCmp = new Thread(TryInitFaceCmp)
            {
                Name         = "thFaceCmp",
                IsBackground = true
            };

            thFaceCmp.Start(thDataFaceCmp);

            //初始化两个摄像头
            WinCall.ThreadBoolRet thDataInitCam = new WinCall.ThreadBoolRet();
            Thread thInitCam = new Thread(TryInitCameras)
            {
                Name         = "thInitCam",
                IsBackground = true
            };

            thInitCam.Start(thDataInitCam);

            //初始化灯板、闸门
            WinCall.ThreadBoolRet thDataGateBoard = new WinCall.ThreadBoolRet();
            Thread thGateBoard = new Thread(TryInitGateBoard)
            {
                Name         = "thGateBoard",
                IsBackground = true
            };

            thGateBoard.Start(thDataGateBoard);

            LoadVoices();

            thIDCard.Join();
            thFaceCmp.Join();
            thInitCam.Join();
            thGateBoard.Join();

            if (thDataIDCard.bResult && thDataFaceCmp.bResult && thDataInitCam.bResult && thDataGateBoard.bResult)
            {
                StartMainThread();
                StartLiveCamThread();
                PlayVoice(ConstValue.VOICE_INIT_OK, true);
            }
            else
            {
                PlayVoice(ConstValue.VOICE_INIT_FAIL, true);
            }
        }
Ejemplo n.º 3
0
 public void CreateTicketCamOper(WinCall.ThreadBoolRet pData)
 {
     while (!this.InvokeRequired)
     {
     }
     this.Invoke(new MyFuncDelegate1(DoCreateTicketCamOper), pData);
 }
Ejemplo n.º 4
0
        private void DoCreateTicketCamOper(object objData)
        {
            WinCall.ThreadBoolRet pData             = (WinCall.ThreadBoolRet)objData;
            FaceDetect            faceDetect        = (FaceDetect)pData.pExtra;
            const int             VIDEOWIDTH        = 640;
            const int             VIDEOHEIGHT       = 480;
            const int             VIDEOBITSPERPIXEL = 24; // BitsPerPixel values determined by device

            try
            {
                tickCamOper = new Capture(faceDetect.GetCamTicketID(), VIDEOWIDTH, VIDEOHEIGHT, VIDEOBITSPERPIXEL,
                                          tickPicCtrl);
            }
            catch (Exception ex)
            {
                WinCall.TraceException(ex);
            }
            bool bInit = (tickCamOper != null);

            if (!bInit)
            {
                PromptError("车票摄像头初始化失败!");
            }
            pData.bResult = bInit;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 初始化人脸识别库
        /// </summary>
        /// <returns></returns>
        private void TryInitFaceCmp(object o)
        {
            WinCall.ThreadBoolRet thRet = (WinCall.ThreadBoolRet)o;
            bool bRet = faceCmpEngine.InitLib();

            if (!bRet)
            {
                PromptError("人脸识别模块初始化失败");
            }
            thRet.bResult = bRet;
        }
Ejemplo n.º 6
0
        private void TryInitGateBoard(object o)
        {
            WinCall.ThreadBoolRet thRet = (WinCall.ThreadBoolRet)o;
            bool bOpen = gateBoardOper.TryOpenCOM(configInfo.GateBoardCOM);

            if (bOpen)
            {
                gateBoardOper.TurnoffAllLight();
            }
            thRet.bResult = bOpen;
        }
Ejemplo n.º 7
0
        private void TryInitIDCardReader(object o)
        {
            WinCall.ThreadBoolRet thRet = (WinCall.ThreadBoolRet)o;
            bool bOpen = (1 == idCardReader.TryOpenCOM(this.configInfo.IDReaderCOM));

            if (bOpen)
            {
                thRet.bResult = true;
                return;
            }
            const int MAX_RETRY_COM = 20;

            for (int i = 1; i <= MAX_RETRY_COM; i++)
            {
                if (i == this.configInfo.IDReaderCOM)
                {
                    continue;
                }
                int nRet = idCardReader.TryOpenCOM(i);
                bOpen = (1 == nRet);
                if (-1 == nRet)
                {
                    //这里认为后续串口都不存在了
                    break;
                }
                if (bOpen)
                {
                    this.configInfo.IDReaderCOM = i;
                    this.configInfo.bNeedSave   = true;
                    break;
                }
            }
            if (!bOpen)
            {
                PromptError("身份证读卡器初始化失败");
            }
            thRet.bResult = bOpen;
        }