Beispiel #1
0
        //		public override void DCTListen()
        //		{
        //			DCTListen(null);
        //		}

        private void AsyncTransferData(DSC19DCTDriver driver, string receiveData)
        {
            AsyncTransferDriver transfer = new AsyncTransferDriver();

            transfer.driver      = driver;
            transfer.ReceiveData = receiveData;
            AsyncDelegate d = new AsyncDelegate(transfer.DoAction);

            System.AsyncCallback callback = new AsyncCallback(AsyncCallback);
            d.BeginInvoke(callback, d);
        }
Beispiel #2
0
        // Added end

        //Recieve Data from client
        public override void CycleRequest()
        {
            if (this.IsRootDriver == true || stack.CurrentDirect == FlowDirect.WaitingInput)
            {
                string strRec = null;

                int clientId = 0;
                strRec = (client as DSC19Client).RecieveData(ref clientId);

                BaseDCTAction action = null;
                if (strRec != null && strRec != string.Empty)
                {
                    if (this.IsRootDriver == false)             // 如果不是种子Driver,则执行Action操作
                    {
                        if (strRec.IndexOf("ALL RIGHTS") < 0 && strRec != String.Empty && strRec.IndexOf("DCS-19 SELF-RESET") < 0)
                        {
                            try
                            {
                                DealSuperCommand(strRec);

                                action = stack.GetNextAction();
                                stack.SendMessage(client, action.Do(client), "");
                                //stack.CurrentDirect = action.FlowDirect;
                            }
                            catch (Exception ex)
                            {
                                UserControl.Messages msg = new UserControl.Messages();
                                msg.Add(new UserControl.Message(ex));
                                stack.SendMessage(client, msg, "");
                                if (action != null)
                                {
                                    //stack.CurrentDirect = action.FlowDirect;
                                }
                            }
                        }
                    }
                    else                // 如果是种子Driver,则将数据发送到真实的Driver上
                    {
                        DSC19DCTDriver driver = this.GetDriver(clientId);
                        this.AsyncTransferData(driver, strRec);

                        // 继续向下读
                        if (strRec != null && strRec != string.Empty)
                        {
                            CycleRequest();
                        }
                    }
                }
            }
        }
Beispiel #3
0
        public DSC19DCTDriver GetDriver(int clientId)
        {
            DSC19DCTDriver driver = (DSC19DCTDriver)listDriver[clientId];

            if (driver == null)
            {
                driver = new DSC19DCTDriver();
                driver.IsRootDriver = false;
                DSC19Client c1 = new DSC19Client(client.ClientAddress, client.ClientPort);
                c1.ClientID     = clientId;
                c1.ClientStatus = DSC19ClientStatus.Connecting;
                driver.client   = c1;
                driver.ClientID = clientId;
                ((DSC19Client)client).TerminalConnect(driver);
                listDriver.Add(clientId, driver);
                // Added by Icyer 2006/12/29 @ YHI	设置切换指令时的Action
                BenQGuru.eMES.Common.DCT.Action.ActionRCard arCard = new BenQGuru.eMES.Common.DCT.Action.ActionRCard();
                arCard.Status           = ActionStatus.Working;
                driver.defaultDCTAction = arCard;
                // Added end
            }
            return(driver);
        }