private void PortDataReceive_Event(object sender, PortDataReciveEventArgs e)
 {
     messagetemp = e.Data;
     //isReceive = true;
     MessageManager(true);
     messagetemp = "";
     startReadSigal.Set();
 }
Ejemplo n.º 2
0
 private void PortDataReceive_Event(object sender, PortDataReciveEventArgs e)
 {
     if (isTiming)
     {
         isTiming = false;
         feedbacktimeout.Stop();
     }
     errorcount = 0;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 接收按钮信号
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void serialPortDao_Received(object sender, PortDataReciveEventArgs e)
 {
     if (Tags != null && Tags.Keys.Contains(Convert.ToInt32(e.Data[0])))
     {
         lock (o)
         {
             Tags[Convert.ToInt32(e.Data[0])].Qty = 0;
         }
         Dictionary <int, int> sendcontext = new Dictionary <int, int>();
         sendcontext.Add(Convert.ToInt32(e.Data[0]), 0);
         NixielightSDK.SendByMODBUS(sendcontext);
     }
 }
Ejemplo n.º 4
0
        private void App_portDataReciveEvent(object sender, PortDataReciveEventArgs e)
        {
            if (isTestMode)
            {
                Util.Notify(Level.Err, "---收到触发命令,测试模式下不响应");
                return;
            }
            string code            = e.Data.ToLower();
            int    settingIndexRec = 0;

            //System.Diagnostics.Debug.WriteLine("网络线程:" + Thread.CurrentThread.ManagedThreadId);
            if (code == "start")
            {
                Util.Notify("---收到触发命令,工具组1开始运行");
                int cameraindex = toolShowUnit1.GetCameraIndex(1);
                if (cameraindex < 1 || CameraManger.CameraDic.ContainsKey(cameraindex) == false)
                {
                    Util.Notify(Level.Err, $"收到触发工具组{settingIndexRec}命令,但对应相机不存在");
                    return;
                }
                else if (CameraManger.CameraDic.ContainsKey(cameraindex))
                {
                    if (CameraManger.CameraDic[cameraindex].IsLink == false)
                    {
                        Util.Notify(Level.Err, $"收到触发工具组{settingIndexRec}命令,但对应相机已离线");
                        return;
                    }
                }
                CameraManger.CameraDic[cameraindex].GrabImage(1050, 1);
                //runTheadDataDic[cameraindex].TrigerRun(1, false); //三个参数的TrigerRun都是在该函数体内强制isExtTrigger为True,在RunAllTool函数中按外部触发模式来处理。
            }
            else if (int.TryParse(code, out settingIndexRec))
            {
                if (!ToolsFactory.ToolsDic.ContainsKey(settingIndexRec))
                {
                    Util.Notify(Level.Err, $"收到触发工具组{settingIndexRec}命令,但该工具组不存在");
                    return;
                }
                Util.Notify($"---收到触发命令,工具组{settingIndexRec}开始运行");
                int cameraindex = toolShowUnit1.GetCameraIndex(settingIndexRec);
                if (cameraindex < 1 || CameraManger.CameraDic.ContainsKey(cameraindex) == false)
                {
                    Util.Notify(Level.Err, $"收到触发工具组{settingIndexRec}命令,但对应相机不存在");
                    return;
                }
                else if (CameraManger.CameraDic.ContainsKey(cameraindex))
                {
                    if (CameraManger.CameraDic[cameraindex].IsLink == false)
                    {
                        Util.Notify(Level.Err, $"收到触发工具组{settingIndexRec}命令,但对应相机不存在");
                        return;
                    }
                }
                CameraManger.CameraDic[cameraindex].GrabImage(1050, settingIndexRec);
                //runTheadDataDic[cameraindex].TrigerRun(settingIndexRec, false);
            }
            else
            {
                Util.Notify(Level.Err, string.Format("收到异常触发相机命令:{0}", e.Data));
            }
        }
Ejemplo n.º 5
0
 private void SerialHelper_PortDataReciveEvent(object sender, PortDataReciveEventArgs e)
 {
     OnDataReceive(e.Data);
 }