//构造方法 public Lift() { openningState = new OpeningState(this); closingState = new ClosingState(this); runningState = new RunningState(this); stoppingState = new StoppingState(this); }
public Lift(ILiftSettings liftSettings, int currentCurrentFloor) { _liftSettings = liftSettings; CurrentFloor = currentCurrentFloor; _moveToFloor = CurrentFloor; _state = LiftState.Closed; }
/// <summary> /// Elevator arrives at a stop. update the list and state. /// </summary> void OnStop() { Debug.Log("OnStop, elv:" + elvId); UpStops.Remove(CurrentFloor); DownStops.Remove(CurrentFloor); InsideRequest.Remove(CurrentFloor); if (UpStops.Count == 0 && DownStops.Count == 0) { LiftState = LiftState.Still; UpdateElevatorVisual(true); } else { // change the state, Update will pause movement if (LiftState == LiftState.Up) { LiftState = LiftState.PauseUp; UpdateElevatorVisual(true); } else if (LiftState == LiftState.Down) { LiftState = LiftState.PauseDown; UpdateElevatorVisual(true); } } stopNotify?.Invoke(CurrentFloor, LiftState); handleStateUpdate?.Invoke(CurrentFloor, LiftState); }
/// <summary> /// Updates the state in response to the Lift event (changed floor and/or /// updated state) /// </summary> /// <param name="floor">Floor.</param> /// <param name="state">State.</param> public void UpdateState(int floor, LiftState state) { FloorTitle.text = floor.ToString(); currentFloor = floor; switch (state) { case LiftState.PauseDown: case LiftState.PauseUp: HandleStop(floor); break; case LiftState.Down: EnableDownArrow(true); EnableUpArrow(false); break; case LiftState.Up: EnableUpArrow(true); EnableDownArrow(false); break; default: EnableUpArrow(false); EnableDownArrow(false); HandleStop(floor); break; } }
void Start() { CurrentLevel = LiftLevel.Level_00; CurrentLiftState = LiftState.notMoving; CurrentLiftSelection = LevelSelection.LvlUnselected; LiftAnim = Lift.GetComponent <Animator>(); }
/// <summary> /// Prepares the move down. /// </summary> void PrepareMoveDown() { if (DownStops.Count > 0) { Vector3 currentPos = transform.position; int targetFloor = DownStops.Max(); Debug.Log("PrepareMoveDown target:" + targetFloor); TargetPosition = new Vector3(currentPos.x, floorPositionY[targetFloor], currentPos.z); LiftState = LiftState.Down; UpdateElevatorVisual(false); } }
static async Task <MethodResponse> DownMethodCallBack(MethodRequest methodRequest, object userContext) { Console.WriteLine($"Executing DownMethodCallBack at {DateTime.UtcNow}"); if (methodRequest == null) { Console.WriteLine($"Moving to initial state"); } var downResponse = new DownResponse { responseState = 0 }; try { _liftState = LiftState.MovingDown; var task = Task.Run(async() => { await LedScenarios.PlayDownScene(_mcp23xxxWrite, UpDownInterval); }); if (!InDebugMode) { _controller.Write(DownRelayPin, PinValue.Low); // start action } else { Console.WriteLine("WARNING: While in debug mode, no DOWN movements are executed!"); } await Task.Delay(UpDownInterval); _controller.Write(DownRelayPin, PinValue.High); // stop action Console.WriteLine($"Down ended at {DateTime.UtcNow}."); _liftState = LiftState.Down; } catch (Exception ex) { _liftState = LiftState.Unknown; downResponse.errorMessage = ex.Message; downResponse.responseState = -999; } var json = JsonConvert.SerializeObject(downResponse); var response = new MethodResponse(Encoding.UTF8.GetBytes(json), 200); return(response); }
/// <summary> /// Setup the specified elvId, numFloors, state, selectedFloors, floorUpdate and onClose. /// </summary> /// <param name="elvId">Elv identifier.</param> /// <param name="numFloors">Number floors.</param> /// <param name="state">State.</param> /// <param name="selectedFloors">Selected floors.</param> /// <param name="floorUpdate">Floor update.</param> /// <param name="onClose">On close.</param> public void Setup(int elvId, int numFloors, LiftState state, IEnumerable <int> selectedFloors, Action <int> floorUpdate, Action onClose) { OnFloorSelect = floorUpdate; OnClose = onClose; totalFloors = numFloors; if (selectedFloors != null) { SelectedFloors = new HashSet <int>(selectedFloors); } InitButtons(); UpdateState(0, state); ElevatorTitle.text = string.Format("ELEVATOR {0}", elvId); }
private void OnStateChanged(LiftState _) { string str; switch (Lift.Direction) { case MoveDirection.Up: str = moveUp; break; case MoveDirection.Down: str = moveDown; break; default: str = stay; break; } _text.text = str; }
private void LiftStateChanged(LiftState inState) { StopAllCoroutines(); switch (inState) { case LiftState.Moving: case LiftState.Closed: LaunchActiveState(); break; case LiftState.Opening: case LiftState.Closing: LaunchSwitchingState(); break; case LiftState.Opened: LaunchOpenedState(); break; } }
/// <summary> /// Handles the elevator arrival. Cancel the highlight on the requesting /// floor button. /// </summary> /// <param name="floor">Floor.</param> /// <param name="state">State.</param> void HandleElevatorArrival(int floor, LiftState state) { //Debug.Log("floor " + floor + " got an elevator, state = " + state ); switch (state) { case LiftState.PauseDown: if (floor == 0) { buttonPanels[floor].ResetUpButton(); } else { buttonPanels[floor].ResetDownButton(); } break; case LiftState.PauseUp: if (floor == numOfFloors - 1) { buttonPanels[floor].ResetDownButton(); } else { buttonPanels[floor].ResetUpButton(); } break; case LiftState.Still: buttonPanels[floor].ResetUpButton(); buttonPanels[floor].ResetDownButton(); break; } // Cancel request foreach (Elevator elevator in elevators) { elevator.CancelRequest(floor); } }
static async Task <MethodResponse> UpMethodCallBack(MethodRequest methodRequest, object userContext) { Console.WriteLine($"Executing UpMethodCallBack at {DateTime.UtcNow}"); var upResponse = new UpResponse { responseState = 0 }; try { _liftState = LiftState.MovingUp; var task = Task.Run(async() => { await LedScenarios.PlayUpScene(_mcp23xxxWrite, UpDownInterval); }); _controller.Write(UpRelayPin, PinValue.Low); // start action await Task.Delay(UpDownInterval); _controller.Write(UpRelayPin, PinValue.High); // stop action Console.WriteLine($"Up ended at {DateTime.UtcNow}."); _liftState = LiftState.Up; } catch (Exception ex) { _liftState = LiftState.Unknown; upResponse.errorMessage = ex.Message; upResponse.responseState = -999; } var json = JsonConvert.SerializeObject(upResponse); var response = new MethodResponse(Encoding.UTF8.GetBytes(json), 200); return(response); }
public void LiftState_MustReadValueFromItsName_WhenDeserialized(LiftState expectedState, string input) { LiftState state = JsonConvert.DeserializeObject <LiftState>(input); Assert.Equal(expectedState, state); }
IEnumerator GoToLevel() { // if pressed the same level if ((CurrentLiftSelection == LevelSelection.Lvl00) && (CurrentLevel == LiftLevel.Level_00)) { print("already at level G"); } if ((CurrentLiftSelection == LevelSelection.Lvl02) && (CurrentLevel == LiftLevel.Level_02)) { print("already at level 2"); } if ((CurrentLiftSelection == LevelSelection.Lvl03) && (CurrentLevel == LiftLevel.Level_03)) { print("already at level 3"); } if ((CurrentLiftSelection == LevelSelection.Lvl04) && (CurrentLevel == LiftLevel.Level_04)) { print("already at level 4"); } if ((CurrentLiftSelection == LevelSelection.Lvl05) && (CurrentLevel == LiftLevel.Level_05)) { print("already at level 5"); } //if At Level G if ((CurrentLiftSelection == LevelSelection.Lvl02) && (CurrentLevel == LiftLevel.Level_00)) { LiftAnim.SetTrigger("Close"); yield return(new WaitForSeconds(1)); //LiftAnim.Stop("LiftDoorClose"); CurrentLiftState = LiftState.movingUp; if (CurrentLevel == LiftLevel.Level_02) { CurrentLiftState = LiftState.notMoving; //CurrentLevel = LiftLevel.Level_01; CurrentLiftSelection = LevelSelection.LvlUnselected; LiftAnim.SetTrigger("Close"); print("reached Level 2"); } } if ((CurrentLiftSelection == LevelSelection.Lvl03) && (CurrentLevel == LiftLevel.Level_00)) { LiftAnim.SetTrigger("Close"); yield return(new WaitForSeconds(1)); //LiftAnim.Stop("LiftDoorClose"); CurrentLiftState = LiftState.movingUp; if (CurrentLevel == LiftLevel.Level_03) { CurrentLiftState = LiftState.notMoving; //CurrentLevel = LiftLevel.Level_02; CurrentLiftSelection = LevelSelection.LvlUnselected; LiftAnim.SetTrigger("Open"); print("reached Level 3"); } } if ((CurrentLiftSelection == LevelSelection.Lvl04) && (CurrentLevel == LiftLevel.Level_00)) { LiftAnim.SetTrigger("Close"); yield return(new WaitForSeconds(1)); //LiftAnim.Stop("LiftDoorClose"); CurrentLiftState = LiftState.movingUp; if (CurrentLevel == LiftLevel.Level_04) { CurrentLiftState = LiftState.notMoving; //CurrentLevel = LiftLevel.Level_03; CurrentLiftSelection = LevelSelection.LvlUnselected; LiftAnim.SetTrigger("Open"); print("reached Level 4"); } } if ((CurrentLiftSelection == LevelSelection.Lvl05) && (CurrentLevel == LiftLevel.Level_00)) { LiftAnim.SetTrigger("Close"); yield return(new WaitForSeconds(1)); //LiftAnim.Stop("LiftDoorClose"); CurrentLiftState = LiftState.movingUp; if (CurrentLevel == LiftLevel.Level_05) { CurrentLiftState = LiftState.notMoving; //CurrentLevel = LiftLevel.Level_03; CurrentLiftSelection = LevelSelection.LvlUnselected; LiftAnim.SetTrigger("Open"); print("reached Level 5"); } } //if At Level 2 if ((CurrentLiftSelection == LevelSelection.Lvl00) && (CurrentLevel == LiftLevel.Level_02)) { LiftAnim.SetTrigger("Close"); yield return(new WaitForSeconds(1)); //LiftAnim.Stop("LiftDoorClose"); CurrentLiftState = LiftState.movingDown; if (CurrentLevel == LiftLevel.Level_00) { CurrentLiftState = LiftState.notMoving; //CurrentLevel = LiftLevel.Level_00; CurrentLiftSelection = LevelSelection.LvlUnselected; LiftAnim.SetTrigger("Open"); print("reached Level G"); } } if ((CurrentLiftSelection == LevelSelection.Lvl03) && (CurrentLevel == LiftLevel.Level_02)) { LiftAnim.SetTrigger("Close"); yield return(new WaitForSeconds(1)); //LiftAnim.Stop("LiftDoorClose"); CurrentLiftState = LiftState.movingUp; if (CurrentLevel == LiftLevel.Level_03) { CurrentLiftState = LiftState.notMoving; //CurrentLevel = LiftLevel.Level_03; CurrentLiftSelection = LevelSelection.LvlUnselected; LiftAnim.SetTrigger("Open"); print("reached Level 3"); } } if ((CurrentLiftSelection == LevelSelection.Lvl04) && (CurrentLevel == LiftLevel.Level_02)) { LiftAnim.SetTrigger("Close"); yield return(new WaitForSeconds(1)); //LiftAnim.Stop("LiftDoorClose"); CurrentLiftState = LiftState.movingUp; if (CurrentLevel == LiftLevel.Level_04) { CurrentLiftState = LiftState.notMoving; //CurrentLevel = LiftLevel.Level_03; CurrentLiftSelection = LevelSelection.LvlUnselected; LiftAnim.SetTrigger("Open"); print("reached Level 4"); } } if ((CurrentLiftSelection == LevelSelection.Lvl05) && (CurrentLevel == LiftLevel.Level_02)) { LiftAnim.SetTrigger("Close"); yield return(new WaitForSeconds(1)); //LiftAnim.Stop("LiftDoorClose"); CurrentLiftState = LiftState.movingUp; if (CurrentLevel == LiftLevel.Level_05) { CurrentLiftState = LiftState.notMoving; //CurrentLevel = LiftLevel.Level_03; CurrentLiftSelection = LevelSelection.LvlUnselected; LiftAnim.SetTrigger("Open"); print("reached Level 5"); } } //if At Level 3 if ((CurrentLiftSelection == LevelSelection.Lvl00) && (CurrentLevel == LiftLevel.Level_03)) { LiftAnim.SetTrigger("Close"); yield return(new WaitForSeconds(1)); //LiftAnim.Stop("LiftDoorClose"); CurrentLiftState = LiftState.movingDown; if (CurrentLevel == LiftLevel.Level_00) { CurrentLiftState = LiftState.notMoving; //CurrentLevel = LiftLevel.Level_00; CurrentLiftSelection = LevelSelection.LvlUnselected; LiftAnim.SetTrigger("Open"); print("reached Level G"); } } if ((CurrentLiftSelection == LevelSelection.Lvl02) && (CurrentLevel == LiftLevel.Level_03)) { LiftAnim.SetTrigger("Close"); yield return(new WaitForSeconds(1)); //LiftAnim.Stop("LiftDoorClose"); CurrentLiftState = LiftState.movingDown; if (CurrentLevel == LiftLevel.Level_02) { CurrentLiftState = LiftState.notMoving; //CurrentLevel = LiftLevel.Level_01; CurrentLiftSelection = LevelSelection.LvlUnselected; LiftAnim.SetTrigger("Open"); print("reached Level 2"); } } if ((CurrentLiftSelection == LevelSelection.Lvl04) && (CurrentLevel == LiftLevel.Level_03)) { LiftAnim.SetTrigger("Close"); yield return(new WaitForSeconds(1)); //LiftAnim.Stop("LiftDoorClose"); CurrentLiftState = LiftState.movingUp; if (CurrentLevel == LiftLevel.Level_04) { CurrentLiftState = LiftState.notMoving; //CurrentLevel = LiftLevel.Level_03; CurrentLiftSelection = LevelSelection.LvlUnselected; LiftAnim.SetTrigger("Open"); print("reached Level 4"); } } if ((CurrentLiftSelection == LevelSelection.Lvl05) && (CurrentLevel == LiftLevel.Level_03)) { LiftAnim.SetTrigger("Close"); yield return(new WaitForSeconds(1)); //LiftAnim.Stop("LiftDoorClose"); CurrentLiftState = LiftState.movingUp; if (CurrentLevel == LiftLevel.Level_05) { CurrentLiftState = LiftState.notMoving; //CurrentLevel = LiftLevel.Level_03; CurrentLiftSelection = LevelSelection.LvlUnselected; LiftAnim.SetTrigger("Open"); print("reached Level 5"); } } //if At Level 4 if ((CurrentLiftSelection == LevelSelection.Lvl00) && (CurrentLevel == LiftLevel.Level_04)) { LiftAnim.SetTrigger("Close"); yield return(new WaitForSeconds(1)); //LiftAnim.Stop("LiftDoorClose"); CurrentLiftState = LiftState.movingDown; if (CurrentLevel == LiftLevel.Level_00) { CurrentLiftState = LiftState.notMoving; // CurrentLevel = LiftLevel.Level_00; CurrentLiftSelection = LevelSelection.LvlUnselected; LiftAnim.SetTrigger("Open"); print("reached Level G"); } } if ((CurrentLiftSelection == LevelSelection.Lvl02) && (CurrentLevel == LiftLevel.Level_04)) { LiftAnim.SetTrigger("Close"); yield return(new WaitForSeconds(1)); //LiftAnim.Stop("LiftDoorClose"); CurrentLiftState = LiftState.movingDown; if (CurrentLevel == LiftLevel.Level_02) { CurrentLiftState = LiftState.notMoving; //CurrentLevel = LiftLevel.Level_01; CurrentLiftSelection = LevelSelection.LvlUnselected; LiftAnim.SetTrigger("Open"); print("reached Level 2"); } } if ((CurrentLiftSelection == LevelSelection.Lvl03) && (CurrentLevel == LiftLevel.Level_04)) { LiftAnim.SetTrigger("Close"); yield return(new WaitForSeconds(1)); //LiftAnim.Stop("LiftDoorClose"); CurrentLiftState = LiftState.movingDown; if (CurrentLevel == LiftLevel.Level_03) { CurrentLiftState = LiftState.notMoving; //CurrentLevel = LiftLevel.Level_02; CurrentLiftSelection = LevelSelection.LvlUnselected; LiftAnim.SetTrigger("Open"); print("reached Level 3"); } } if ((CurrentLiftSelection == LevelSelection.Lvl05) && (CurrentLevel == LiftLevel.Level_04)) { LiftAnim.SetTrigger("Close"); yield return(new WaitForSeconds(1)); //LiftAnim.Stop("LiftDoorClose"); CurrentLiftState = LiftState.movingDown; if (CurrentLevel == LiftLevel.Level_05) { CurrentLiftState = LiftState.notMoving; //CurrentLevel = LiftLevel.Level_02; CurrentLiftSelection = LevelSelection.LvlUnselected; LiftAnim.SetTrigger("Open"); print("reached Level 5"); } } //if At Level 4 if ((CurrentLiftSelection == LevelSelection.Lvl00) && (CurrentLevel == LiftLevel.Level_05)) { LiftAnim.SetTrigger("Close"); yield return(new WaitForSeconds(1)); //LiftAnim.Stop("LiftDoorClose"); CurrentLiftState = LiftState.movingDown; if (CurrentLevel == LiftLevel.Level_00) { CurrentLiftState = LiftState.notMoving; // CurrentLevel = LiftLevel.Level_00; CurrentLiftSelection = LevelSelection.LvlUnselected; LiftAnim.SetTrigger("Open"); print("reached Level G"); } } if ((CurrentLiftSelection == LevelSelection.Lvl02) && (CurrentLevel == LiftLevel.Level_05)) { LiftAnim.SetTrigger("Close"); yield return(new WaitForSeconds(1)); //LiftAnim.Stop("LiftDoorClose"); CurrentLiftState = LiftState.movingDown; if (CurrentLevel == LiftLevel.Level_02) { CurrentLiftState = LiftState.notMoving; // CurrentLevel = LiftLevel.Level_00; CurrentLiftSelection = LevelSelection.LvlUnselected; LiftAnim.SetTrigger("Open"); print("reached Level 2"); } } if ((CurrentLiftSelection == LevelSelection.Lvl03) && (CurrentLevel == LiftLevel.Level_05)) { LiftAnim.SetTrigger("Close"); yield return(new WaitForSeconds(1)); //LiftAnim.Stop("LiftDoorClose"); CurrentLiftState = LiftState.movingDown; if (CurrentLevel == LiftLevel.Level_03) { CurrentLiftState = LiftState.notMoving; // CurrentLevel = LiftLevel.Level_00; CurrentLiftSelection = LevelSelection.LvlUnselected; LiftAnim.SetTrigger("Open"); print("reached Level 3"); } } if ((CurrentLiftSelection == LevelSelection.Lvl04) && (CurrentLevel == LiftLevel.Level_05)) { LiftAnim.SetTrigger("Close"); yield return(new WaitForSeconds(1)); //LiftAnim.Stop("LiftDoorClose"); CurrentLiftState = LiftState.movingDown; if (CurrentLevel == LiftLevel.Level_04) { CurrentLiftState = LiftState.notMoving; // CurrentLevel = LiftLevel.Level_00; CurrentLiftSelection = LevelSelection.LvlUnselected; LiftAnim.SetTrigger("Open"); print("reached Level 4"); } } }
public bool ChangeState(LiftState newState) { return(false); }
public void CloseDoor() { Console.WriteLine("close door"); _state = LiftState.Closed; }
private static async void ThreadBody(object userContext) { var client = userContext as ModuleClient; if (client == null) { throw new InvalidOperationException("UserContext doesn't contain " + "expected values"); } var mcp23x1x = _mcp23xxxRead as Mcp23x1x; if (mcp23x1x == null) { Console.WriteLine("Unable to cast Mcp23017 Read GPIO."); return; } while (true) { byte dataPortA = mcp23x1x.ReadByte(Register.GPIO, Port.PortA); byte dataPortB = mcp23x1x.ReadByte(Register.GPIO, Port.PortB); var pinValue = _controller.Read(FloodedPin); // Moisture sensor var flooded = pinValue.ToString().ToLower() == "low" ? false : true; // support simulation too flooded = flooded || _simulateFlooding; Console.WriteLine($"Ports read: A = {dataPortA} - B = {dataPortB}; Flooded = {flooded}; State = {_liftState} at {DateTime.Now}"); // send message on some change or FLOODED! if (dataPortA != _lastDataPortA || dataPortB != _lastDataPortB || _liftState != _lastLiftState || ((flooded != _lastIsFlooded) && !SilentFlooding)) { _lastDataPortA = dataPortA; _lastDataPortB = dataPortB; _lastLiftState = _liftState; _lastIsFlooded = flooded; var beerLiftMessage = new BeerLiftMessage(_deviceId, dataPortA, dataPortB, _liftState); beerLiftMessage.isFlooded = flooded; var json = JsonConvert.SerializeObject(beerLiftMessage); using (var pipeMessage = new Message(Encoding.UTF8.GetBytes(json))) { pipeMessage.ContentType = "application/json"; pipeMessage.ContentEncoding = "utf-8"; if (beerLiftMessage.isFlooded) { pipeMessage.Properties.Add("Alarm", "Flooded"); } pipeMessage.Properties.Add("content-type", "application/edge-beerlift-json"); pipeMessage.Properties.Add("SlotLength", "8"); await client.SendEventAsync("output1", pipeMessage); Console.WriteLine($"Message sent: {beerLiftMessage}"); } } if (flooded) { await LedScenarios.LitFlooded(_mcp23xxxWrite, Interval, SilentFlooding); } else { if (_lastLiftState == LiftState.Down) { // switch off all light when lift is at bottom await LedScenarios.SwitchOffAllSlots(_mcp23xxxWrite, dataPortA, dataPortB); } else { await LedScenarios.LitAllEmptySlots(_mcp23xxxWrite, dataPortA, dataPortB); } } await Task.Delay(Interval); } }
//设置当前电梯状态 public void SetState(LiftState state) { this.mCurState = state; }
private void OnStateChanged(LiftState state) => _text.text = state.ToString();
public void setLiftState(LiftState liftState) { _liftState = liftState; //把当前的环境通知到各个实现类中 _liftState.setContext(this); }
public AmbiantResponse(LiftState state) { liftState = state.ToString(); responseState = 0; }
void _scenarion_StateLiftChanged(LiftState obj) { if (obj == Model.LiftState.Error) { LiftState = "Ошибка"; } else if (obj == Model.LiftState.Down) { LiftState = "Внизу"; StateTrack = 3; } else if (obj == Model.LiftState.Up) { LiftState = "Вверху"; StateTrack = 2; } else if (obj == Model.LiftState.Middle) { LiftState = "Посередине"; } }
public void SetState(LiftState state) { _state = state; }
public void OpenDoor() { Console.WriteLine("open door"); _state = LiftState.Open; }
public BeerLiftMessage(string deviceId, int stateA, int stateB, LiftState state) : this(deviceId, stateA, stateB) { this.liftState = state.ToString(); }
public void LiftState_MustWriteValueAsOfItsName_WhenSerialized(string expectedSerializedValue, LiftState state) { string serializedValue = JsonConvert.SerializeObject(state); Assert.Equal(expectedSerializedValue, serializedValue); }
protected virtual void OnStateLiftChanged(LiftState obj) { Action<LiftState> handler = StateLiftChanged; if (handler != null) handler(obj); }
public void SetLiftState(LiftState lift) { this.liftState = lift; this.liftState.SetContext(this); }
private LiftState GetLiftState(LiftState lastState, IEnumerable<string> indexes) { if (indexes == null) return lastState; if (!indexes.Contains(StrConst.InputLiftUp1) && !indexes.Contains(StrConst.InputLiftUp2) && !indexes.Contains(StrConst.InputLiftDown1) && !indexes.Contains(StrConst.InputLiftDown2)) return lastState; bool up1 = _deviceManager.GetLastStateDi(_inputs[StrConst.InputLiftUp1]); bool up2 = _deviceManager.GetLastStateDi(_inputs[StrConst.InputLiftUp2]); bool down1 = _deviceManager.GetLastStateDi(_inputs[StrConst.InputLiftDown1]); bool down2 = _deviceManager.GetLastStateDi(_inputs[StrConst.InputLiftDown2]); _logger.With(l => l.Trace(string.Format( "GetLiftState: [up1:{0}][up2:{1}][down1:{2}][down2:{3}]", up1, up2, down1, down2))); LiftState? lift = null; if (up1 && up2 && !down1 && !down2) lift = LiftState.Up; else if (!up1 && !up2 && down1 && down2) lift = LiftState.Down; if (lift == null) { return lastState; } _logger.With(l => l.Trace(string.Format("GetLiftState: lastState = \"{0}\" new value = \"{1}\"", lastState, lift.Value))); return lift.Value; }
public Subscription(int subscriptionId, Event pEvent, Contact contact, int subscriptionStateId, string subscriptionStateText, bool subscriptionStateIsDeletable, bool isUnsubscribable, string subscriptionTime, string fontcolor, string comment, NInt32 numLifts, NInt32 liftSubscriptionJourneyStationId, LiftState subscriptionLiftState) { this.SubscriptionId = subscriptionId; this._Event = pEvent; this.Contact = contact; this.SubscriptionStateId = subscriptionStateId; this.SubscriptionStateText = subscriptionStateText; this.subscriptionStateIsDeletable = subscriptionStateIsDeletable; this.IsUnsubscribable = isUnsubscribable; this.SubscriptionTime = subscriptionTime; this.Fontcolor = fontcolor; this.Comment = comment; this.NumLifts = numLifts; this.LiftSubscriptionJourneyStationId = liftSubscriptionJourneyStationId; this.SubscriptionLiftState = subscriptionLiftState; journeyStations = new ArrayList(); }
public Lift() { _state = LiftState.Running; }