123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- using System;
- using Wayne.Lib;
- using Wayne.Lib.Log;
- namespace Wayne.ForecourtControl.Fusion
- {
- internal class FUSIONNozzle : INozzle, IIdentifiableEntity
- {
- // Fields
- private int fuelGrade;
- private int id;
- private NozzleState nozzleState = NozzleState.In;
- private FUSIONPump pump;
- private IIdentifiableEntity parentDevice;
- private int primaryTankGroupId;
- private int primaryTankGroupPercentage;
- private int secondaryTankGroupId;
- private FUSIONManager manager;
- private readonly DebugLogger debugLogger;
- // Methods
- public FUSIONNozzle(int id, FUSIONManager manager, FUSIONPump pump)
- {
- this.id = id;
- this.pump = pump;
- this.manager = manager;
- debugLogger = manager.DebugLogger;
- }
- internal void Dispose()
- {
- }
- public void ReadPumpAccumulatorAsync(EventHandler<AsyncCompletedEventArgs<PumpAccumulatorReading>> accumulatorsRead, object userToken)
- {
- this.pump.Manager.ifsfManager.GetFuelPointTotals(this.pump.realId, this.id, accumulatorsRead, userToken, this);
- }
- // Properties
- public string EntitySubType
- {
- get
- {
- return "";
- }
- }
- public string EntityType
- {
- get
- {
- return "Nozzle";
- }
- }
- /// <summary>
- /// This is used by the logger and should never be set by inheriting classes
- /// </summary>
- public string FullEntityName { get; set; }
- public int FuelGrade
- {
- get
- {
- if (manager.FuelGradeShift != 0)
- return this.fuelGrade + manager.FuelGradeShift;
- else
- return this.fuelGrade;
- }
- }
- /// <summary>
- /// use this property to move the values internally, this removes interference from the fuelgradeshift
- /// </summary>
- internal int WritableFuelGrade
- {
- get { return this.fuelGrade; }
- set { this.fuelGrade = value; }
- }
- public int Id
- {
- get
- {
- if (pump.Manager.IdNozzleShift > 0)
- return this.id + pump.Manager.IdNozzleShift;
- else
- return this.id + pump.Manager.IdShift;
- }
- }
- public int realId
- {
- get
- {
- return this.id;
- }
- set
- {
- this.id = value;
- }
- }
- public IIdentifiableEntity ParentEntity
- {
- get
- {
- return this.parentDevice;
- }
- }
- public int PrimaryTankGroupId
- {
- get
- {
- return this.primaryTankGroupId;
- }
- set
- {
- this.primaryTankGroupId = value;
- }
- }
- public int PrimaryTankGroupPercentage
- {
- get
- {
- return this.primaryTankGroupPercentage;
- }
- set
- {
- this.primaryTankGroupPercentage = value;
- }
- }
- public int SecondaryTankGroupId
- {
- get
- {
- return this.secondaryTankGroupId;
- }
- set
- {
- this.secondaryTankGroupId = value;
- }
- }
- /// <summary>
- /// Tank that nozzle is connected to
- /// </summary>
- public int PrimaryTankNo { get; set; }
- /// <summary>
- /// Tank that nozzle is connected to
- /// </summary>
- public int SecondaryTankNo { get; set; }
- public NozzleState State
- {
- get
- {
- return this.nozzleState;
- }
- set
- {
- if (debugLogger.IsActive())
- debugLogger.Add(string.Format("old State={0}, new State={1}", nozzleState, value));
- if (this.nozzleState != value)
- {
- this.nozzleState = value;
- pump.NozzleStateChange(this, this.nozzleState);
- }
- }
- }
- }
- }
|