Esempio n. 1
0
        /// <summary>
        /// command specific implementation 
        /// argVal command class member has all user-entered command argument indicators and parameter values
        /// Currently just prints all argument indicators and argument values
        /// </summary>
        internal override void commandImplementation()
        {
            LedStatusResponse myResponse = new LedStatusResponse();
            try
            {
                myResponse = WcsCli2CmConnectionManager.channel.GetChassisAttentionLEDStatus();
            }
            catch (Exception ex)
            {
                SharedFunc.ExceptionOutput(ex);
                return;
            }

            if (myResponse == null)
            {
                Console.WriteLine(WcsCliConstants.serviceResponseEmpty);
                return;
            }

            if (myResponse.completionCode == Contracts.CompletionCode.Success)
            {
                Console.WriteLine("Chassis LED: " + myResponse.ledState);
            }
            else if (myResponse.completionCode == Contracts.CompletionCode.Failure)
            {
                Console.WriteLine(WcsCliConstants.commandFailure);
            }
            else if (myResponse.completionCode == Contracts.CompletionCode.Timeout)
            {
                Console.WriteLine(WcsCliConstants.commandTimeout);
            }
            else
            {
                Console.WriteLine("Command failed with the completion code: {0}", myResponse.completionCode.ToString());
            }
        }
        /// <summary>
        /// Get Chassis Attention LED Status
        /// </summary>
        /// <returns>LED status response</returns>
        public LedStatusResponse GetChassisAttentionLEDStatus()
        {
            LedStatusResponse response = new LedStatusResponse();
            response.completionCode = Contracts.CompletionCode.Unknown;
            response.statusDescription = String.Empty;
            Tracer.WriteInfo("Received GetChassisAttentionLEDStatus API");
            Tracer.WriteUserLog("Invoked GetChassisAttentionLEDStatus API");

            // Get Chassis Status LED.
            response = ChassisState.AttentionLed.GetLedStatus();

            if (response.completionCode != (byte)Contracts.CompletionCode.Success)
            {
                Tracer.WriteError("Chassis Attention LED status failed with Completion Code: {0:X}", response.completionCode);
            }
            else
            {
                if (response.ledState == LedState.ON)
                {
                    Tracer.WriteInfo("Chassis AttentionLED status: ON");
                }
                else if (response.ledState == LedState.OFF)
                {
                    Tracer.WriteInfo("Chassis AttentionLED status: OFF");
                }
                else
                {
                    Tracer.WriteInfo("Chassis AttentionLED status: NA");
                }
            }

            response.completionCode =
                ChassisManagerUtil.GetContractsCompletionCodeMapping((byte)response.completionCode);
            if (response.completionCode != Contracts.CompletionCode.Success)
            {
                response.statusDescription = response.completionCode.ToString();
            }

            return response;
        }
        /// <summary>
        /// command specific implementation 
        /// argVal command class member has all user-entered command argument indicators and parameter values
        /// Currently just prints all argument indicators and argument values
        /// </summary>
        internal override void commandImplementation()
        {
            LedStatusResponse myResponse = new LedStatusResponse();
            try
            {
                myResponse = WcsCli2CmConnectionManager.channel.GetChassisAttentionLEDStatus();
            }
            catch (Exception ex)
            {
                SharedFunc.ExceptionOutput(ex);
                return;
            }

            if (ResponseValidation.ValidateResponse(null, myResponse, false))
            {
                Console.WriteLine(WcsCliConstants.commandSuccess + " Chassis LED: " + myResponse.ledState);
            }
        }