forked from EyeTrackVR/OpenIris-ESPIDF
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandManager.hpp
More file actions
66 lines (60 loc) · 1.53 KB
/
CommandManager.hpp
File metadata and controls
66 lines (60 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef COMMANDMANAGER_HPP
#define COMMANDMANAGER_HPP
#include <ProjectConfig.hpp>
#include <CameraManager.hpp>
#include <memory>
#include <string>
#include <optional>
#include <unordered_map>
#include <functional>
#include "CommandResult.hpp"
#include "CommandSchema.hpp"
#include "DependencyRegistry.hpp"
#include "commands/simple_commands.hpp"
#include "commands/camera_commands.hpp"
#include "commands/config_commands.hpp"
#include "commands/mdns_commands.hpp"
#include "commands/wifi_commands.hpp"
#include "commands/device_commands.hpp"
#include "commands/scan_commands.hpp"
#include <nlohmann-json.hpp>
enum class CommandType
{
None,
PING,
PAUSE,
SET_WIFI,
UPDATE_OTA_CREDENTIALS,
UPDATE_WIFI,
DELETE_NETWORK,
UPDATE_AP_WIFI,
SET_MDNS,
GET_MDNS_NAME,
UPDATE_CAMERA,
SAVE_CONFIG,
GET_CONFIG,
RESET_CONFIG,
RESTART_DEVICE,
SCAN_NETWORKS,
START_STREAMING,
GET_WIFI_STATUS,
CONNECT_WIFI,
SWITCH_MODE,
GET_DEVICE_MODE,
SET_LED_DUTY_CYCLE,
GET_LED_DUTY_CYCLE,
GET_SERIAL,
GET_LED_CURRENT,
GET_BATTERY_STATUS,
GET_WHO_AM_I,
};
class CommandManager
{
std::shared_ptr<DependencyRegistry> registry;
public:
explicit CommandManager(const std::shared_ptr<DependencyRegistry> &DependencyRegistry) : registry(DependencyRegistry) {};
std::function<CommandResult()> createCommand(const CommandType type, const nlohmann::json &json) const;
CommandManagerResponse executeFromJson(std::string_view json) const;
CommandManagerResponse executeFromType(CommandType type, std::string_view json) const;
};
#endif