/* Region content: * RfidDetected(object o, ScanEventArgs e) * DoorChanged(object o, DoorEventArgs e) */ #region Handlers // method for event handler in RFIDscanner. private void RfidDetected(object o, ScanEventArgs e) { switch (_state) { case LadeskabState.Available: // Check for ladeforbindelse if (_charger.isConnected()) { _door.LockDoor(); _oldId = e.ScannedId; _Log.LogDoorLocked(e.ScannedId); _charger.StartCharge(); _display.Busy(); _state = LadeskabState.Locked; } else { _display.ConnectionError(); } break; case LadeskabState.DoorOpen: // Ignore break; case LadeskabState.Locked: // Check for correct ID if (e.ScannedId == _oldId) { _charger.StopCharge(); _door.UnlockDoor(); _Log.LogDoorUnlocked(e.ScannedId); _display.PhoneDone(); _state = LadeskabState.Available; } else { _display.RFIDError(); } break; } }