Exemplo n.º 1
0
        private static void Openbalancing(RS232 paramcom, ValenceBattery paramBattery)
        {
            var errorMsg = "Open balancing Return  Error!";

            try
            {
                paramcom.Write(paramBattery.OpenbalancingRead());
                if (paramcom.Read(6) == -1)
                {
                    throw new Exception(errorMsg);
                }
                if (!paramBattery.OpenbalancingReturn(paramcom.InputStream))
                {
                    throw new Exception(errorMsg);
                }
            }
            catch (Exception ex)
            {
                WriteError(ex.Message.ToString());
                throw new Exception("Error during  Open balancing check: " + ex.Message);
            }
        }