Beispiel #1
0
        public InterfaceAnalyse(int nMachine_ID, TCPIP_Channel parent_TCPIP_Channel = null)
        {
            if (parent_TCPIP_Channel != null)
            {
                this.parent_TCPIP_Channel = parent_TCPIP_Channel;
            }
            this.nMachine_ID = nMachine_ID;

            errorvalue = new int[5] {-1,-1,-1,-1,-1};  //general + up to 4 furnaces

            SetStateValue((int)Definition.BitNumber.OFFLINE);
            try
            {
                parent_TCPIP_Channel.WriteStream("ARE_YOU_THERE@");
            }
            catch (System.ObjectDisposedException) { bConnectionEstablished = false; }
            catch { }

            // Hook up the Elapsed event for the timer.
            TGATimer.Elapsed += new ElapsedEventHandler(TimerEventProcessor);

            // Set the Interval to 1 seconds (1000 milliseconds).
            TGATimer.Interval = 1000;
            TGATimer.Enabled = true;
        }
Beispiel #2
0
        public InterfaceAnalyse(int nMachine_ID, TCPIP_Channel parent_TCPIP_Channel = null)
        {
            if (parent_TCPIP_Channel != null)
            {
                this.parent_TCPIP_Channel = parent_TCPIP_Channel;
            }
            this.nMachine_ID = nMachine_ID;

            // Hook up the Elapsed event for the timer.
            RobotTimer.Elapsed += new ElapsedEventHandler(TimerEventProcessor);

            // Set the Interval to 1 seconds (1000 milliseconds).
            RobotTimer.Interval = 1000;
            RobotTimer.Enabled = true;
        }
        public InterfaceAnalyse(int nMachine_ID, TCPIP_Channel parent_TCPIP_Channel = null)
        {
            if (parent_TCPIP_Channel != null)
            {
                this.parent_TCPIP_Channel = parent_TCPIP_Channel;
            }
            this.nMachine_ID = nMachine_ID;

            SetAlarmMessages();
            SetStateValue((int)Definition.BitNumber.OFFLINE);

            // Hook up the Elapsed event for the timer.
            RobotRCTimer.Elapsed += new ElapsedEventHandler(TimerEventProcessor);

            // Set the Interval to 1 seconds (1000 milliseconds).
            RobotRCTimer.Interval = 1000;
            RobotRCTimer.Enabled = true;
        }
Beispiel #4
0
        public InterfaceAnalyse(int nMachine_ID, TCPIP_Channel parent_TCPIP_Channel = null, int nAnalyseTypeID = -1)
        {
            if (parent_TCPIP_Channel != null)
            {
                this.parent_TCPIP_Channel = parent_TCPIP_Channel;
            }
            this.nMachine_ID = nMachine_ID;
            this.nAnalyseTypeID = nAnalyseTypeID;

            switch (nAnalyseTypeID)
            {
                case (int)Definition.TCPIPAnalyseClass.LABMANAGER: // LabMAanager
                    analyserLabManager = new LabManager.InterfaceAnalyse();
                    break;

                case (int)Definition.TCPIPAnalyseClass.TGA:
                    analyserTGA = new TGA.InterfaceAnalyse(nMachine_ID, this.parent_TCPIP_Channel);
                    break;

                case (int)Definition.TCPIPAnalyseClass.LIMS:
                    // Lims class not implemented yet
                    break;

                case (int)Definition.TCPIPAnalyseClass.ROBOT:
                    // Robot
                    analyserRobot = new Robot.InterfaceAnalyse(nMachine_ID, this.parent_TCPIP_Channel);
                    break;

                case (int)Definition.TCPIPAnalyseClass.ROBOTREMOTECONTROL:
                    // Robot remote control
                    analyserRobotRemoteControl = new RobotRemoteControl.InterfaceAnalyse(nMachine_ID, this.parent_TCPIP_Channel);
                    break;

                case -1:
                    parent_TCPIP_Channel.WriteLoggEntry((int)Definition.ThorLogWindows.ERROR, "no nAnalyseTypeID given ", (int)Definition.Message.D_ALARM);

                    break;
            }
        }
Beispiel #5
0
        private void SetupTCPIPChannels()
        {
            lock (LabManagerLock)
            {
                DataSet ds_TCPIPChannel = new DataSet();
                DataTable dt_TCPIPChannel = new DataTable();
                int nTCPIPChannnel = 0;

                //Type=0 => Server, Type=1 => Client
                string strSQL_Statement = "Select Port,IP_Address,Machine_ID,AnalyseType_ID,Type FROM TCPIP_configuration WHERE Activate=1";
                ds_TCPIPChannel = myHC.GetDataSetFromSQLCommand(strSQL_Statement);
                if (ds_TCPIPChannel != null)
                {
                    if (ds_TCPIPChannel.Tables.Count > 0)
                    {
                        dt_TCPIPChannel = ds_TCPIPChannel.Tables[0];
                        TcpipChannelArray = new TCPIP_Channel[dt_TCPIPChannel.Rows.Count];

                        foreach (DataRow dr_TCPIPChannels in dt_TCPIPChannel.Rows)
                        {
                            try
                            {
                                int nPort = (int)dr_TCPIPChannels["Port"];
                                int nMachine_ID = (int)dr_TCPIPChannels["Machine_ID"];
                                int nAnalyseTypeID = (int)dr_TCPIPChannels["AnalyseType_ID"];
                                string strIPAddress = dr_TCPIPChannels["IP_Address"].ToString();
                                int nType = (int)dr_TCPIPChannels["Type"];
                                TCPIP_Helper.TCPIPHelper tcp_Helper = new TCPIP_Helper.TCPIPHelper(this);
                                // load the TCPIP server objects
                                // (LabManager parent, int nPort,string strIP_Address, int nMachine_ID = -1, int nAnalyseTypeID = -1, int nType=-1)
                                TcpipChannelArray[nTCPIPChannnel] = new TCPIP_Channel(nPort, strIPAddress, nMachine_ID, nAnalyseTypeID, nType, tcp_Helper);
                                TCPIPHashTable.Add(nMachine_ID, nTCPIPChannnel);
                                nTCPIPChannnel++;
                                string strTCPIPType = "client";
                                if (nType == 0) { strTCPIPType = "server"; }
                                WriteTCPIPLoggEntry((int)Definition.ThorLogWindows.ROUTING,
                                    " loading TCPIP channel on port: " + nPort + " for station: `" + myHC.GetNameFromID((int)Definition.SQLTables.MACHINES, nMachine_ID) + "` as " + strTCPIPType
                                    , (int)Definition.Message.D_MESSAGE);
                            }
                            catch (Exception ex)
                            {
                                WriteTCPIPLoggEntry((int)Definition.ThorLogWindows.ERROR, ex.ToString(), (int)Definition.Message.D_ALARM);
                            }
                        }
                    }
                    else { InsertLoggingEntry((int)Definition.ThorLogWindows.ERROR, "no configuration entries found in table 'TCPIP_configuration'", (int)Definition.Message.D_ALARM); }
                }
                else { InsertLoggingEntry((int)Definition.ThorLogWindows.ERROR, "no configuration entries found in table 'TCPIP_configuration' dataset is null", (int)Definition.Message.D_ALARM); }
            }
        }