IPump.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. #region --------------- Copyright Dresser Wayne Pignone -------------
  2. /*
  3. * $Log: /Wrk/Support/ForecourtControl/Wrk/ForecourtControl/Com/IPump.cs $
  4. *
  5. * 5 07-02-26 14:06 roger.månsson
  6. * Added pump Id.
  7. *
  8. * 4 07-02-16 9:59 roger.månsson
  9. * FxCop changes
  10. *
  11. * 3 07-01-08 16:11 roger.månsson
  12. * Added support for the SignalEvent/OnEventOccured on the pump
  13. * interfaces.
  14. *
  15. * 2 07-01-05 9:01 roger.månsson
  16. * Documentation changes
  17. */
  18. #endregion
  19. using System.Runtime.InteropServices;
  20. using System.Diagnostics.CodeAnalysis;
  21. namespace Wayne.ForecourtControl.Com
  22. {
  23. /// <summary>
  24. /// The IPump interface represents a logical fuel dispenser. It does only contain the methods that can be called
  25. /// without a pump reservation. When the pump is reserved, the IReservedPump interface is used, with an extended set
  26. /// of methods.
  27. /// </summary>
  28. [ComVisible(true)]
  29. public interface IPump
  30. {
  31. #region Properties
  32. /// <summary>
  33. /// 0 based pump number for this instance.
  34. /// </summary>
  35. int Id { get;}
  36. /// <summary>
  37. /// State of the pump.
  38. /// </summary>
  39. PumpState State { get;}
  40. /// <summary>
  41. /// Indicates if a valid fuel grade has been selected. Operation may be restricted
  42. /// by <c>CapFuelGradeSelected</c> for pump protocols not supporting this feature.
  43. /// </summary>
  44. bool FuelGradeSelected { get;}
  45. /// <summary>
  46. /// 0 if not reserved.
  47. /// If reserved then this contains the ClientId of the application that has reserved it (using <c>Reserve</c> command).
  48. /// </summary>
  49. int ReservedBy { get;}
  50. /// <summary>
  51. /// An array with Nozzles connected to this pump.
  52. /// </summary>
  53. [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
  54. INozzle[] Nozzles { get;}
  55. /// <summary>
  56. /// Enable continous updates on the CurrentFuelling information during a fuelling. Events will be fired on OnFuellingDataChange
  57. /// when the filling data has changed, and current fuelling will be updated.
  58. /// </summary>
  59. bool RunningFuellingUpdates { get;set;}
  60. /// <summary>
  61. /// The running fuelling object. this should reflect what is shown on the pump display.
  62. /// </summary>
  63. IFuelling CurrentFuelling { get;}
  64. /// <summary>
  65. /// Fuelling collection holding the fuellings availiable for payment.
  66. /// </summary>
  67. [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
  68. IFuelling[] Fuellings { get;}
  69. /// <summary>
  70. /// Idle price group used to calculate the prices to show on the pump when the pump is idle.
  71. /// When the pump is authorized, the pricegroup is specified again for that fuelling in the
  72. /// AuthorizeParameters.
  73. /// Use method SetPriceGroupAsync to change idle price group.
  74. /// </summary>
  75. int PriceGroup { get;}
  76. /// <summary>
  77. /// True if Suspend/Resume commands are supported by the pump/protocol.
  78. /// </summary>
  79. bool CapSuspendFuelling { get;}
  80. /// <summary>
  81. /// True if the pump light on/off command is supported by the pump/protocol.
  82. /// </summary>
  83. bool CapSetLight { get;}
  84. /// <summary>
  85. /// True if pump protocol is capable to report nozzle in/out
  86. /// </summary>
  87. bool CapNozzleDetection { get;}
  88. /// <summary>
  89. /// Indicates if the pump is capable to supply information when a fuel grade is selected.
  90. /// </summary>
  91. bool CapFuelGradeSelected { get;}
  92. /// <summary>
  93. /// Indicates if the pump is online to on the link.
  94. /// </summary>
  95. bool Connected { get;}
  96. /// <summary>
  97. /// Indicates if the pump is open.
  98. /// </summary>
  99. bool Open { get;}
  100. /// <summary>
  101. /// Indicates if the pump is blocked by a client
  102. /// </summary>
  103. bool Blocked { get; }
  104. #endregion
  105. #region Methods
  106. #region Reserve
  107. /// <summary>
  108. /// Async version of Reserve() <see cref="IPump.ReserveAsync"/>
  109. /// </summary>
  110. /// <param name="deviceId">The Device id that the pump will be reserved for. For example
  111. /// the terminal number if it is reserved for a specific terminal.</param>
  112. /// <param name="fuellingType">The fuelling type that the pump will be reserved for.</param>
  113. /// <param name="userToken">A user supplied object that will be returned in the requestCompleted callback</param>
  114. void ReserveAsync(FuellingType fuellingType, byte deviceId, object userToken);
  115. #endregion
  116. #region Suspend
  117. /// <summary>
  118. /// This command temporary suspends a running fuelling i.e. stops the pump motors.
  119. /// It may be possible to continue the fuelling again when teh <c>Resume</c> command is
  120. /// called but not all pump modles support Suspend / Resume handling. In this case
  121. /// the fuelling will be stopped without any possibility to resume operation.
  122. /// </summary>
  123. /// <param name="userToken">User supplied object that will be returned in the suspendCompleted callback.</param>
  124. void SuspendAsync(object userToken);
  125. #endregion
  126. #region Resume
  127. /// <summary>
  128. /// Resumes a suspended fuelling
  129. /// </summary>
  130. /// <see cref="IPump.SuspendAsync"/>
  131. /// <param name="userToken">User supplied object that will be returned in the suspendCompleted callback.</param>
  132. void ResumeAsync(object userToken);
  133. #endregion
  134. #region Stop
  135. /// <summary>
  136. /// Stops the current activity on the pump.
  137. /// </summary>
  138. /// <param name="userToken">A user supplied object that will be returned in the requestCompleted callback</param>
  139. /// <see cref="IPump.StopAsync"/>
  140. void StopAsync(object userToken);
  141. #endregion
  142. #region SetBlocked
  143. /// <summary>
  144. /// Blocks or unblocks a pump for operation.
  145. /// </summary>
  146. /// <param name="blocked">True if the pump should be blocked, and false if it should be unblocked.</param>
  147. /// <param name="userToken">A user supplied object that will be returned in the requestCompleted callback</param>
  148. void SetBlockedAsync(bool blocked, object userToken);
  149. #endregion
  150. #region SetPriceGroup
  151. /// <summary>
  152. /// Sets the Idle price group for the pump. This is the price group that will be used to calculate the fuelprice
  153. /// that is shown on the pump display.
  154. /// </summary>
  155. /// <param name="priceGroup"></param>
  156. /// <param name="userToken">A user supplied object that will be returned in the requestCompleted callback</param>
  157. void SetPriceGroupAsync(int priceGroup, object userToken);
  158. #endregion
  159. #region Unreserve
  160. /// <summary>
  161. /// Cancel pump reservation asynchronously. When the request is completed, the supplied delegate will be called.
  162. /// After a call to this, the reference to the IReseredPump interface may not be used and
  163. /// should be unreferenced.
  164. /// </summary>
  165. /// <param name="userToken">A user supplied object that will be returned in the requestCompleted callback</param>
  166. void UnreserveAsync(object userToken);
  167. #endregion
  168. #region Authorize
  169. /// <summary>
  170. /// Authorize pump for fuelling.
  171. /// The supplied AuthoriseParameters object contains the volume amount and grade restrictions of the
  172. /// release. The AsyncCompletedEventArgs will also contain a result (long) that will contain the AuthorizationId
  173. /// for the authorization. This can be matched with the IFuelling.AuthorizationId when the fuelling is running or
  174. /// is finished.
  175. /// </summary>
  176. /// <see cref="IFuelling.AuthorizationId"/>
  177. /// <param name="authorizeParameters">Object that describes the rules for the authorization.</param>
  178. /// <param name="userToken">A user supplied object that will be returned in the requestCompleted callback</param>
  179. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
  180. void AuthorizeAsync(IAuthorizeParameters authorizeParameters, object userToken);
  181. #endregion
  182. #region AuthorizeUpdate
  183. /// <summary>
  184. /// Update of the limits for an already authorised pump. This is the asynchronous version of the request, and will call
  185. /// the supplied delegate on completion.
  186. /// </summary>
  187. /// <param name="authorizeParameters">Object that describes the rules for the authorization.</param>
  188. /// <param name="userToken">A user supplied object that will be returned in the requestCompleted callback</param>
  189. void AuthorizeUpdateAsync(IAuthorizeParameters authorizeParameters, object userToken);
  190. #endregion
  191. #region Unauthorize
  192. /// <summary>
  193. /// Cancel of a fuelling authorization. This command is only allowed after a successful
  194. /// call to <c>Reserve()</c> and <c>Authorize</c>.
  195. /// This is the asynchronous version of the request, and will call
  196. /// the supplied delegate on completion.
  197. /// </summary>
  198. /// <param name="userToken">A user supplied object that will be returned in the requestCompleted callback</param>
  199. void UnauthorizeAsync(object userToken);
  200. #endregion
  201. #region SignalEvent
  202. /// <summary>
  203. /// Signals that something regarding this pump has happened. The event will be signalled to all registered clients
  204. /// using the OnEventOccured event. When the operation completes, it is signalled through the event OnSignalEventCompleted.
  205. /// </summary>
  206. /// <param name="pumpEventType">Type of the event that occured.</param>
  207. /// <param name="userToken">User token to be returned in the completion event.</param>
  208. void SignalEventAsync(PumpEventType pumpEventType, object userToken);
  209. #endregion
  210. #endregion
  211. }
  212. }