コード例 #1
0
        /// <summary>
        /// Reads the billing data.
        /// </summary>
        /// <param name="portlist">The portlist.</param>
        /// <param name="proxy">The proxy.</param>
        /// <param name="clientGuid">The client GUID.</param>
        private static void ReadBillingData(string portName, SmlComServiceClient proxy, Guid clientGuid)
        {
            Console.WriteLine("Reading billing data.");
            var result = proxy.ReadLastPushedBillingData(clientGuid, portList.FirstOrDefault(m => m.ComPortName == portName));
            //Console.WriteLine("BillingData: " + Stringify(result));
            if (result != null)
            {
                if (result.ActiveEnergyPlusTotalSigned != null)
                {
                    Console.WriteLine(
                       "Signed +A billingData available for port {0}, Verification {1}.",
                       portName,
                       (SignatureVerificationResult)result.ActiveEnergyPlusTotalSigned.SignatureVerificationStatus);
                }
                else if (result.ActiveEnergyMinusTotalSigned != null)
                {
                    Console.WriteLine(
                       "Signed -A billingData available for port {0}, Verification {1}.",
                       portName,
                       (SignatureVerificationResult)result.ActiveEnergyPlusTotalSigned.SignatureVerificationStatus);
                }
                else if (result.ActiveEnergyPlusTotal != null)
                {
                    Console.WriteLine("Unsigned +A BillingData available for port {0}, ServerId {1}, Second index {2}.", portName, BitConverter.ToString(result.ServerId), result.OperationSecondCounter);
                }
                else if (result.ActiveEnergyMinusTotal != null)
                {
                    Console.WriteLine("Unsigned -A BillingData available for port {0}.", portName);
                }
            }
            else
            {
                Console.WriteLine("BillingData failed for port {0}.", portName);
            }

            Console.WriteLine();
        }