#region --------------- Copyright Dresser Wayne Pignone -------------
/*
* $Log: /Wrk/Support/ForecourtControl/Wrk/ForecourtControl/Com/IPump.cs $
*
* 5 07-02-26 14:06 roger.månsson
* Added pump Id.
*
* 4 07-02-16 9:59 roger.månsson
* FxCop changes
*
* 3 07-01-08 16:11 roger.månsson
* Added support for the SignalEvent/OnEventOccured on the pump
* interfaces.
*
* 2 07-01-05 9:01 roger.månsson
* Documentation changes
*/
#endregion
using System.Runtime.InteropServices;
using System.Diagnostics.CodeAnalysis;
namespace Wayne.ForecourtControl.Com
{
///
/// 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.
///
[ComVisible(true)]
public interface IPump
{
#region Properties
///
/// 0 based pump number for this instance.
///
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.
///
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
INozzle[] 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.
///
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
IFuelling[] Fuellings { get;}
///
/// Idle price group used to calculate the prices to show on the pump when the pump is idle.
/// When the pump is authorized, the pricegroup is specified again for that fuelling in the
/// AuthorizeParameters.
/// Use method SetPriceGroupAsync to change idle price group.
///
int 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; }
#endregion
#region Methods
#region Reserve
///
/// 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
void ReserveAsync(FuellingType fuellingType, byte deviceId, object userToken);
#endregion
#region Suspend
///
/// 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.
///
/// User supplied object that will be returned in the suspendCompleted callback.
void SuspendAsync(object userToken);
#endregion
#region Resume
///
/// Resumes a suspended fuelling
///
///
/// User supplied object that will be returned in the suspendCompleted callback.
void ResumeAsync(object userToken);
#endregion
#region Stop
///
/// Stops the current activity on the pump.
///
/// A user supplied object that will be returned in the requestCompleted callback
///
void StopAsync(object userToken);
#endregion
#region SetBlocked
///
/// Blocks or unblocks a pump for operation.
///
/// True if the pump should be blocked, and false if it should be unblocked.
/// A user supplied object that will be returned in the requestCompleted callback
void SetBlockedAsync(bool blocked, object userToken);
#endregion
#region SetPriceGroup
///
/// 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.
///
///
/// A user supplied object that will be returned in the requestCompleted callback
void SetPriceGroupAsync(int priceGroup, object userToken);
#endregion
#region Unreserve
///
/// Cancel pump reservation asynchronously. When the request is completed, the supplied delegate will be called.
/// After a call to this, the reference to the IReseredPump interface may not be used and
/// should be unreferenced.
///
/// A user supplied object that will be returned in the requestCompleted callback
void UnreserveAsync(object userToken);
#endregion
#region Authorize
///
/// 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.
///
///
/// Object that describes the rules for the authorization.
/// A user supplied object that will be returned in the requestCompleted callback
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
void AuthorizeAsync(IAuthorizeParameters authorizeParameters, object userToken);
#endregion
#region AuthorizeUpdate
///
/// 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.
///
/// Object that describes the rules for the authorization.
/// A user supplied object that will be returned in the requestCompleted callback
void AuthorizeUpdateAsync(IAuthorizeParameters authorizeParameters, object userToken);
#endregion
#region Unauthorize
///
/// Cancel of a fuelling authorization. This command is only allowed after a successful
/// call to Reserve() and Authorize.
/// This is the asynchronous version of the request, and will call
/// the supplied delegate on completion.
///
/// A user supplied object that will be returned in the requestCompleted callback
void UnauthorizeAsync(object userToken);
#endregion
#region SignalEvent
///
/// Signals that something regarding this pump has happened. The event will be signalled to all registered clients
/// using the OnEventOccured event. When the operation completes, it is signalled through the event OnSignalEventCompleted.
///
/// Type of the event that occured.
/// User token to be returned in the completion event.
void SignalEventAsync(PumpEventType pumpEventType, object userToken);
#endregion
#endregion
}
}