public static StatusInquiryInfo StatusInquiry()
 {
     string[] source = UPSModule.WriteAndReadFromUPS("Q1").Replace('(', ' ').Replace("\r", " ").Replace(".", ",").Split(new char[] { ' ' });
     StatusInquiryInfo info = new StatusInquiryInfo();
     if (source.Count<string>() == 10)
     {
         char[] chArray = source[8].ToCharArray();
         info = new StatusInquiryInfo {
             Success = true,
             IVoltage = Convert.ToDouble(source[1]),
             IFaultVoltage = Convert.ToDouble(source[2]),
             OVoltage = Convert.ToDouble(source[3]),
             OMaximumCurrent = Convert.ToInt32(source[4]),
             IFrequency = Convert.ToDouble(source[5]),
             BatteryVoltage = Convert.ToDouble(source[6]),
             Temperature = Convert.ToDouble(source[7]),
             UPSStatus = source[8],
             UtilityFail_Immediate = CharToBin(chArray[0]),
             BatteryLow = CharToBin(chArray[1]),
             Bypass_Boost_or_Buck_Active = CharToBin(chArray[2]),
             UPS_Failed = CharToBin(chArray[3]),
             UPSTypeisStandby_0isOn_line = CharToBin(chArray[4]),
             TestinProgress = CharToBin(chArray[5]),
             ShutdownActive = CharToBin(chArray[6]),
             BeeperOn = CharToBin(chArray[7])
         };
     }
     return info;
 }
        public static StatusInquiryInfo StatusInquiry()
        {
            string[]          source = UPSModule.WriteAndReadFromUPS("Q1").Replace('(', ' ').Replace("\r", " ").Replace(".", ",").Split(new char[] { ' ' });
            StatusInquiryInfo info   = new StatusInquiryInfo();

            if (source.Count <string>() == 10)
            {
                char[] chArray = source[8].ToCharArray();
                info = new StatusInquiryInfo {
                    Success                     = true,
                    IVoltage                    = Convert.ToDouble(source[1]),
                    IFaultVoltage               = Convert.ToDouble(source[2]),
                    OVoltage                    = Convert.ToDouble(source[3]),
                    OMaximumCurrent             = Convert.ToInt32(source[4]),
                    IFrequency                  = Convert.ToDouble(source[5]),
                    BatteryVoltage              = Convert.ToDouble(source[6]),
                    Temperature                 = Convert.ToDouble(source[7]),
                    UPSStatus                   = source[8],
                    UtilityFail_Immediate       = CharToBin(chArray[0]),
                    BatteryLow                  = CharToBin(chArray[1]),
                    Bypass_Boost_or_Buck_Active = CharToBin(chArray[2]),
                    UPS_Failed                  = CharToBin(chArray[3]),
                    UPSTypeisStandby_0isOn_line = CharToBin(chArray[4]),
                    TestinProgress              = CharToBin(chArray[5]),
                    ShutdownActive              = CharToBin(chArray[6]),
                    BeeperOn                    = CharToBin(chArray[7])
                };
            }
            return(info);
        }