1
0
mirror of https://github.com/binary-kitchen/doorlockd synced 2025-01-08 17:22:13 +01:00
doorlockd-mirror/doorlockd/clientmessage.cpp

24 lines
558 B
C++
Raw Normal View History

#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);
}