24 lines
621 B
C++
24 lines
621 B
C++
# pragma once
|
|
#include "Protocol.h"
|
|
#include "RcDecoder.h"
|
|
|
|
class Protocol_1 : public Protocol {
|
|
|
|
public:
|
|
Protocol_1() : Protocol(1) {
|
|
}
|
|
|
|
void fromJson(JsonDocument& jsonDoc, RCSwitch& rcDevice) {
|
|
|
|
}
|
|
|
|
void toJson(unsigned long value, JsonDocument& jsonDoc) override {
|
|
JsonObject rcSwitch = jsonDoc.createNestedObject("rcSwitch");
|
|
rcSwitch["protocol"] = 1;
|
|
RcDecoder::RcSwitch decoded = RcDecoder::decode(value);
|
|
rcSwitch["state"] = decoded.state;
|
|
rcSwitch["group"] = String(decoded.group, BIN);
|
|
rcSwitch["channel"] = decoded.device;
|
|
}
|
|
|
|
} protocol_1; |