-
Notifications
You must be signed in to change notification settings - Fork 125
/
RPC_Response.h
35 lines (28 loc) · 1.11 KB
/
RPC_Response.h
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
#ifndef RPC_RESPONSE_H
#define RPC_RESPONSE_H
// Local includes.
#include "Telemetry.h"
/// @brief RPC response expected to be sent by the user to the server once an RPC method has been called by the server,
/// is a simple wrapper around the Telemetry and JsonVariant class, which allow to easily serialize the response into a json string
class RPC_Response : public JsonVariant {
public:
/// @brief Constructor
RPC_Response();
/// @brief Constructor
/// @param variant JsonVariant object the internal data should be copied from
explicit RPC_Response(JsonVariant variant);
/// @brief Constructor
/// @param telemetry Telemetry object the internal data should be copied from
explicit RPC_Response(Telemetry telemetry);
/// @brief Constructor
/// @tparam T Type of the passed value
/// @param key Key of the key value pair we want to create
/// @param value Value of the key value pair we want to create
template <typename T>
RPC_Response(const char *key, T value) :
RPC_Response(Telemetry(key, value))
{
// Nothing to do
}
};
#endif //RPC_RESPONSE_H