From 5af124000b6ffd16924d92a92b73347d0b186a37 Mon Sep 17 00:00:00 2001 From: Ralf Ramsauer Date: Thu, 17 Sep 2015 14:50:30 +0200 Subject: [PATCH] Improved door responses --- doorlockd/door.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/doorlockd/door.cpp b/doorlockd/door.cpp index 0ba1db3..73e57dc 100644 --- a/doorlockd/door.cpp +++ b/doorlockd/door.cpp @@ -69,15 +69,20 @@ void Door::_asyncRead() } if (recvBuf == 'U') { + // In case that someone pushed the unlock button - just log it. + // No further actions required _logger(LogLevel::notice, "Someone pushed the unlock button"); - } - if (recvBuf == 'L') { + goto out; + } else if (recvBuf == 'L') { _logger(LogLevel::notice, "Someone pushed the lock button"); _logger(LogLevel::notice, "Locking..."); lock(); goto out; + } else if (recvBuf == 'E') { + _logger(LogLevel::warning, "Someone did an emergency unlock!"); + // TODO: Trigger Emergency unlock script + goto out; } - // TODO EMERGENCY DOOR BUTTON _byteReady = true; _receivedCondition.notify_one();