mirror of
https://github.com/binary-kitchen/doorlockd
synced 2024-11-16 03:59:11 +01:00
62ac4f26e0
Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
47 lines
1.0 KiB
C++
47 lines
1.0 KiB
C++
#ifndef CLIENTMESSAGE_H
|
|
#define CLIENTMESSAGE_H
|
|
|
|
#include <regex>
|
|
#include <string>
|
|
#include <json/json.h>
|
|
|
|
#include "doormessage.h"
|
|
|
|
class Clientmessage
|
|
{
|
|
public:
|
|
|
|
Clientmessage(std::string web_address,
|
|
bool isOpen,
|
|
Doormessage doormessage);
|
|
Clientmessage();
|
|
|
|
Clientmessage &operator=(const Clientmessage& rhs);
|
|
|
|
static Clientmessage fromJson(const Json::Value &root);
|
|
static Clientmessage fromString(const std::string &json);
|
|
std::string toJson() const;
|
|
|
|
const std::string& web_address() const;
|
|
const std::string& token() const;
|
|
bool isOpen() const;
|
|
const Doormessage& doormessage() const;
|
|
|
|
private:
|
|
|
|
std::string _web_address;
|
|
std::string _token;
|
|
bool _isOpen;
|
|
Doormessage _doormessage;
|
|
|
|
const static std::string _tokenKey;
|
|
const static std::string _unlockButtonKey;
|
|
const static std::string _lockButtonKey;
|
|
const static std::string _emergencyUnlockKey;
|
|
const static std::string _isOpenKey;
|
|
|
|
const static std::regex _token_regex;
|
|
};
|
|
|
|
#endif
|