2015-09-24 21:12:59 +02:00
|
|
|
#ifndef CLIENTMESSAGE_H
|
|
|
|
#define CLIENTMESSAGE_H
|
|
|
|
|
2016-07-17 22:52:58 +02:00
|
|
|
#include <regex>
|
2015-09-24 21:12:59 +02:00
|
|
|
#include <string>
|
2015-10-01 22:09:55 +02:00
|
|
|
#include <json/json.h>
|
2015-09-24 21:12:59 +02:00
|
|
|
|
|
|
|
#include "doormessage.h"
|
|
|
|
|
|
|
|
class Clientmessage
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2016-07-17 22:44:02 +02:00
|
|
|
Clientmessage(std::string web_address,
|
2015-10-05 23:30:25 +02:00
|
|
|
bool isOpen,
|
2015-09-24 21:12:59 +02:00
|
|
|
Doormessage doormessage);
|
2015-10-07 15:54:28 +02:00
|
|
|
Clientmessage();
|
|
|
|
|
|
|
|
Clientmessage &operator=(const Clientmessage& rhs);
|
2015-09-24 21:12:59 +02:00
|
|
|
|
2015-10-01 22:09:55 +02:00
|
|
|
static Clientmessage fromJson(const Json::Value &root);
|
|
|
|
static Clientmessage fromString(const std::string &json);
|
2015-09-24 21:12:59 +02:00
|
|
|
std::string toJson() const;
|
|
|
|
|
2016-07-17 22:44:02 +02:00
|
|
|
const std::string& web_address() const;
|
2016-07-17 22:52:58 +02:00
|
|
|
const std::string& token() const;
|
2015-10-05 23:30:25 +02:00
|
|
|
bool isOpen() const;
|
2015-09-25 00:38:34 +02:00
|
|
|
const Doormessage& doormessage() const;
|
|
|
|
|
2015-09-24 21:12:59 +02:00
|
|
|
private:
|
|
|
|
|
2016-07-17 22:44:02 +02:00
|
|
|
std::string _web_address;
|
2016-07-17 22:52:58 +02:00
|
|
|
std::string _token;
|
2015-10-07 15:54:28 +02:00
|
|
|
bool _isOpen;
|
|
|
|
Doormessage _doormessage;
|
2015-09-25 00:38:34 +02:00
|
|
|
|
2015-10-07 15:54:28 +02:00
|
|
|
const static std::string _tokenKey;
|
2015-09-25 00:38:34 +02:00
|
|
|
const static std::string _unlockButtonKey;
|
|
|
|
const static std::string _lockButtonKey;
|
|
|
|
const static std::string _emergencyUnlockKey;
|
2015-09-25 03:26:07 +02:00
|
|
|
const static std::string _isOpenKey;
|
2016-07-17 22:52:58 +02:00
|
|
|
|
|
|
|
const static std::regex _token_regex;
|
2015-09-24 21:12:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|