//-------------------------------------------------------------------------------------------------//

        public LabStatus GetLabStatus()
        {
            const string STRLOG_MethodName = "GetLabStatus";

            string logMessage = STRLOG_unitId + unitId.ToString();

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName, logMessage);

            LabStatus labStatus;

            //
            // Check if there is an equipment service
            //
            if (this.equipmentServiceProxy == null)
            {
                //
                // No equipment service, just get the status of this engine
                //
                StatusCodes status = (this.IsRunningExperiment == true) ? StatusCodes.Running : StatusCodes.Ready;
                labStatus = new LabStatus(true, status.ToString());
            }
            else
            {
                //
                // Get the status of the equipment service
                //
                try
                {
                    LabEquipmentStatus labEquipmentStatus = this.equipmentServiceProxy.GetLabEquipmentStatus();
                    labStatus = new LabStatus(labEquipmentStatus.online, labEquipmentStatus.statusMessage);
                }
                catch (Exception ex)
                {
                    labStatus = new LabStatus(false, ex.Message);
                    Logfile.WriteError(ex.Message);
                }
            }

            logMessage = STRLOG_online + labStatus.online.ToString() +
                         Logfile.STRLOG_Spacer + STRLOG_labStatusMessage + Logfile.STRLOG_Quote + labStatus.labStatusMessage + Logfile.STRLOG_Quote;

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName, logMessage);

            return(labStatus);
        }
Пример #2
0
        //-------------------------------------------------------------------------------------------------//

        public LabStatus GetLabStatus()
        {
            LabStatus labStatus = null;

            lock (this.managerLock)
            {
                bool   isOnline;
                string message;

                //
                // Get the lab status of the experiment manager
                //
                lock (this.statusLock)
                {
                    isOnline = this.slOnline;
                    message  = this.slLabStatusMessage;
                }

                //
                // Check the lab status
                //
                if (isOnline == false)
                {
                    labStatus = new LabStatus(isOnline, message);
                }
                else
                {
                    isOnline = true;
                    message  = String.Empty;

                    //
                    // Check lab status of each experiment engine
                    //
                    for (int i = 0; i < this.appData.farmSize; i++)
                    {
                        LabExperimentEngine labExperimentEngine = this.appData.labExperimentEngines[i];

                        labStatus = labExperimentEngine.GetLabStatus();

                        //
                        // Keep a running tally
                        //
                        isOnline = isOnline && labStatus.online;
                        if (i > 0)
                        {
                            message += Logfile.STRLOG_Spacer;
                        }
                        message += i.ToString() + ":" + labStatus.labStatusMessage;
                    }

                    if (isOnline == true)
                    {
                        message = StatusCodes.Ready.ToString();
                    }

                    labStatus = new LabStatus(isOnline, message);
                }
            }

            return(labStatus);
        }