using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; using System.Threading; using System.Linq; using Wayne.FDCPOSLibrary; using Wayne.Lib; using Wayne.Lib.Log; namespace Wayne.ForecourtControl.Fusion { public class FUSIONPump : IPumpEx, IIdentifiableEntity, IDisposable { // Fields private bool capFuelGradeSelected; private bool capNozzleDetection; private bool capSetLight; private bool capSuspendFuelling; private IFuelling currentFuelling; private string entitySubType; private bool fuelGradeSelected; private List fuellingList; private FUSIONManager manager; private int nfsPumpSymbol; private List nozzles; private bool open; private IIdentifiableEntity parerentDevice; private PriceGroup priceGroup; private int pumpId; private int offsetedPumpId; private int reservedBy; private Timer runningFuellingDataTimer; private bool _runningFuellingUpdates; private PumpState state; private TankLevelSwitchStatus tankLevelSwitchStatus; private int fuelMode; private ushort operationMode; // Events public event EventHandler OnEventOccured; public event EventHandler OnFuellingDataChange; public event EventHandler OnFuellingStateChange; public event EventHandler OnNozzleStateChange; public event EventHandler OnStateChange; public event EventHandler OnTankLevelSwitchStatusChange; public event EventHandler OnFuelModeChange; public event EventHandler OnOperationModeChange; public event EventHandler OnReservationStateChange; private readonly DebugLogger debugLogger; // Methods public FUSIONPump(FUSIONManager manager) { this.manager = manager; this.fuellingList = new List(); this.nozzles = new List(); this.currentFuelling = new FUSIONFuelling(manager, this); this.state = PumpState.Unknown; debugLogger = manager.DebugLogger; } private void DebugLog(string s) { if (debugLogger.IsActive()) debugLogger.Add(s); } public void AuthorizeAsync(byte? deviceId, IAuthorizeParameters authorizeParams, EventHandler> requestCompleted, object userToken) { //this.CheckDisposed(); //if (authorizeParams == null) //{ // throw new ArgumentException("Must supply a valid IAuthorizeParams object"); //} //FUSIONAsyncOperation operation = this.manager.AsyncManager.RegisterOperation>(this, requestCompleted, userToken); //this.SendAuthorizationRequest(0xcd, operation.Id, authorizeParams); while (this.manager.forecourtControl.fuelPriceReserved) { Thread.Sleep(200); DebugLog(String.Format("FUSIONPump.AuthorizeAsync: pumpId={0} - fuel price running, wait ...", this.realId)); } //generate the release token for the authorized fuelling int authorizationId = manager.PumpAuthIdSequence.GetNext(authorizeParams); FUSIONFuelling currentFuelling = null; currentFuelling = (FUSIONFuelling)(CurrentFuelling); currentFuelling.WritablePrice = 0; currentFuelling.WritableAmount = 0; currentFuelling.WritableQuantity = 0; currentFuelling.WritableNozzle = null; currentFuelling.WritableFuelGrade = 1; currentFuelling.WritableTransactionId = 0; currentFuelling.WritableFuellingSequenceNumber = 0; currentFuelling.WritableAuthorizationId = authorizationId; currentFuelling.WritablePresetType = authorizeParams.PresetType; currentFuelling.WritablePresetValue = authorizeParams.PresetValue; currentFuelling.WritablePriceGroup = authorizeParams.PriceGroup; currentFuelling.WritableCompletionDateTime = DateTime.Now; currentFuelling.WritableState = FuellingState.Unknown; DebugLog(String.Format("FUSIONPump.AuthorizeAsync: pumpId={0}, presetAmount={1}, reservingDeviceId={2}, fuellingType={3}", this.realId, currentFuelling.PresetValue, currentFuelling.ReservingDeviceId, currentFuelling.WritableReservingType)); this.manager.ifsfManager.AuthoriseFuelPoint(this.realId, authorizationId, currentFuelling.WritableReservingType, currentFuelling.ReservingDeviceId, authorizeParams, requestCompleted, userToken, this); } public void AuthorizeAsync(IAuthorizeParameters authorizeParams, EventHandler> requestCompleted, object userToken) { AuthorizeAsync(0, authorizeParams, requestCompleted, userToken); } public void AuthorizeUpdateAsync(byte? deviceId, IAuthorizeParameters authorizeParams, EventHandler requestCompleted, object userToken) { //this.CheckDisposed(); //if (authorizeParams == null) //{ // throw new ArgumentException("Must supply a valid IAuthorizeParams object"); //} //FUSIONAsyncOperation operation = this.manager.AsyncManager.RegisterOperation(this, requestCompleted, userToken); //this.SendAuthorizationRequest(0xd5, operation.Id, authorizeParams); } public void AuthorizeUpdateAsync(IAuthorizeParameters authorizeParams, EventHandler requestCompleted, object userToken) { AuthorizeUpdateAsync(0, authorizeParams, requestCompleted, userToken); } private void CheckDisposed() { if (this.manager == null) { throw new ObjectDisposedException("", "The pump object is not available anymore."); } } public void Dispose() { //if (this.runningFuellingDataTimer != null) //{ // this.runningFuellingDataTimer.Dispose(); //} this.manager = null; foreach (FUSIONNozzle nozzle in this.nozzles) { nozzle.Dispose(); } foreach (FUSIONFuelling fuelling in this.fuellingList) { fuelling.Dispose(); } ((FUSIONFuelling)this.currentFuelling).Dispose(); } internal void FireFuellingDataChange(IFuelling fuelling, decimal amount, decimal quantity) { OnFuellingDataChange.Fire(this, new FuellingDataChangeEventArgs(fuelling, amount, quantity)); } internal void FireFuellingStateChange(IFuelling fuelling, FuellingState state) { OnFuellingStateChange.Fire(this, new FuellingStateChangeEventArgs(fuelling, state)); } internal void FireNozzleStateChange(INozzle nozzle, NozzleState nozzleState) { OnNozzleStateChange.Fire(this, new NozzleStateChangeEventArgs(nozzle, nozzleState)); } internal void FirePumpEventOccured(PumpEventType pumpEventType) { OnEventOccured.Fire(this, new PumpEventOccuredEventArgs(pumpEventType)); } internal void FireFuelModeChange(int mode) { OnFuelModeChange.Fire(this, new FuelModeChangeEventArgs(this, mode)); } internal void FireOperationModeChange(ushort mode) { OnOperationModeChange.Fire(this, new OperationModeChangeEventArgs(this, mode)); } private void PerformStopPump(EventHandler requestCompleted, object userToken) { //FUSIONAsyncOperation operation = this.manager.AsyncManager.RegisterOperation(this, requestCompleted, userToken); //Function function = new Function(0xc9, ParserDomain.FillingServer, new Parameter[] { new PrimitiveParameter(0x17, PrimitiveType.Byte, this.pumpId) }); //this.manager.Send(function); //AsyncCompletedEventArgs resultEventArgs = new AsyncCompletedEventArgs(true, operation.UserToken); //operation.Complete(resultEventArgs); this.manager.ifsfManager.TerminateFuelling(this.realId, requestCompleted, userToken, this); } /// /// Reserve a pump /// /// /// /// /// public void ReserveAsync(FuellingType fuellingType, byte deviceId, EventHandler reservedCompleted, object userToken) { FUSIONFuelling currentFuelling = (FUSIONFuelling)(CurrentFuelling); DebugLog(String.Format("FUSIONPump.ReserveAsync: pumpId={0}\r\n\t" + "reservedBy={1}, this.manager.ifsfManager.clientSocket.applicationSender={2}\r\n\t" + "currentFuelling.WritableReservingType={3}, fuellingType={4}\r\n\t" + "currentFuelling.ReservingDeviceId={5}, deviceId={6}", this.realId, reservedBy, this.manager.ifsfManager.clientSocket.applicationSender, currentFuelling.WritableReservingType, fuellingType, currentFuelling.ReservingDeviceId, deviceId)); if (reservedBy == int.Parse(this.manager.ifsfManager.clientSocket.applicationSender) && currentFuelling.WritableReservingType == fuellingType && currentFuelling.ReservingDeviceId == deviceId && reservedCompleted != null) { DebugLog(String.Format("FUSIONPump.ReserveAsync: pumpId={0}, reservingDeviceId={1}, fuellingType={2} ALREADY RESERVED by the same DeviceId!", this.realId, currentFuelling.ReservingDeviceId, currentFuelling.WritableReservingType)); reservedCompleted(this, new AsyncCompletedEventArgs(true, userToken)); } else { currentFuelling.WritableReservingType = fuellingType; currentFuelling.WritableReservingDeviceId = deviceId; this.manager.ifsfManager.ReserveFuelPoint(this.realId, reservedCompleted, userToken, this); } } public void ResumeAsync(EventHandler resumeCompleted, object userToken) { //this.CheckDisposed(); //FUSIONAsyncOperation operation = this.manager.AsyncManager.RegisterOperation(this, resumeCompleted, userToken); //this.manager.Send(new Function(0xcb, ParserDomain.FillingServer, new Parameter[] { new PrimitiveParameter(0x66, PrimitiveType.UInt16, operation), new PrimitiveParameter(0x17, PrimitiveType.Byte, this.Id) })); this.manager.ifsfManager.ResumeFuelling(this.realId, resumeCompleted, userToken, this); //if (resumeCompleted != null) // resumeCompleted.Invoke(this, new AsyncCompletedEventArgs(true, userToken)); } public void StartFuelPointAsync(EventHandler startCompleted, object userToken) { this.manager.ifsfManager.StartFuelPoint(this.realId, startCompleted, userToken, this); } public void StopFuelPointAsync(EventHandler startCompleted, object userToken) { this.manager.ifsfManager.StopFuelPoint(this.realId, startCompleted, userToken, this); } private void RunningFuellingTimerProc(object state) { if (this.RunningFuellingUpdates && (this.manager != null)) { this.manager.RequestFillingData(this.pumpId, true); } } private void SendAuthorizationRequest(ushort fid, int sequenceNumber, IAuthorizeParameters authorizeParams) { //this.CheckDisposed(); //Function function = new Function(fid, ParserDomain.FillingServer, new Parameter[] { new PrimitiveParameter(0x66, PrimitiveType.UInt16, sequenceNumber), new PrimitiveParameter(0x17, PrimitiveType.Byte, this.pumpId), new PrimitiveParameter(0x16, PrimitiveType.Byte, NfsConvert.DecodePresetType(authorizeParams.PresetType)), new PrimitiveParameter(0x10, PrimitiveType.Decimal, authorizeParams.PresetValue), new PrimitiveParameter(0x27, PrimitiveType.Byte, NfsConvert.DecodePriceGroup(authorizeParams.PriceGroup)), new PrimitiveParameter(0x25, PrimitiveType.Byte, 0), new PrimitiveParameter(120, PrimitiveType.Byte, Convert.ToInt32(authorizeParams.LockToReleaseClient)) }); //ArrayParameter parameter = new ArrayParameter(14); //for (int i = 0; i < authorizeParams.AllowedFuelGrade.Count; i++) //{ // if (!authorizeParams.AllowedFuelGrade[i]) // { // parameter.Add(new PrimitiveParameter(0x1c, PrimitiveType.Byte, i)); // } //} //function.Add(parameter); //this.manager.Send(function); } public void SetBlockedAsync(bool blocked, EventHandler requestCompleted, object userToken) { //if (blocked) // this.manager.ifsfManager.LockNozzle(this.Id, -1, requestCompleted, userToken); //else // this.manager.ifsfManager.UnlockNozzle(this.Id, -1, requestCompleted, userToken); if (blocked) { this.manager.ifsfManager.CloseDevice(this.realId, requestCompleted, userToken, this); } else { this.manager.ifsfManager.GetDeviceState(Wayne.FDCPOSLibrary.DeviceType.DT_FuellingPoint, this.realId, null, null, null); this.manager.ifsfManager.OpenDevice(this.realId, requestCompleted, userToken, this); } //if (requestCompleted != null) // requestCompleted.Invoke(this, new AsyncCompletedEventArgs(true, userToken)); } public void TriggerStatusChangedEvent() { if (OnStateChange != null) { OnStateChange(this, new PumpStateChangeEventArgs(this, State)); } } public void SetPriceGroupAsync(PriceGroup priceGroup, EventHandler requestCompleted, object userToken) { var newFuelMode = manager.forecourtControl.ForecourtConfiguration.GetDefaultFuelMode(priceGroup); if (this.manager.forecourtControl.fuelPriceReserved) this.manager.ifsfManager.ChangeFuelModeAdd(this.manager.forecourtControl.srChangeMode, this.realId, newFuelMode, operationMode, requestCompleted, userToken, this); else this.manager.ifsfManager.ChangeFuelMode(this.realId, newFuelMode, operationMode, requestCompleted, userToken, this); // Update fuelling type for current fuelling //var currentFuelling = (FUSIONFuelling)(CurrentFuelling); //currentFuelling.WritableType = FuelModeMap.GetFuellingType(newFuelMode); } public void SetFuelModeAsync(int fuelMode, EventHandler requestCompleted, object userToken) { //var opMode = manager.forecourtControl.ForecourtConfiguration.Pumps.First(P => P.PumpNumber.Index == this.realId).GetOperationMode((OperationModeType)manager.forecourtControl.SiteMode); this.manager.ifsfManager.ChangeFuelMode(this.realId, fuelMode, null, requestCompleted, userToken, this); // Update fuelling type for current fuelling //var currentFuelling = (FUSIONFuelling)(CurrentFuelling); //currentFuelling.WritableType = FuelModeMap.GetFuellingType(fuelMode); } public void SetFuelModeAsync(int fuelMode, ushort opMode, EventHandler requestCompleted, object userToken) { this.manager.ifsfManager.ChangeFuelMode(this.realId, fuelMode, opMode, requestCompleted, userToken, this); } public void SignalEventAsync(PumpEventType eventType, EventHandler signalEventCompleted, object userToken) { //this.CheckDisposed(); //FUSIONAsyncOperation operation = this.manager.AsyncManager.RegisterOperation(this, signalEventCompleted, userToken); //Function function = new Function(0xd8, ParserDomain.FillingServer, new Parameter[] { new PrimitiveParameter(0x66, PrimitiveType.UInt16, operation.Id), new PrimitiveParameter(0x17, PrimitiveType.Byte, this.Id), new PrimitiveParameter(0x7a, PrimitiveType.UInt16, eventType) }); //this.manager.Send(function); } public void StopAsync(EventHandler requestCompleted, object userToken) { this.CheckDisposed(); this.PerformStopPump(requestCompleted, userToken); } public void SuspendAsync(EventHandler suspendCompleted, object userToken) { this.CheckDisposed(); // FUSIONAsyncOperation operation = this.manager.AsyncManager.RegisterOperation(this, suspendCompleted, userToken); // this.manager.Send(new Function(0xca, ParserDomain.FillingServer, new Parameter[] { new PrimitiveParameter(0x66, PrimitiveType.UInt16, operation), new PrimitiveParameter(0x17, PrimitiveType.Byte, this.Id) })); this.manager.ifsfManager.SuspendFuelling(this.realId, suspendCompleted, userToken, this); } public override string ToString() { return this.ToString("", CultureInfo.InvariantCulture); } public string ToString(IFormatProvider provider) { return this.ToString("", provider); } public string ToString(string format) { return this.ToString(format, CultureInfo.InvariantCulture); } public string ToString(string format, IFormatProvider provider) { return ("Pump DeviceId=" + this.pumpId.ToString(format, provider)); } public void UnauthorizeAsync(EventHandler requestCompleted, object userToken) { this.CheckDisposed(); this.PerformStopPump(requestCompleted, userToken); } public void UnreserveAsync(byte? deviceId, EventHandler requestCompleted, object userToken) { //this.CheckDisposed(); //FUSIONAsyncOperation operation = this.manager.AsyncManager.RegisterOperation(this, requestCompleted, userToken); //Function function = new Function(210, ParserDomain.FillingServer, new Parameter[] { new PrimitiveParameter(0x66, PrimitiveType.UInt16, operation.Id), new PrimitiveParameter(0x17, PrimitiveType.Byte, this.pumpId) }); //this.manager.Send(function); FUSIONFuelling currentFuelling = (FUSIONFuelling)(CurrentFuelling); DebugLog(String.Format("FUSIONPump.UnreserveAsync: pumpId={0}, reservingDeviceId={1}, fuellingType={2}", this.realId, currentFuelling.ReservingDeviceId, currentFuelling.WritableReservingType)); currentFuelling.WritableReservingType = FuellingType.Unknown; currentFuelling.WritableReservingDeviceId = 0; this.manager.ifsfManager.FreeFuelPoint(this.realId, requestCompleted, userToken, this); //if (requestCompleted != null) // requestCompleted.Invoke(this, new AsyncCompletedEventArgs(true, userToken)); } public void UnreserveAsync(EventHandler requestCompleted, object userToken) { UnreserveAsync(null, requestCompleted, userToken); } public PumpState convertPumpState(LogicalDeviceState fdcState, LogicalDeviceState fdcSubState) { if (fdcState == LogicalDeviceState.FDC_FUELLING && fdcSubState == LogicalDeviceState.FDC_FUELLING_TERMINATED) return PumpState.Suspended; else if (fdcState == LogicalDeviceState.FDC_REQUESTED) return PumpState.WaitingForConsent; else if (fdcState == LogicalDeviceState.FDC_AUTHORISED) return PumpState.Authorized; else if (fdcState == LogicalDeviceState.FDC_CALLING) return PumpState.Calling; //else if (fdcState == LogicalDeviceState.FDC_INACTIVATED) return PumpState.Closed; else if (fdcState == LogicalDeviceState.FDC_DISABLED) return PumpState.Closed; else if (fdcState == LogicalDeviceState.FDC_CLOSED) return PumpState.Closed; else if (fdcState == LogicalDeviceState.FDC_FUELLING) return PumpState.Fuelling; else if (fdcState == LogicalDeviceState.FDC_STARTED) return PumpState.Fuelling; else if (fdcState == LogicalDeviceState.FDC_READY && fdcSubState != LogicalDeviceState.FDC_STOPPED) return PumpState.Idle; else if (fdcState == LogicalDeviceState.FDC_OUTOFORDER) return PumpState.Inoperative; else if (fdcState == LogicalDeviceState.FDC_OFFLINE) return PumpState.Inoperative; else if (fdcState == LogicalDeviceState.FDC_SUSPENDED) return PumpState.Suspended; else if (fdcState == LogicalDeviceState.FDC_SUSPENDED_STARTED && fdcSubState != LogicalDeviceState.FDC_STOPPED) return PumpState.Suspended; else if (fdcState == LogicalDeviceState.FDC_SUSPENDED_FUELLING) return PumpState.Suspended; else if (fdcState == LogicalDeviceState.FDC_INVALIDSTATE) return PumpState.Unknown; else if (fdcState == LogicalDeviceState.FDC_UNDEFINED) return PumpState.Unknown; else if (fdcState == LogicalDeviceState.FDC_CONFIGURE) return PumpState.Closed; else if (fdcSubState == LogicalDeviceState.FDC_STOPPED) return PumpState.Stopped; #if !_USE_OLD_FCONTROL_ else if (fdcState == LogicalDeviceState.FDC_ERRORSTATE) return PumpState.Error; #else else if (fdcState == LogicalDeviceState.FDC_ERRORSTATE) return PumpState.Inoperative; #endif //else if (fdcState == LogicalDeviceState.FDC_LOCKED) return PumpState.Closed; else return PumpState.Unknown; } public IFuelling getFuellingByTransactionId(int transactionId, int releaseToken) { // first look for transactionId or for the authorizationId foreach (FUSIONFuelling fuelling in fuellingList) { if (transactionId > 0 && fuelling.TransactionId == transactionId || transactionId == 0 && fuelling.AuthorizationId == releaseToken) return fuelling; } return null; } #region Properties public bool Blocked { get { return this.State == PumpState.Closed; } } public bool CapFuelGradeSelected { get { return this.capFuelGradeSelected; } } public bool CapNozzleDetection { get { return this.capNozzleDetection; } } public bool CapSetLight { get { return this.capSetLight; } } public bool CapSuspendFuelling { get { return this.capSuspendFuelling; } } public bool Connected { get { return true; // Configured pumps should be always considered as connected } } public IFuelling CurrentFuelling { get { return this.currentFuelling; } } public string EntitySubType { get { return ""; } } public string EntityType { get { return "Pump"; } } /// /// This is used by the logger and should never be set by inheriting classes /// public string FullEntityName { get; set; } public FUSIONManager Manager { get { return this.manager; } } public bool FuelGradeSelected { get { return this.fuelGradeSelected; } } public ReadOnlyCollection Fuellings { get { return this.fuellingList.AsReadOnly(); } } public int Id { get { return this.offsetedPumpId; } } public int realId { get { return this.pumpId; } } internal int NfsPumpSymbol { get { return this.nfsPumpSymbol; } set { this.nfsPumpSymbol = value; } } public ReadOnlyCollection Nozzles { get { return new ReadOnlyCollection(new List(this.nozzles)); } } public bool Open { get { return this.State != PumpState.Closed && this.State != PumpState.Error && this.State != PumpState.Inoperative && this.State != PumpState.Unknown; } } public IIdentifiableEntity ParentEntity { get { return this.parerentDevice; } } public PriceGroup PriceGroup { get { return priceGroup; } } public int ReservedBy { get { return this.reservedBy; } } public bool RunningFuellingUpdates { get { //return (this.runningFuellingDataTimer != null); return _runningFuellingUpdates; } set { this.CheckDisposed(); if (value) { var timeout = manager.ifsfManager.clientSocket.runningFuellingTimeout; // Request current filling data immediately if (this.manager != null && timeout != 0) { this.manager.RequestFillingData(this.pumpId, true); this.runningFuellingDataTimer = new Timer(new TimerCallback(this.RunningFuellingTimerProc), null, timeout, timeout); } else { DebugLog("Running fuelling updates disabled by connection string"); } } else if (this.runningFuellingDataTimer != null) { this.runningFuellingDataTimer.Dispose(); this.runningFuellingDataTimer = null; } //if (value && !_runningFuellingUpdates) //{ // // send GetCurrentFuellingUpdates command // this.manager.ifsfManager.GetCurrentFuellingStatus(this.Id); //} //else if (!value && _runningFuellingUpdates) //{ //} _runningFuellingUpdates = value; } } public PumpState State { get { return this.state; } } public void NozzleStateChange(INozzle nozzle, NozzleState nozzleState) { if (this.OnNozzleStateChange != null) { DebugLog("OnNozzleStateChange.Invoke"); this.OnNozzleStateChange(this, new NozzleStateChangeEventArgs(nozzle, nozzleState)); } } public TankLevelSwitchStatus TankLevelSwitchStatus { get { return this.tankLevelSwitchStatus; } } public int FuelMode { get { return this.fuelMode; } } public ushort OperationMode { get { return operationMode; } } internal bool WritableCapFuelGradeSelected { get { return this.capFuelGradeSelected; } set { this.capFuelGradeSelected = value; } } internal bool WritableCapNozzleDetection { get { return this.capNozzleDetection; } set { this.capNozzleDetection = value; } } internal bool WritableCapSetLight { get { return this.capSetLight; } set { this.capSetLight = value; } } internal bool WritableCapSuspendFuelling { get { return this.capSuspendFuelling; } set { this.capSuspendFuelling = value; } } internal IFuelling WritableCurrentFuelling { get { return this.currentFuelling; } } internal string WritableDeviceName { get { return this.entitySubType; } set { this.entitySubType = value; } } internal bool WritableFuelGradeSelected { get { return this.fuelGradeSelected; } set { this.fuelGradeSelected = value; } } internal List WritableFuellingList { get { return this.fuellingList; } } internal List WritableNozzleList { get { return this.nozzles; } } internal IIdentifiableEntity WritableParentDevice { get { return this.parerentDevice; } set { this.parerentDevice = value; } } internal PriceGroup WritablePriceGroup { get { return this.priceGroup; } set { this.priceGroup = value; } } internal int WritablePumpId { get { return this.pumpId; } set { this.pumpId = value; if (manager.IdPumpShift != 0) this.offsetedPumpId = value + manager.IdPumpShift; else this.offsetedPumpId = value + manager.IdShift; } } internal int WritableReservedBy { get { return this.reservedBy; } set { if (this.reservedBy != value) { this.reservedBy = value; DebugLog("reservation state is different"); if (this.OnReservationStateChange != null) { DebugLog("OnReservationStateChange.Invoke"); this.OnReservationStateChange(this, new PumpReservationStateChangeEventArgs(this, this.reservedBy)); } } } } internal PumpState WritableState { get { return this.state; } set { if (this.state != value) { DebugLog("state is different"); if (this.OnStateChange != null) { this.state = value; DebugLog("OnStateChange.Invoke"); this.OnStateChange(this, new PumpStateChangeEventArgs(this, this.state)); } } } } internal TankLevelSwitchStatus WritableTankLevelSwitchStatus { get { return this.tankLevelSwitchStatus; } set { if (this.tankLevelSwitchStatus != value) { this.tankLevelSwitchStatus = value; if (this.OnTankLevelSwitchStatusChange != null) { this.OnTankLevelSwitchStatusChange(this, new TankLevelSwitchStatusChangeEventArgs(this, this.tankLevelSwitchStatus)); } } } } internal int WritableFuelMode { get { return this.fuelMode; } set { this.fuelMode = value; } } internal ushort WritableOperationMode { get { return this.operationMode; } set { this.operationMode = value; } } #endregion // properties } }