/// <summary>
 /// Default ctor
 /// </summary>
 public SwitchState(ISwitch entity, RailwayState railwayState)
     : base(entity, railwayState)
 {
     address         = entity.Address;
     feedbackAddress = entity.HasFeedback ? (entity.FeedbackAddress ?? entity.Address) : null;
     direction       = new StateProperty <SwitchDirection>(this, SwitchDirection.Straight, null, OnRequestedDirectionChanged, null);
 }
Beispiel #2
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public LocState(ILoc entity, RailwayState railwayState)
     : base(entity, railwayState)
 {
     address = entity.Address;
     controlledAutomatically = new StateProperty <bool>(this, false, ValidateControlledAutomatically, null, OnControlledAutomaticallyChanged);
     automaticState          = new ActualStateProperty <AutoLocState>(this, AutoLocState.AssignRoute, null, OnAutomaticStateChanged);
     possibleDeadlock        = new ActualStateProperty <bool>(this, false, null, null);
     currentRoute            = new ActualStateProperty <IRouteStateForLoc>(this, null, null, null);
     waitAfterCurrentRoute   = new ActualStateProperty <bool>(this, false, null, null);
     nextRoute    = new ActualStateProperty <IRouteState>(this, null, null, null);
     currentBlock = new ActualStateProperty <IBlockState>(this, null, ValidateCurrentBlock, x => {
         recentlyVisitedBlocks.Insert(x);
         SaveCurrentBlock();
     });
     currentBlockEnterSide           = new ActualStateProperty <BlockSide>(this, BlockSide.Back, null, x => SaveCurrentBlock());
     startNextRouteTime              = new ActualStateProperty <DateTime>(this, DateTime.Now, null, null);
     durationExceedsCurrentRouteTime = new ActualStateProperty <DateTime>(this, DateTime.MaxValue, null, null);
     speedInSteps   = new StateProperty <int>(this, 0, LimitSpeedSteps, OnRequestedSpeedStepsChanged, null);
     speed          = new SpeedProperty(this);
     direction      = new StateProperty <LocDirection>(this, LocDirection.Forward, null, OnRequestedDirectionChanged, x => SaveCurrentBlock());
     reversing      = new ActualStateProperty <bool>(this, false, ValidateReversing, null);
     f0             = new StateProperty <bool>(this, true, null, OnRequestedFunctionChanged, null);
     functionStates = new Dictionary <LocFunction, IStateProperty <bool> >();
     foreach (var lf in entity.Functions)
     {
         var f = new StateProperty <bool>(this, false, null, OnRequestedFunctionChanged, null);
         functionStates[lf.Function] = f;
     }
     lastRouteOptions = new ActualStateProperty <IRouteOption[]>(this, null, null, null);
 }
Beispiel #3
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public Clock4StageOutputState(IClock4StageOutput output, RailwayState railwayState)
     : base(output, railwayState)
 {
     address1 = output.Address1;
     address2 = output.Address2;
     period   = new StateProperty <Clock4Stage>(this, Clock4Stage.Morning, null, OnPeriodRequestedValueChanged, null);
     pattern  = new StateProperty <int>(this, DefaultValues.DefaultClock4StageOutputMorningPattern, null, OnPatternRequestedChanged, OnPatternActualChanged);
 }
 /// <summary>
 /// Default ctor
 /// </summary>
 public BlockSignalState(IBlockSignal entity, RailwayState railwayState)
     : base(entity, railwayState)
 {
     address1 = entity.Address1;
     address2 = (address1 != null) ? entity.Address2: null;
     address3 = (address2 != null) ? entity.Address3 : null;
     address4 = (address3 != null) ? entity.Address4 : null;
     color    = new StateProperty <BlockSignalColor>(this, BlockSignalColor.Red, ValidateColor, OnRequestedColorChanged, null);
 }
Beispiel #5
0
 /// <summary>
 /// Default ctor
 /// </summary>
 protected CommandStationState(ICommandStation entity, RailwayState railwayState, string[] addressSpaces)
     : base(entity, railwayState)
 {
     Log                = LogManager.GetLogger(LogNames.CommandStationPrefix + entity.Description);
     myWorker           = new AsynchronousWorker("csworker-" + entity.Description);
     this.addressSpaces = addressSpaces ?? Empty <string> .Array;
     power              = new StateProperty <bool>(this, false, null,
                                                   x => PostWorkerAction(() => OnRequestedPowerChanged(x)),
                                                   OnActualPowerChanged, false);
     myWorker.Wait += OnWorkerWait;
 }
Beispiel #6
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public TurnTableState(ITurnTable entity, RailwayState railwayState)
     : base(entity, railwayState)
 {
     positionAddress1 = entity.PositionAddress1;
     positionAddress2 = (positionAddress1 != null) ? entity.PositionAddress2 : null;
     positionAddress3 = (positionAddress2 != null) ? entity.PositionAddress3 : null;
     positionAddress4 = (positionAddress3 != null) ? entity.PositionAddress4 : null;
     positionAddress5 = (positionAddress4 != null) ? entity.PositionAddress5 : null;
     positionAddress6 = (positionAddress5 != null) ? entity.PositionAddress6 : null;
     invertPositions  = entity.InvertPositions;
     writeAddress     = entity.WriteAddress;
     invertWrite      = entity.InvertWrite;
     busyAddress      = entity.BusyAddress;
     invertBusy       = entity.InvertBusy;
     firstPosition    = entity.FirstPosition;
     lastPosition     = entity.LastPosition;
     initialPosition  = entity.InitialPosition;
     position         = new StateProperty <int>(this, -1, null, OnRequestedPositionChanged, null);
     busyInput        = new BusyInput(this);
 }
 /// <summary>
 /// Default ctor
 /// </summary>
 public BinaryOutputState(IBinaryOutput output, RailwayState railwayState)
     : base(output, railwayState)
 {
     active = new StateProperty <bool>(this, false, null, OnActiveRequestedChanged, OnActiveActualChanged);
 }
Beispiel #8
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public BlockState(IBlock block, RailwayState railwayState)
     : base(block, railwayState)
 {
     closed          = new StateProperty <bool>(this, false, null, x => UpdateClosed(), x => SaveClosed());
     waitPermissions = new LocPredicateState(block.WaitPermissions, railwayState);
 }