LSH-Core
A robust C++ framework for Arduino-based home automation nodes
Loading...
Searching...
No Matches
protocol.hpp
Go to the documentation of this file.
1
21#ifndef LSHCORE_COMMUNICATION_CONSTANTS_PROTOCOL_HPP
22#define LSHCORE_COMMUNICATION_CONSTANTS_PROTOCOL_HPP
23
24#include <stdint.h>
25
26namespace LSH
27{
28 namespace protocol
29 {
30 // === JSON KEYS ===
31 constexpr const char *KEY_PAYLOAD = "p";
32 constexpr const char *KEY_NAME = "n";
33 constexpr const char *KEY_ACTUATORS_ARRAY = "a";
34 constexpr const char *KEY_BUTTONS_ARRAY = "b";
35 constexpr const char *KEY_ID = "i";
36 constexpr const char *KEY_STATE = "s";
37 constexpr const char *KEY_TYPE = "t";
38 constexpr const char *KEY_CONFIRM = "c";
39
43 enum class Command : uint8_t
44 {
45 // Arduino -> ESP
46 DEVICE_DETAILS = 1,
47 ACTUATORS_STATE = 2,
48 NETWORK_CLICK = 3,
49
50 // Omnidirectional
51 BOOT = 4,
52 PING_ = 5,
53
54 // ESP -> Arduino (or MQTT -> ESP)
55 REQUEST_DETAILS = 10,
56 REQUEST_STATE = 11,
57 SET_STATE = 12,
58 SET_SINGLE_ACTUATOR = 13,
59 NETWORK_CLICK_ACK = 14,
60 FAILOVER = 15,
61 FAILOVER_CLICK = 16,
62
63 // ESP System command (MQTT -> ESP)
64 SYSTEM_REBOOT = 254,
65 SYSTEM_RESET = 255
66 };
67
71 enum class ProtocolClickType : uint8_t
72 {
73 LONG = 1,
74 SUPER_LONG = 2
75 };
76
77 } // namespace protocol
78} // namespace LSH
79
80#endif // LSHCORE_COMMUNICATION_CONSTANTS_PROTOCOL_HPP
constexpr const char * KEY_PAYLOAD
Payload.
Definition protocol.hpp:31
ProtocolClickType
Defines the valid click types for the 't' (type) key in JSON messages.
Definition protocol.hpp:72
constexpr const char * KEY_BUTTONS_ARRAY
Buttons IDs.
Definition protocol.hpp:34
Command
Defines the valid command types for the 'p' (payload) key in JSON messages.
Definition protocol.hpp:44
constexpr const char * KEY_STATE
Actuators State.
Definition protocol.hpp:36
constexpr const char * KEY_TYPE
Click Type.
Definition protocol.hpp:37
constexpr const char * KEY_NAME
Device Name.
Definition protocol.hpp:32
constexpr const char * KEY_CONFIRM
Confirm.
Definition protocol.hpp:38
constexpr const char * KEY_ID
ID.
Definition protocol.hpp:35
constexpr const char * KEY_ACTUATORS_ARRAY
Actuators IDs.
Definition protocol.hpp:33