public LabEquipmentStatus GetLabEquipmentStatus()
        {
            const string STRLOG_MethodName = "GetLabEquipmentStatus";

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName);

            LabEquipmentStatus labEquipmentStatus = null;

            //
            // Check caller access is authorised
            //
            if (Authorised(authHeader) == true)
            {
                //
                // Pass on to the equipment engine
                //
                LabStatus labStatus = Global.equipmentManager.GetLabEquipmentStatus();
                labEquipmentStatus = new LabEquipmentStatus(labStatus.online, labStatus.labStatusMessage);
            }
            else
            {
                labEquipmentStatus = new LabEquipmentStatus(false, STRLOG_AccessDenied);
            }

            string logMessage = STRLOG_Online + labEquipmentStatus.online.ToString() +
                                Logfile.STRLOG_Spacer + STRLOG_LabStatusMessage + Logfile.STRLOG_Quote + labEquipmentStatus.statusMessage + Logfile.STRLOG_Quote;

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName, logMessage);

            return(labEquipmentStatus);
        }
Ejemplo n.º 2
0
        public LabStatus GetLabStatus()
        {
            const string STRLOG_MethodName = "GetLabStatus";

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName);

            LabStatus labStatus = null;

            // Get the identity of the caller
            string sbName = GetCallerName(authHeader);

            // Check caller access is authorised
            if (sbName != null)
            {
                // Pass on to experiment manager
                labStatus = Global.experimentManager.GetLabStatus();
            }
            else
            {
                labStatus = new LabStatus(false, STRLOG_AccessDenied);
            }

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName);

            return(labStatus);
        }
        //-------------------------------------------------------------------------------------------------//

        public override LabStatus GetLabEquipmentStatus()
        {
            const string STRLOG_MethodName = "GetLabEquipmentStatus";

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName);

            LabStatus labStatus = new LabStatus(true, StatusCodes.Ready.ToString());

            string logMessage = STRLOG_Online + labStatus.online.ToString() +
                                Logfile.STRLOG_Spacer + STRLOG_StatusMessage + Logfile.STRLOG_Quote + labStatus.labStatusMessage + Logfile.STRLOG_Quote;

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName, logMessage);

            return(labStatus);
        }
        public LabStatus GetLabStatus(string labServerID)
        {
            const string STRLOG_MethodName = "GetLabStatus";

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName);

            LabServerWebService labServer = GetLabServer(sbHeader);
            LabStatus           labStatus = labServer.GetLabStatus();

            Logfile.Write(" Online: " + labStatus.online.ToString());
            Logfile.Write(" LabStatus Message: " + labStatus.labStatusMessage);

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName);

            return(labStatus);
        }
        //-------------------------------------------------------------------------------------------------//

        public LabStatus GetLabEquipmentStatus()
        {
            LabStatus labStatus = null;

            lock (this.managerLock)
            {
                if (this.labEquipmentEngine != null)
                {
                    labStatus = this.labEquipmentEngine.GetLabEquipmentStatus();
                }
                else
                {
                    labStatus = new LabStatus(false, STR_NotInitialised);
                }
            }

            return(labStatus);
        }
Ejemplo n.º 6
0
        //-------------------------------------------------------------------------------------------------//

        public override LabStatus GetLabEquipmentStatus()
        {
            const string STRLOG_MethodName = "GetLabEquipmentStatus";

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName);

            //
            // Get the machine status
            //
            LabStatus labStatus = new LabStatus(this.driverMachine.Online, this.driverMachine.StatusMessage);

            string logMessage = STRLOG_Online + labStatus.online.ToString() +
                                Logfile.STRLOG_Spacer + STRLOG_StatusMessage + Logfile.STRLOG_Quote + labStatus.labStatusMessage + Logfile.STRLOG_Quote;

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName, logMessage);

            return(labStatus);
        }
