예제 #1
0
 private static void ReadWattHour(RS232 paramcom, ValenceBattery parambattery)
 {
     try
     {
         paramcom.Write(parambattery.BatteryWHRead());
         if (paramcom.Read(11) != -1)
         {
             if (!parambattery.BatteryWHReturn(paramcom.InputStream))
             {
                 throw new Exception("Read Watt Hour Error");
             }
             Console.WriteLine($"Watt Hours: {Convert.ToString(parambattery.WattHour)}");
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message.ToString());
     }
 }