1
0
mirror of https://github.com/binary-kitchen/doorlockd synced 2024-12-22 18:34:25 +01:00
doorlockd-mirror/doorlockd/clientmessage.cpp
Ralf Ramsauer 8ed116bf7f Added proper client and doormessage classes
Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2015-09-25 00:50:10 +02:00

24 lines
558 B
C++

#include <json/json.h>
#include "clientmessage.h"
Clientmessage::Clientmessage(std::string token,
Doormessage doormessage) :
_token(token),
_doormessage(doormessage)
{
}
std::string Clientmessage::toJson() const
{
Json::StyledWriter writer;
Json::Value message;
message["token"] = _token;
message["unlockButton"] = _doormessage.isUnlockButton;
message["lockButton"] = _doormessage.isLockButton;
message["emergencyUnlock"] = _doormessage.isEmergencyUnlock;
return writer.write(message);
}