Ejemplo n.º 7
0
        //-------------------------------------------------------------------------------------------------//

        public override LabStatus GetLabEquipmentStatus()
        {
            const string STRLOG_MethodName = "GetLabEquipmentStatus";

            Logfile.WriteCalled(this.logLevel, STRLOG_ClassName, STRLOG_MethodName);

            //
            // Get the status of the RedLion controller
            //
            LabStatus labStatus = new LabStatus(this.redLion.Online, this.redLion.StatusMessage);

            string logMessage = STRLOG_Online + labStatus.online.ToString() +
                                Logfile.STRLOG_Spacer + STRLOG_StatusMessage + Logfile.STRLOG_Quote + labStatus.labStatusMessage + Logfile.STRLOG_Quote;

            Logfile.WriteCompleted(this.logLevel, STRLOG_ClassName, STRLOG_MethodName, logMessage);

            return(labStatus);
        }
        //-------------------------------------------------------------------------------------------------//

        public override LabStatus GetLabEquipmentStatus()
        {
            const string STRLOG_MethodName = "GetLabEquipmentStatus";

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName);

            LabStatus labStatus = new LabStatus(this.flexMotion.Online, this.flexMotion.StatusMessage);

            if (labStatus.online == true)
            {
                labStatus.online           = this.slOnline;
                labStatus.labStatusMessage = this.slStatusMessage;
            }

            string logMessage = STRLOG_Online + labStatus.online.ToString() +
                                Logfile.STRLOG_Spacer + STRLOG_StatusMessage + Logfile.STRLOG_Quote + labStatus.labStatusMessage + Logfile.STRLOG_Quote;

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName, logMessage);

            return(labStatus);
        }
