IForecourtControl.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. #region --------------- Copyright Dresser Wayne Pignone -------------
  2. /*
  3. * $Log: /Wrk/Support/ForecourtControl/Wrk/ForecourtControl/IForecourtControl.cs $
  4. *
  5. * 5 07-10-18 17:12 roger.månsson
  6. * Added IForecourtControl.OnFuelPriceChange event.
  7. *
  8. * 4 07-03-08 13:08 roger.månsson
  9. * Added PricePoles
  10. *
  11. * 3 07-01-12 15:25 roger.månsson
  12. * Made IDisposable
  13. *
  14. * 2 07-01-05 15:10 roger.månsson
  15. * Added TankGroups property
  16. */
  17. #endregion
  18. using System;
  19. using System.Collections.Generic;
  20. namespace Wayne.ForecourtControl
  21. {
  22. /// <summary>
  23. /// The ForecourtControl object is the main root object to the Forecourtcontrol object hiearchy. It owns a list of pumps, and provides
  24. /// functionality to control the site.
  25. /// </summary>
  26. public interface IForecourtControl : Wayne.Lib.IConnectable,
  27. Wayne.Lib.IIdentifiableEntity,
  28. IDisposable
  29. {
  30. #region Properties
  31. /// <summary>
  32. /// ClientId in the communicationClientName in the communication to the Forecourt Controller.
  33. /// </summary>
  34. int ClientId { get;}
  35. /// <summary>
  36. /// ClientName in the communication to the Forecourt Controller.
  37. /// </summary>
  38. string ClientName { get;}
  39. /// <summary>
  40. /// Tells whether the site is open or closed.
  41. /// </summary>
  42. bool SiteOpened { get;}
  43. /// <summary>
  44. /// This property tells the operation mode of the site according to the pre-configured pump operation. Typically the configuration has been pre-defined with
  45. /// day, Night and rush hour operation modes, but this interface does not restrict which site mode that is used as day, night and rush-hour.
  46. /// </summary>
  47. int SiteMode { get;}
  48. /// <summary>
  49. /// The collection of pump objects.
  50. /// </summary>
  51. System.Collections.ObjectModel.ReadOnlyCollection<Wayne.ForecourtControl.IPumpEx> Pumps {get;}
  52. /// <summary>
  53. /// The collection of Fuel prices.
  54. /// </summary>
  55. System.Collections.ObjectModel.ReadOnlyCollection<Wayne.ForecourtControl.IFuelPrice> FuelPrices { get;}
  56. /// <summary>
  57. /// The collection of Tank groups.
  58. /// </summary>
  59. System.Collections.ObjectModel.ReadOnlyCollection<Wayne.ForecourtControl.ITankGroup> TankGroups { get;}
  60. /// <summary>
  61. /// The collection of Price poles.
  62. /// </summary>
  63. System.Collections.ObjectModel.ReadOnlyCollection<Wayne.ForecourtControl.IPricePole> PricePoles { get;}
  64. /// <summary>
  65. /// The collection of Price poles.
  66. /// </summary>
  67. System.Collections.ObjectModel.ReadOnlyCollection<Wayne.ForecourtControl.IFuelProduct> FuelProducts { get; }
  68. /// <summary>
  69. /// The collection of Fuel price reading from pump control.
  70. /// </summary>
  71. System.Collections.ObjectModel.ReadOnlyCollection<Wayne.ForecourtControl.IFuelPriceReading> FuelPriceReadings { get; }
  72. #endregion
  73. #region Methods
  74. /// <summary>
  75. /// Opens or closes the station.
  76. /// </summary>
  77. /// <param name="opened">True if the station should be opened, and false if it should be closed.</param>
  78. /// <param name="requestCompleted">Delegate that will be called on completion.</param>
  79. /// <param name="userToken">A user supplied object that will be returned in the requestCompleted callback</param>
  80. void SetSiteOpenedAsync(bool opened, EventHandler<Wayne.Lib.AsyncCompletedEventArgs> requestCompleted, object userToken);
  81. /// <summary>
  82. /// Sets the site mode. The pumps can be set in different modes for different site modes. This
  83. /// enables the option to have different day/night/rush modes of the station.
  84. /// </summary>
  85. /// <param name="siteMode">The new site mode.</param>
  86. /// <param name="requestCompleted">Delegate that will becalled on completion.</param>
  87. /// <param name="userToken">A user supplied object that will be returned in the requestCompleted callback</param>
  88. void SetSiteModeAsync(int siteMode, EventHandler<Wayne.Lib.AsyncCompletedEventArgs> requestCompleted,object userToken);
  89. /// <summary>
  90. /// Reserves the fuel prices so they can be changed by this client.
  91. /// </summary>
  92. /// <param name="requestCompleted">Callback delegate that will becalled on completion</param>
  93. /// <param name="userToken">A user supplied object that will be returned in the requestCompleted callback</param>
  94. void ReserveFuelPricesAsync(EventHandler<Wayne.Lib.AsyncCompletedEventArgs> requestCompleted, object userToken);
  95. /// <summary>
  96. /// Releases the fuel price reservation. If the fuel prices were no reserved, the function will still return success=true.
  97. /// Changes made to the fuel prices will be undone.
  98. /// </summary>
  99. /// <param name="requestCompleted">Callback delegate that will becalled on completion</param>
  100. /// <param name="userToken">A user supplied object that will be returned in the requestCompleted callback</param>
  101. void UnreserveFuelPricesAsync(EventHandler<Wayne.Lib.AsyncCompletedEventArgs> requestCompleted, object userToken);
  102. /// <summary>
  103. /// Activates the fuel prices, and triggers a new Fuel period when the prices has been activated.
  104. /// Note that it can take several minutes before all price signs and pumps have been updated.
  105. /// The FuelPrice reservation is released, so UnreserveFuelPricesAsync must not be called afterwards.
  106. /// </summary>
  107. /// <param name="requestCompleted">Callback delegate that will becalled on completion</param>
  108. /// <param name="userToken">A user supplied object that will be returned in the requestCompleted callback</param>
  109. void ActivateFuelPricesAsync(EventHandler<Wayne.Lib.AsyncCompletedEventArgs> requestCompleted, object userToken);
  110. /// <summary>
  111. /// Get Fuel prices.
  112. /// </summary>
  113. /// <param name="requestCompleted">Delegate that will be called on completion.</param>
  114. /// <param name="userToken">A user supplied object that will be returned in the requestCompleted callback</param>
  115. void GetFuelPricesAsync(EventHandler<Wayne.Lib.AsyncCompletedEventArgs<IList<IFuelPriceReading>>> requestCompleted, object userToken);
  116. /// <summary>
  117. /// Set Fuel prices.
  118. /// </summary>
  119. /// <param name="newFuelPrices">Price set information.</param>
  120. /// <param name="requestCompleted">Delegate that will be called on completion.</param>
  121. /// <param name="userToken">A user supplied object that will be returned in the requestCompleted callback</param>
  122. void SetFuelPriceAsync(IList<IFuelPriceReading> newFuelPrices, EventHandler<Wayne.Lib.AsyncCompletedEventArgs> requestCompleted, object userToken);
  123. /// <summary>
  124. /// Reserves the pump cluster for the specified terminal number. The terminal device id is 1-based.
  125. /// </summary>
  126. /// <param name="terminalDeviceId"></param>
  127. /// <param name="requestCompleted"></param>
  128. /// <param name="userToken"></param>
  129. void ReservePumpClusterAsync(int terminalDeviceId, EventHandler<Wayne.Lib.AsyncCompletedEventArgs> requestCompleted, object userToken);
  130. /// <summary>
  131. /// Unreserves the pump cluster for the specified terminal number. The terminal device id is 1-based.
  132. /// </summary>
  133. /// <param name="terminalDeviceId"></param>
  134. /// <param name="requestCompleted"></param>
  135. /// <param name="userToken"></param>
  136. void UnreservePumpClusterAsync(int terminalDeviceId, EventHandler<Wayne.Lib.AsyncCompletedEventArgs> requestCompleted, object userToken);
  137. /// <summary>
  138. /// Initiates a close reconciliation period at Fusion
  139. /// </summary>
  140. /// <param name="requestCompleted"></param>
  141. /// <param name="userToken"></param>
  142. void CloseReconciliationPeriodAsync(EventHandler<Wayne.Lib.AsyncCompletedEventArgs> requestCompleted, object userToken);
  143. /// <summary>
  144. /// Get Tank reconciliation
  145. /// </summary>
  146. /// <param name="deviceId">device ID</param>
  147. /// <param name="requestCompleted">Delegate that will be called on completion.</param>
  148. /// <param name="userToken">A user supplied object that will be returned in the requestCompleted callback</param>
  149. void GetTankReconciliationAsync(int deviceId, EventHandler<Wayne.Lib.AsyncCompletedEventArgs<ITankReconciliation>> requestCompleted, object userToken);
  150. /// <summary>
  151. /// Get Tank delivery
  152. /// </summary>
  153. /// <param name="deviceId">device ID</param>
  154. /// <param name="requestCompleted">Delegate that will be called on completion.</param>
  155. /// <param name="userToken">A user supplied object that will be returned in the requestCompleted callback</param>
  156. void GetTankDeliveryAsync(int deviceId, EventHandler<Wayne.Lib.AsyncCompletedEventArgs<ITankDelivery>> requestCompleted, object userToken);
  157. #endregion
  158. #region Events
  159. /// <summary>
  160. /// Event Fired when the site mode, i.e. the Site mode or the Site open/close mode has changed.
  161. /// </summary>
  162. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "OnSite")]
  163. event EventHandler<SiteModeChangeEventArgs> OnSiteModeChange;
  164. /// <summary>
  165. /// Configuration changed.
  166. /// </summary>
  167. event EventHandler<ConfigurationChangeEventArgs> OnConfigurationChange;
  168. /// <summary>
  169. /// Event that is raised when an alarm is fired from forecourt controller.
  170. /// </summary>
  171. event EventHandler<AlarmEventArgs> OnAlarm;
  172. /// <summary>
  173. /// Event fired when the fuel prices has been changed on the station and a new fuel price shift has been
  174. /// created.
  175. /// </summary>
  176. event EventHandler<FuelPriceChangeEventArgs> OnFuelPriceChange;
  177. #endregion
  178. /// <summary>
  179. /// Fires an DeviceAlarm request to ifsf server.
  180. /// </summary>
  181. /// <param name="deviceId"></param>
  182. /// <param name="deviceType"></param>
  183. /// <param name="alarmId"></param>
  184. /// <param name="requestCompleted"></param>
  185. /// <param name="userToken"></param>
  186. void SendDeviceAlarmAsync(int deviceId, string deviceType, IEnumerable<int> alarmIds, IEnumerable<string> messages,
  187. EventHandler<Wayne.Lib.AsyncCompletedEventArgs> requestCompleted, object userToken);
  188. }
  189. }