1
0
mirror of https://github.com/binary-kitchen/doorlockd synced 2024-09-30 09:43:31 +02:00
doorlockd-mirror/doorlockd/lib/clientmessage.h
Ralf Ramsauer 49a5b88f6c Big rewrite of several things
- Data type Token changed from uint64_t to std::string
- Added new class "Request" that describes a JSON TCP request
- Classes may now throw Responses for proper error handling
- Removed JSON parsing from Logic
- proper Error handling everywhere
- Many small fixes
- removed unnecessary includes
- removed using namespace std everywhere
2015-10-01 22:09:55 +02:00

37 lines
768 B
C++

#ifndef CLIENTMESSAGE_H
#define CLIENTMESSAGE_H
#include <string>
#include <json/json.h>
#include "doormessage.h"
class Clientmessage
{
public:
Clientmessage(std::string token,
Doormessage doormessage);
static Clientmessage fromJson(const Json::Value &root);
static Clientmessage fromString(const std::string &json);
std::string toJson() const;
const std::string& token() const;
const Doormessage& doormessage() const;
private:
std::string _token;
Doormessage _doormessage;
static const std::string _tokenKey;
const static std::string _unlockButtonKey;
const static std::string _lockButtonKey;
const static std::string _emergencyUnlockKey;
const static std::string _isOpenKey;
};
#endif