Ejemplo n.º 9
0
        //-------------------------------------------------------------------------------------------------//

        protected void btnRefresh_Click1(object sender, EventArgs e)
        {
            //
            // Get the LabServer status and display
            //
            try
            {
                LabStatus labStatus = Master.ServiceBroker.GetLabStatus();
                if (labStatus.online == true)
                {
                    //
                    // Display lab status
                    //
                    lblOnline.ForeColor = Color.Green;
                    lblOnline.Text      = STR_Online;

                    //
                    // Display the queue length and wait time
                    //
                    WaitEstimate waitEstimate = Master.ServiceBroker.GetEffectiveQueueLength();
                    lblLabServerStatusMsg.Text = labStatus.labStatusMessage + STR_Spacer +
                                                 this.FormatQueueLengthWait(waitEstimate.effectiveQueueLength, (int)waitEstimate.estWait);
                }
                else
                {
                    //
                    // Display lab status and message
                    //
                    lblOnline.ForeColor        = Color.Red;
                    lblOnline.Text             = STR_Offline;
                    lblLabServerStatusMsg.Text = labStatus.labStatusMessage;
                }
            }
            catch (Exception ex)
            {
                // LabServer error
                Logfile.WriteError(ex.Message);
                lblLabServerStatusMsg.Text = STRERR_GetExperimentStatusFailed;
            }
        }
        //-------------------------------------------------------------------------------------------------//
        private LabStatus ConvertType(Proxy.LabStatus proxyLabStatus)
        {
            LabStatus labStatus = null;

            if (proxyLabStatus != null)
            {
                labStatus = new LabStatus();
                labStatus.Online = proxyLabStatus.online;
                labStatus.LabStatusMessage = proxyLabStatus.labStatusMessage;
            }

            return labStatus;
        }
        //-------------------------------------------------------------------------------------------------//
        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;
        }
        public LabStatus GetLabStatus()
        {
            const string STRLOG_MethodName = "GetLabStatus";

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName);

            LabStatus labStatus = null;

            // Get the identity of the caller
            string sbName = GetCallerName(authHeader);

            // Check caller access is authorised
            if (sbName != null)
            {
                // Pass on to experiment manager
                labStatus = Global.experimentManager.GetLabStatus();
            }
            else
            {
                labStatus = new LabStatus(false, STRLOG_AccessDenied);
            }

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName);

            return (labStatus);
        }
        //-------------------------------------------------------------------------------------------------//
        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);
        }
        //---------------------------------------------------------------------------------------//

        protected void Page_Init(object sender, EventArgs e)
        {
            const string STRLOG_MethodName = "Page_Init";

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName);

            //
            // This method gets called before any other Page_Init() or Page_Load() methods.
            //

            //
            // Get query string values for coupon ID and passkey
            //
            string query         = Request.Url.Query;
            string queryCouponId = HttpUtility.ParseQueryString(query).Get(Consts.STRQRY_CouponID);
            string queryPasskey  = HttpUtility.ParseQueryString(query).Get(Consts.STRQRY_Passkey);

            //
            // Check if this is new LabClient session
            //
            if (Session[Consts.STRSSN_LabClient] != null && queryCouponId != null)
            {
                //
                // Remove the existing session because this is a new LabClient launch
                //
                Logfile.Write(STRLOG_SessionExistsRemovingSession);
                Session.Remove(Consts.STRSSN_LabClient);
            }

            if (Session[Consts.STRSSN_LabClient] == null)
            {
                if (queryCouponId == null)
                {
                    //
                    // Session has timed out
                    //
                    Logfile.Write(STRLOG_SessionNotExist);
                    Response.Redirect(Consts.STRURL_Expired);
                }

                //
                // Carry out one-time initialisation for all LabClient instances
                //
                Logfile.Write(STR_Initialising);

                //
                // Log the caller's IP address and hostname
                //
                HttpRequest httpRequest = this.Request;
                string      logMessage  = STRLOG_UserHostAddress + httpRequest.UserHostAddress +
                                          Logfile.STRLOG_Spacer + STRLOG_UserHostName;
                try
                {
                    IPHostEntry ipHostEntry = Dns.GetHostEntry(httpRequest.UserHostAddress);
                    logMessage += ipHostEntry.HostName;
                }
                catch
                {
                    logMessage += STRLOG_CannotResolveToHostName;
                }
                Logfile.Write(logMessage);

                //
                // Get query string values - the query string parameters are NOT case-sensensitive (good)
                //
                string queryServiceUrl  = HttpUtility.ParseQueryString(query).Get(Consts.STRQRY_ServiceURL);
                string queryLabServerId = HttpUtility.ParseQueryString(query).Get(Consts.STRQRY_LabServerID);
                string queryMultiSubmit = HttpUtility.ParseQueryString(query).Get(Consts.STRQRY_MultiSubmit);

                //
                // Create a LabClient session information instance
                //
                LabClientSession labClientSession = new LabClientSession();

                //
                // Create ServiceBroker interface with authorisation information
                //
                LabClientToSbAPI serviceBroker = new LabClientToSbAPI(queryCouponId, queryPasskey, queryServiceUrl, queryLabServerId);
                labClientSession.labClientToSbAPI = serviceBroker;

                //
                // Get the lab status and lab configuration
                //
                try
                {
                    //
                    // Get the lab status
                    //
                    Logfile.Write(STRLOG_GettingLabStatus);

                    LabStatus labStatus = serviceBroker.GetLabStatus();

                    logMessage = STRLOG_Online + labStatus.online.ToString() +
                                 Logfile.STRLOG_Spacer + STRLOG_LabStatusMessage + labStatus.labStatusMessage;
                    Logfile.Write(logMessage);

                    //
                    // Get the XML lab configuration string
                    //
                    Logfile.Write(STRLOG_GettingLabConfiguration);

                    string xmlLabConfiguration = serviceBroker.GetLabConfiguration();
                    if (xmlLabConfiguration != null)
                    {
                        // Save information from the lab configuration string
                        ParseLabConfiguration(labClientSession, xmlLabConfiguration);
                    }
                }
                catch (Exception ex)
                {
                    if (ex.InnerException != null)
                    {
                        Logfile.Write(ex.InnerException.Message);
                    }
                    else
                    {
                        Logfile.WriteError(ex.Message);
                    }
                }

                //
                // Get feedback email URL
                //
                labClientSession.mailtoUrl = STR_MailTo + Utilities.GetAppSetting(Consts.STRCFG_FeedbackEmail);

                //
                // Determine if multiple submission is enabled
                //
                try
                {
                    if (queryMultiSubmit == null)
                    {
                        //
                        // Querystring parameter is not specified, try getting it from the application's configuration file
                        //
                        labClientSession.multiSubmit = Convert.ToBoolean(Utilities.GetAppSetting(Consts.STRCFG_MultiSubmit));
                    }
                    else
                    {
                        labClientSession.multiSubmit = Convert.ToBoolean(queryMultiSubmit);
                    }
                }
                catch
                {
                    labClientSession.multiSubmit = false;
                }
                Logfile.Write(STRLOG_MultiSubmit + labClientSession.multiSubmit.ToString());

                Session[Consts.STRSSN_LabClient] = labClientSession;
            }

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName);
        }