#region --------------- Copyright Dresser Wayne Pignone -------------
/*
* $Log: /Wrk/Support/ForecourtControl/Wrk/ForecourtControl/IPump.cs $
*
* 8 07-05-21 16:28 roger.månsson
* Added TankLevelSwitchStatus property, and OnTankLevelSwitchStatusChange
* event.
*
* 7 07-02-16 9:59 roger.månsson
* FxCop changes
*
* 6 07-02-02 17:17 roger.månsson
* Changed so AuthorizeAsync takes IAuthorizeParameters interface instead
* of class (For COM support). SignalEventAsync uses PumpEventType instead
* of int.
*
* 5 07-01-09 9:28 roger.månsson
* Documentation fixes
*
* 4 07-01-08 16:11 roger.månsson
* Added support for the SignalEvent/OnEventOccured on the pump
* interfaces.
*
* 3 07-01-08 11:22 roger.månsson
* Added Id as a "new" parameter, so we can document it better.
*/
#endregion
using System;
namespace Wayne.ForecourtControl
{
///
/// The IPump interface represents a logical fuel dispenser. It does only contain the methods that can be called
/// without a pump reservation. When the pump is reserved, the IReservedPump interface is used, with an extended set
/// of methods.
///
public interface IPump : Wayne.Lib.IIdentifiableEntity
{
#region Properties
///
/// Pump id, zero based pump number. The pump number that will be displayed is 1-based, so in this
/// property, pump 1 will have Id 0.
///
new int Id { get;}
///
/// State of the pump.
///
PumpState State { get;}
///
/// Indicates if a valid fuel grade has been selected. Operation may be restricted
/// by CapFuelGradeSelected for pump protocols not supporting this feature.
///
bool FuelGradeSelected { get;}
///
/// 0 if not reserved.
/// If reserved then this contains the ClientId of the application that has reserved it (using Reserve command).
///
int ReservedBy { get;}
///
/// An array with Nozzles connected to this pump.
///
System.Collections.ObjectModel.ReadOnlyCollection Nozzles { get;}
///
/// Enable continous updates on the CurrentFuelling information during a fuelling. Events will be fired on OnFuellingDataChange
/// when the filling data has changed, and current fuelling will be updated.
///
bool RunningFuellingUpdates { get;set;}
///
/// The running fuelling object. this should reflect what is shown on the pump display.
///
IFuelling CurrentFuelling { get;}
///
/// Fuelling collection holding the fuellings availiable for payment.
///
System.Collections.ObjectModel.ReadOnlyCollection Fuellings { get;}
///
/// Price group that should be used to calculate the fuelling price.
/// It will aslo set the unit price(s) present when the pump is idle.
/// use SetPriceGroup to change the property.
///
PriceGroup PriceGroup { get;}
///
/// True if Suspend/Resume commands are supported by the pump/protocol.
///
bool CapSuspendFuelling { get;}
///
/// True if the pump light on/off command is supported by the pump/protocol.
///
bool CapSetLight { get;}
///
/// True if pump protocol is capable to report nozzle in/out
///
bool CapNozzleDetection { get;}
///
/// Indicates if the pump is capable to supply information when a fuel grade is selected.
///
bool CapFuelGradeSelected { get;}
///
/// Indicates if the pump is online to on the link.
///
bool Connected { get;}
///
/// Indicates if the pump is open.
///
bool Open { get;}
///
/// Indicates if the pump is blocked by a client
///
bool Blocked { get; }
///
/// Indicates the status of a low tank level switch. If no tank level switch exists on the pump or if no information has been received from it, the
/// status is 'unknown'.
///
TankLevelSwitchStatus TankLevelSwitchStatus { get;}
#endregion
#region Methods
///
/// Async version of Reserve()
///
/// The Device id that the pump will be reserved for. For example
/// the terminal number if it is reserved for a specific terminal.
/// The fuelling type that the pump will be reserved for.
///
/// A user supplied object that will be returned in the requestCompleted callback
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
void ReserveAsync(FuellingType fuellingType, byte deviceId, EventHandler reservedCompleted, object userToken);
///
/// Cancel pump reservation asynchronously. The reservation allows the the reservation owner to authorize the pump.
///
/// Delegate that will be called after completion of the request.
/// A user supplied object that will be returned in the requestCompleted callback
void UnreserveAsync(EventHandler requestCompleted, object userToken);
///
/// This command temporary suspends a running fuelling i.e. stops the pump motors.
/// It may be possible to continue the fuelling again when teh Resume command is
/// called but not all pump modles support Suspend / Resume handling. In this case
/// the fuelling will be stopped without any possibility to resume operation.
///
/// Callback delegate that is called on completion.
/// User supplied object that will be returned in the suspendCompleted callback.
void SuspendAsync(EventHandler suspendCompleted, object userToken);
///
/// Resumes a suspended fuelling
///
///
/// Callback delegate that is called on completion.
/// User supplied object that will be returned in the suspendCompleted callback.
void ResumeAsync(EventHandler resumeCompleted, object userToken);
///
/// Stops the current activity on the pump.
///
/// Delegate that gets called when operation is completed.
/// A user supplied object that will be returned in the requestCompleted callback
///
void StopAsync(EventHandler requestCompleted, object userToken);
///
/// Blocks or unblocks a pump for operation.
///
/// True if the pump should be blocked, and false if it should be unblocked.
/// Delegate that gets called when operation is completed
/// A user supplied object that will be returned in the requestCompleted callback
void SetBlockedAsync(bool blocked, EventHandler requestCompleted, object userToken);
///
/// Sets the Idle price group for the pump. This is the price group that will be used to calculate the fuelprice
/// that is shown on the pump display.
///
///
/// Delegate that gets called when operation is completed
/// A user supplied object that will be returned in the requestCompleted callback
void SetPriceGroupAsync(PriceGroup priceGroup, EventHandler requestCompleted, object userToken);
///
/// Authorize pump for fuelling.
/// The supplied AuthoriseParameters object contains the volume amount and grade restrictions of the
/// release. The AsyncCompletedEventArgs will also contain a result (long) that will contain the AuthorizationId
/// for the authorization. This can be matched with the IFuelling.AuthorizationId when the fuelling is running or
/// is finished. This method may only be called when the pump is successfully reserved.
///
///
/// Object that describes the rules for the authorization.
/// Delegate that will be called after completion of the request.
/// A user supplied object that will be returned in the requestCompleted callback
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
void AuthorizeAsync(IAuthorizeParameters authorizeParameters, EventHandler> requestCompleted, object userToken);
///
/// Update of the limits for an already authorised pump. This is the asynchronous version of the request, and will call
/// the supplied delegate on completion. This method may only be called when the pump is successfully reserved.
///
/// Object that describes the rules for the authorization.
/// Delegate that will be called after completion of the request.
/// A user supplied object that will be returned in the requestCompleted callback
void AuthorizeUpdateAsync(IAuthorizeParameters authorizeParameters, EventHandler requestCompleted, object userToken);
///
/// Cancel of a fuelling authorization.
/// This is the asynchronous version of the request, and will call
/// the supplied delegate on completion. This method may only be called when the pump is successfully reserved.
///
/// Delegate that will be called after completion of the request.
/// A user supplied object that will be returned in the requestCompleted callback
void UnauthorizeAsync(EventHandler requestCompleted, object userToken);
///
/// Signals that something regarding this pump has happened. The event will be signalled to all registered clients
/// using the OnEventOccured event.
///
///
///
///
void SignalEventAsync(PumpEventType eventType, EventHandler signalEventCompleted, object userToken);
string ToString();
#endregion
#region Events
///
/// Fired when a pump state is changed
///
event EventHandler OnStateChange;
///
/// Fired when a Nozzle has been hooked in or out. Returns a handle to itself. Event firing is dependent on CapNozzleDetection
///
event EventHandler OnNozzleStateChange;
///
/// Fired when a fuelling is running and the volume and amount values has changed.
///
event EventHandler OnFuellingDataChange;
///
/// Fired when the state or reservation of a fuelling has changed. Returns a handle affected fuelling.
///
event EventHandler OnFuellingStateChange;
///
/// Event that is fired when a client has signalled an event using the SignalEventAsync method or from inside the forecourt
/// controller.
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Occured")]
event EventHandler OnEventOccured;
///
/// Event that is fired when the status of the tank level switch has changed.
///
event EventHandler OnTankLevelSwitchStatusChange;
#endregion
}
}