mirror of
https://github.com/binary-kitchen/doorlockd
synced 2024-12-22 18:34:25 +01:00
Improved Clientmessage
This commit is contained in:
parent
cba6e337ee
commit
38a8ccadea
@ -17,6 +17,27 @@ Clientmessage::Clientmessage(std::string token,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Clientmessage::Clientmessage() :
|
||||||
|
_token(),
|
||||||
|
_isOpen(false),
|
||||||
|
_doormessage()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Clientmessage &Clientmessage::operator=(const Clientmessage &rhs)
|
||||||
|
{
|
||||||
|
// Protect against self assignement
|
||||||
|
if (this == &rhs) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->_token = rhs._token;
|
||||||
|
this->_isOpen = rhs._isOpen;
|
||||||
|
this->_doormessage = rhs._doormessage;
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
std::string Clientmessage::toJson() const
|
std::string Clientmessage::toJson() const
|
||||||
{
|
{
|
||||||
Json::StyledWriter writer;
|
Json::StyledWriter writer;
|
||||||
|
@ -13,6 +13,9 @@ public:
|
|||||||
Clientmessage(std::string token,
|
Clientmessage(std::string token,
|
||||||
bool isOpen,
|
bool isOpen,
|
||||||
Doormessage doormessage);
|
Doormessage doormessage);
|
||||||
|
Clientmessage();
|
||||||
|
|
||||||
|
Clientmessage &operator=(const Clientmessage& rhs);
|
||||||
|
|
||||||
static Clientmessage fromJson(const Json::Value &root);
|
static Clientmessage fromJson(const Json::Value &root);
|
||||||
static Clientmessage fromString(const std::string &json);
|
static Clientmessage fromString(const std::string &json);
|
||||||
@ -24,11 +27,11 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
const std::string _token;
|
std::string _token;
|
||||||
const bool _isOpen;
|
bool _isOpen;
|
||||||
const Doormessage _doormessage;
|
Doormessage _doormessage;
|
||||||
|
|
||||||
static const std::string _tokenKey;
|
const static std::string _tokenKey;
|
||||||
const static std::string _unlockButtonKey;
|
const static std::string _unlockButtonKey;
|
||||||
const static std::string _lockButtonKey;
|
const static std::string _lockButtonKey;
|
||||||
const static std::string _emergencyUnlockKey;
|
const static std::string _emergencyUnlockKey;
|
||||||
|
Loading…
Reference in New Issue
Block a user