1
0
mirror of https://github.com/binary-kitchen/doorlockd synced 2024-11-16 03:59:11 +01:00
doorlockd-mirror/doorlockd/lib/clientmessage.h
Ralf Ramsauer 62ac4f26e0 clientmessage: add token regex and getter
Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2016-07-17 23:00:05 +02:00

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