mirror of
https://github.com/binary-kitchen/doorlockd
synced 2024-10-31 22:47:05 +01:00
clientmessage: Refactor token to web_address
Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
This commit is contained in:
parent
5355749c6b
commit
474d941918
@ -44,7 +44,7 @@ static void onDoorlockUpdate(const Clientmessage &msg)
|
||||
{
|
||||
const auto& doormessage = msg.doormessage();
|
||||
l("Received message", LogLevel::info);
|
||||
l((std::string)" token: " + msg.token(),
|
||||
l((std::string)" token: " + msg.web_address(),
|
||||
LogLevel::info);
|
||||
l((std::string)" open: " + std::to_string(msg.isOpen()),
|
||||
LogLevel::info);
|
||||
|
@ -24,8 +24,8 @@ MainWindow::~MainWindow()
|
||||
|
||||
void MainWindow::setClientmessage(const Clientmessage &msg)
|
||||
{
|
||||
ui->qrwidget->setQRData(msg.token());
|
||||
ui->address->setText(QString::fromStdString(msg.token()));
|
||||
ui->qrwidget->setQRData(msg.web_address());
|
||||
ui->address->setText(QString::fromStdString(msg.web_address()));
|
||||
QString statusMessage("");
|
||||
|
||||
const auto &doormsg = msg.doormessage();
|
||||
|
@ -8,17 +8,17 @@ const std::string Clientmessage::_lockButtonKey = "lockButton";
|
||||
const std::string Clientmessage::_emergencyUnlockKey = "emergencyUnlock";
|
||||
const std::string Clientmessage::_isOpenKey = "isOpen";
|
||||
|
||||
Clientmessage::Clientmessage(std::string token,
|
||||
Clientmessage::Clientmessage(std::string web_address,
|
||||
bool isOpen,
|
||||
Doormessage doormessage) :
|
||||
_token(token),
|
||||
_web_address(web_address),
|
||||
_isOpen(isOpen),
|
||||
_doormessage(doormessage)
|
||||
{
|
||||
}
|
||||
|
||||
Clientmessage::Clientmessage() :
|
||||
_token(),
|
||||
_web_address(),
|
||||
_isOpen(false),
|
||||
_doormessage()
|
||||
{
|
||||
@ -31,7 +31,7 @@ Clientmessage &Clientmessage::operator=(const Clientmessage &rhs)
|
||||
return *this;
|
||||
}
|
||||
|
||||
this->_token = rhs._token;
|
||||
this->_web_address = rhs._web_address;
|
||||
this->_isOpen = rhs._isOpen;
|
||||
this->_doormessage = rhs._doormessage;
|
||||
|
||||
@ -43,7 +43,7 @@ std::string Clientmessage::toJson() const
|
||||
Json::StyledWriter writer;
|
||||
Json::Value message;
|
||||
|
||||
message[_tokenKey] = _token;
|
||||
message[_tokenKey] = _web_address;
|
||||
message[_unlockButtonKey] = _doormessage.isUnlockButton;
|
||||
message[_lockButtonKey] = _doormessage.isLockButton;
|
||||
message[_emergencyUnlockKey] = _doormessage.isEmergencyUnlock;
|
||||
@ -52,9 +52,9 @@ std::string Clientmessage::toJson() const
|
||||
return writer.write(message);
|
||||
}
|
||||
|
||||
const std::string& Clientmessage::token() const
|
||||
const std::string& Clientmessage::web_address() const
|
||||
{
|
||||
return _token;
|
||||
return _web_address;
|
||||
}
|
||||
|
||||
const Doormessage& Clientmessage::doormessage() const
|
||||
|
@ -10,7 +10,7 @@ class Clientmessage
|
||||
{
|
||||
public:
|
||||
|
||||
Clientmessage(std::string token,
|
||||
Clientmessage(std::string web_address,
|
||||
bool isOpen,
|
||||
Doormessage doormessage);
|
||||
Clientmessage();
|
||||
@ -21,13 +21,13 @@ public:
|
||||
static Clientmessage fromString(const std::string &json);
|
||||
std::string toJson() const;
|
||||
|
||||
const std::string& token() const;
|
||||
const std::string& web_address() const;
|
||||
bool isOpen() const;
|
||||
const Doormessage& doormessage() const;
|
||||
|
||||
private:
|
||||
|
||||
std::string _token;
|
||||
std::string _web_address;
|
||||
bool _isOpen;
|
||||
Doormessage _doormessage;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user