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
30 lines
589 B
C++
30 lines
589 B
C++
#ifndef REQUEST_H
|
|
#define REQUEST_H
|
|
|
|
#include <string>
|
|
|
|
#include <json/json.h>
|
|
|
|
#include "response.h"
|
|
|
|
class Request
|
|
{
|
|
public:
|
|
static Request fromJson(const Json::Value &root);
|
|
static Request fromString(const std::string &string);
|
|
|
|
enum class Command { Lock, Unlock, Subscribe, Unknown }
|
|
command = { Command::Unknown };
|
|
std::string user = { };
|
|
std::string password = { };
|
|
std::string token = { };
|
|
|
|
private:
|
|
static Command _commandFromString(const std::string &command);
|
|
|
|
const static std::string _commandKey;
|
|
};
|
|
|
|
#endif // REQUEST_H
|
|
|