TotalCounters_TransactionData.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using Edge.Core.Parser.BinaryParser.Util;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace Wayne_Pump_Dart.MessageEntity.Incoming
  8. {
  9. /// <summary>
  10. /// The pump sends this transaction if Request Total Counters is received.
  11. /// </summary>
  12. public class TotalCounters_TransactionData
  13. {
  14. private TransactionData transactionData;
  15. public TotalCounters_TransactionData(TransactionData transactionData)
  16. {
  17. if (transactionData.TransactionNumber != 0x65)
  18. throw new ArgumentException("TotalCounters_TransactionData must have transaction number 0x65");
  19. if (transactionData.Length != 0x10)
  20. throw new ArgumentException("TotalCounters_TransactionData must have length 16");
  21. this.transactionData = transactionData;
  22. }
  23. /// <summary>
  24. /// Combine with `TotalValue`, `Meter1_TotalValue_Or_NumberOfFill` or `Meter2_TotalValue` property
  25. /// to know what's this proerperty for.
  26. /// </summary>
  27. public byte LogicalNozzleNumber { get { return this.transactionData.RawData.First(); } }
  28. /// <summary>
  29. /// `LogicalNozzleNumber` 01H-08H: this property is the Volume Totals for specifiec logical nozzle
  30. /// `LogicalNozzleNumber` 09H: this property is the sum of all logical nozzle Volume totals.
  31. /// `LogicalNozzleNumber` 11H-18H: this property is the Amount Totals for logical nozzle(substract 10H to get real logical nozzle number)
  32. /// `LogicalNozzleNumber` 19H: this property is the sum of all logical nozzle Amount totals.
  33. /// </summary>
  34. public int TotalValue { get { return this.transactionData.RawData.Skip(1).Take(5).GetBCD(); } }
  35. /// <summary>
  36. /// `LogicalNozzleNumber` 01H-08H: this property is the Primary meter Volume totals for logical nozzle.
  37. /// `LogicalNozzleNumber` 09H: this property is Not used shall be zero (0).
  38. /// `LogicalNozzleNumber` 11H-18H: this property is the Number of fillings for logical nozzle(substract 10H to get real logical nozzle number)
  39. /// `LogicalNozzleNumber` 19H: this property is the Total no of fillings for whole pump.
  40. /// </summary>
  41. public int Meter1_TotalValue_Or_NumberOfFill { get { return this.transactionData.RawData.Skip(6).Take(5).GetBCD(); } }
  42. /// <summary>
  43. /// `LogicalNozzleNumber` 01H-08H: this property is the Secondary meter Volume totals for logical nozzle.
  44. /// `LogicalNozzleNumber` 09H: this property is Not used shall be zero (0).
  45. /// `LogicalNozzleNumber` 11H-19H: this property is Not used shall be zero (0).
  46. /// </summary>
  47. public int Meter2_TotalValue { get { return this.transactionData.RawData.Skip(11).Take(5).GetBCD(); } }
  48. }
  49. }