Exemple #1
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);
        }
Exemple #2
0
//
//		public BaseDCTAction GetNextAction()
//		{
//			BaseDCTAction ba = null;
//			if(alWorkingAction.Count > 0)
//			{
//				ba =  alWorkingAction[0] as BaseDCTAction;
//				if(ba.NextAction != null)
//				{
//					alWorkingAction.Clear();
//					alWorkingAction.Add(ba.NextAction);
//
//					ba = null;
//
//					ba = alWorkingAction[0] as BaseDCTAction;
//				}
//			}
//			return ba;
//		}

        public override void SendMessage(object sender, Messages msgs, string command)
        {
            Message msg = new Message();

            for (int i = 0; i < msgs.Count(); i++)
            {
                if (msgs.Objects(i).Type != MessageType.Data)
                {
                    msg = msgs.Objects(i);
                }
            }
            DSC19Client client = sender as DSC19Client;

            if (msg.Body != String.Empty)
            {
                string send_msg = MutiLanguages.ParserMessage(msg.Body);
                if (send_msg.IndexOf("$") < 0)
                {
                    if (msg.Type == MessageType.Success)
                    {
                        //Laws Lu,2006/06/20	if Succes than no suffix
                        client.SendMessage(send_msg);
                    }

                    if (msg.Type == MessageType.Error)
                    {
                        //Laws Lu,2006/06/20	if error than add suffix char !
                        client.SendMessage(send_msg + " !");
                    }

                    if (msg.Type == MessageType.Normal)
                    {
                        //Laws Lu,2006/06/20	if normal than add suffix char :
                        client.SendMessage(send_msg + " :");
                    }
                }
            }
            if (msg.Exception != null)
            {
                string send_msg = MutiLanguages.ParserMessage(msg.Exception.Message);
                if (send_msg.IndexOf("$") < 0)
                {
                    //Laws Lu,2006/06/20	if error than add suffix char !
                    client.SendMessage(send_msg + " !");
                }
            }

            if (msg != null)
            {
                switch (msg.Type)
                {
                case MessageType.Success:
                {
                    break;
                }

                case MessageType.Error:
                {
                    //Laws Lu,2006/06/15 shoren the interval beep time
                    //Laws Lu,2006/06/20	beep twice
                    client.SendCommand(DCTCommand.SpeakerOff);
                    System.Threading.Thread.Sleep(100);
                    client.SendCommand(DCTCommand.SpeakerOn);
                    System.Threading.Thread.Sleep(50);
                    client.SendCommand(DCTCommand.SpeakerOff);
                    System.Threading.Thread.Sleep(100);
                    client.SendCommand(DCTCommand.SpeakerOn);
                    System.Threading.Thread.Sleep(50);
                    client.SendCommand(DCTCommand.SpeakerOff);
//
//						client.SendCommand(DCTCommand.SpeakerOn);
                    //System.Threading.Thread.Sleep(50);
                    break;
                }

                default:
                {
                    break;
                }
                }
            }
        }