コード例 #1
0
ファイル: StatusLed.cs プロジェクト: waflores/ChassisManager
        /// <summary>
        /// get LED status
        /// </summary>
        internal Contracts.LedStatusResponse GetLedStatus()
        {
            Contracts.LedStatusResponse response = new Contracts.LedStatusResponse();
            response.completionCode = Contracts.CompletionCode.Failure;
            response.ledState       = Contracts.LedState.NA;

            LedStatusResponse ledStatus = (LedStatusResponse)this.SendReceive(DeviceType.RearAttentionLed, deviceId, new LedStatusRequest(),
                                                                              typeof(LedStatusResponse), (byte)PriorityLevel.User);

            if (ledStatus.CompletionCode != 0)
            {
                return(response);
            }
            else
            {
                if (ledStatus.LedStatus == 0)
                {
                    response.ledState       = Contracts.LedState.OFF;
                    response.completionCode = Contracts.CompletionCode.Success;
                }
                else if (ledStatus.LedStatus == 1)
                {
                    response.ledState       = Contracts.LedState.ON;
                    response.completionCode = Contracts.CompletionCode.Success;
                }
                else
                {
                    response.ledState       = Contracts.LedState.NA;
                    response.completionCode = Contracts.CompletionCode.Failure;
                }
                return(response);
            }
        }
コード例 #2
0
ファイル: StatusLed.cs プロジェクト: kewencai/ChassisManager
        /// <summary>
        /// get LED status
        /// </summary>
        internal Contracts.LedStatusResponse GetLedStatus()
        {
            Contracts.LedStatusResponse response = new Contracts.LedStatusResponse();
            response.completionCode = Contracts.CompletionCode.Failure;
            response.ledState = Contracts.LedState.NA;
            
            LedStatusResponse ledStatus = (LedStatusResponse)this.SendReceive(DeviceType.RearAttentionLed, deviceId, new LedStatusRequest(),
                typeof(LedStatusResponse), (byte)PriorityLevel.User);

            if (ledStatus.CompletionCode != 0)
            {
                return response;
            }
            else
            {
                if (ledStatus.LedStatus == 0)
                {
                    response.ledState = Contracts.LedState.OFF;
                    response.completionCode = Contracts.CompletionCode.Success;
                }
                else if (ledStatus.LedStatus == 1)
                {
                    response.ledState = Contracts.LedState.ON;
                    response.completionCode = Contracts.CompletionCode.Success;
                }
                else
                {
                    response.ledState = Contracts.LedState.NA;
                    response.completionCode = Contracts.CompletionCode.Failure;
                }
                return response;
            }
        }
        /// <summary>
        /// Gets the current status of rear attention LED for the chassis
        /// </summary>
        /// <returns></returns>
        private static byte GetRearAttentionLedStatus()
        {
            // Gets the LED status response
            Contracts.LedStatusResponse ledStatus = new Contracts.LedStatusResponse();
            ledStatus = ChassisState.AttentionLed.GetLedStatus();

            if (ledStatus.completionCode != Contracts.CompletionCode.Success)
            {
                Tracer.WriteWarning("Internal getRearAttentionLedStatus - getting status failed with Completion Code {0:X}",
                                    ledStatus.completionCode);
                return((byte)LedStatus.NA);
            }
            else
            {
                return((byte)ledStatus.ledState);
            }
        }
        /// <summary>
        /// Gets the current status of rear attention LED for the chassis
        /// </summary>
        /// <returns></returns>
        private static byte GetRearAttentionLedStatus()
        {
            // Gets the LED status response
            Contracts.LedStatusResponse ledStatus = new Contracts.LedStatusResponse();
            ledStatus = ChassisState.AttentionLed.GetLedStatus();

            if (ledStatus.completionCode != Contracts.CompletionCode.Success)
            {
                Tracer.WriteWarning("Internal getRearAttentionLedStatus - getting status failed with Completion Code {0:X}",
                    ledStatus.completionCode);
                return (byte)LedStatus.NA;
            }
            else
            {
                return (byte)ledStatus.ledState;
            }
        }