-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataHandler.cpp
More file actions
33 lines (25 loc) · 914 Bytes
/
DataHandler.cpp
File metadata and controls
33 lines (25 loc) · 914 Bytes
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
#include "DataHandler.h"
DataHandler::DataHandler(ComHandler& comHandler) : comHandler(comHandler) {}
void DataHandler::sendRotationData(const String& id, float rotation) {
StaticJsonDocument<200> doc;
doc["id"] = id;
JsonObject input = doc.createNestedObject("input");
input["rotation"] = rotation;
comHandler.sendData(doc);
}
void DataHandler::sendSlideData(const String& id, float slide) {
StaticJsonDocument<200> doc;
doc["id"] = id;
JsonObject input = doc.createNestedObject("input");
input["slide"] = slide;
comHandler.sendData(doc);
}
void DataHandler::sendPositionData(const String& id, float x, float y) {
StaticJsonDocument<200> doc;
doc["id"] = id;
JsonObject input = doc.createNestedObject("input");
JsonObject position = input.createNestedObject("position");
position["x"] = x;
position["y"] = y;
comHandler.sendData(doc);
}