FUSIONNozzle.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. using System;
  2. //using System.Diagnostics;
  3. using Wayne.Lib;
  4. #if _SINP
  5. using Wayne.ForecourtControl.Nfs;
  6. #endif
  7. namespace Wayne.ForecourtControl.Fusion
  8. {
  9. internal class FUSIONNozzle : INozzle, IIdentifiableEntity
  10. {
  11. // Fields
  12. private int fuelGrade;
  13. private int id;
  14. private NozzleState nozzleState = NozzleState.In;
  15. private FUSIONPump pump;
  16. private IIdentifiableEntity parentDevice;
  17. private int primaryTankGroupId;
  18. private int primaryTankGroupPercentage;
  19. private int secondaryTankGroupId;
  20. // Methods
  21. public FUSIONNozzle(int id, FUSIONPump pump)
  22. {
  23. this.id = id;
  24. this.pump = pump;
  25. }
  26. internal void Dispose()
  27. {
  28. }
  29. public void ReadPumpAccumulatorAsync(EventHandler<AsyncCompletedEventArgs<PumpAccumulatorReading>> accumulatorsRead, object userToken)
  30. {
  31. //throw new Exception("The method or operation is not implemented.");
  32. this.pump.Manager.ifsfManager.GetFuelPointTotals(this.pump.realId, this.id, accumulatorsRead, userToken, this);
  33. }
  34. // Properties
  35. public string EntitySubType
  36. {
  37. get
  38. {
  39. return "";
  40. }
  41. }
  42. public string EntityType
  43. {
  44. get
  45. {
  46. return "Nozzle";
  47. }
  48. }
  49. /// <summary>
  50. /// This is used by the logger and should never be set by implementing classes
  51. /// </summary>
  52. public string FullEntityName { get; set; }
  53. public int FuelGrade
  54. {
  55. get
  56. {
  57. return this.fuelGrade;
  58. }
  59. set
  60. {
  61. this.fuelGrade = value;
  62. }
  63. }
  64. public int Id
  65. {
  66. get
  67. {
  68. if (pump.Manager.IdNozzleShift > 0)
  69. return this.id + pump.Manager.IdNozzleShift;
  70. else
  71. return this.id + pump.Manager.IdShift;
  72. }
  73. }
  74. public int realId
  75. {
  76. get
  77. {
  78. return this.id;
  79. }
  80. set
  81. {
  82. this.id = value;
  83. }
  84. }
  85. public IIdentifiableEntity ParentEntity
  86. {
  87. get
  88. {
  89. return this.parentDevice;
  90. }
  91. }
  92. public int PrimaryTankGroupId
  93. {
  94. get
  95. {
  96. return this.primaryTankGroupId;
  97. }
  98. set
  99. {
  100. this.primaryTankGroupId = value;
  101. }
  102. }
  103. public int PrimaryTankGroupPercentage
  104. {
  105. get
  106. {
  107. return this.primaryTankGroupPercentage;
  108. }
  109. set
  110. {
  111. this.primaryTankGroupPercentage = value;
  112. }
  113. }
  114. public int SecondaryTankGroupId
  115. {
  116. get
  117. {
  118. return this.secondaryTankGroupId;
  119. }
  120. set
  121. {
  122. this.secondaryTankGroupId = value;
  123. }
  124. }
  125. public NozzleState State
  126. {
  127. get
  128. {
  129. return this.nozzleState;
  130. }
  131. set
  132. {
  133. Trace.WriteLine(string.Format("old State={0}, new State={1}", nozzleState, value));
  134. if (this.nozzleState != value)
  135. {
  136. this.nozzleState = value;
  137. pump.NozzleStateChange(this, this.nozzleState);
  138. }
  139. }
  140. }
  141. }
  142. }