mirror of
https://github.com/binary-kitchen/doorlockd
synced 2024-12-22 18:34:25 +01:00
49a5b88f6c
- 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
37 lines
768 B
C++
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
|