From 8b4be488113dec34b7b30176e21fae4192fd55a4 Mon Sep 17 00:00:00 2001 From: Ralf Ramsauer Date: Thu, 24 Sep 2015 18:15:05 +0200 Subject: [PATCH] Some refactoring --- doorlockd/logic.cpp | 8 ++++---- doorlockd/logic.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doorlockd/logic.cpp b/doorlockd/logic.cpp index 064e887..4f6b876 100644 --- a/doorlockd/logic.cpp +++ b/doorlockd/logic.cpp @@ -19,11 +19,11 @@ Logic::Logic(const chrono::seconds tokenTimeout, const string &webPrefix, const string &serDev, const unsigned int baudrate, - condition_variable &onTokenUpdate) : + condition_variable &onClientUpdate) : _logger(Logger::get()), _door(serDev, baudrate), _tokenTimeout(tokenTimeout), - _onTokenUpdate(onTokenUpdate), + _onClientUpdate(onClientUpdate), _ldapUri(ldapUri), _bindDN(bindDN), _webPrefix(webPrefix) @@ -232,10 +232,10 @@ void Logic::_createNewToken(const bool stillValid) message << "New Token generated: " << toHexString(_curToken) << " old Token: " << toHexString(_prevToken) << " is " << (_prevValid?"still":"not") << " valid"; _logger(message, LogLevel::info); - _onTokenUpdate.notify_all(); + _onClientUpdate.notify_all(); } -std::string Logic::getCurrentToken() const +std::string Logic::getClientMessage() const { return _webPrefix + toHexString(_curToken); } diff --git a/doorlockd/logic.h b/doorlockd/logic.h index 519ab42..c5e0d6b 100644 --- a/doorlockd/logic.h +++ b/doorlockd/logic.h @@ -28,14 +28,14 @@ public: const std::string &webPrefix, const std::string &serDev, const unsigned int baudrate, - std::condition_variable &onTokenUpdate); + std::condition_variable &onClientUpdate); ~Logic(); // Parse incoming JSON Requests Response parseRequest(const Json::Value &root); // Returns the current Token - std::string getCurrentToken() const; + std::string getClientMessage() const; private: @@ -82,7 +82,7 @@ private: std::mutex _mutex = {}; // This variable gets notified on token updates - std::condition_variable &_onTokenUpdate; + std::condition_variable &_onClientUpdate; // The URI of the ldap server const std::string _ldapUri;