WIP: Making RFPowerView class

This commit is contained in:
2023-12-22 12:05:24 +11:00
parent c84c2dfbdc
commit 9d507fdb0b
7 changed files with 173 additions and 63 deletions

47
include/PacketTypes.h Normal file
View File

@@ -0,0 +1,47 @@
#ifndef PACKET_TYPES_H
#define PACKET_TYPES_H
#include <Arduino.h>
#include <variant>
// Define packet types
enum class PacketType {
OPEN,
CLOSE,
STOP,
FIELDS,
FIELD_COMMAND,
UNKNOWN
};
enum class FieldType {
VALUE,
SET,
FETCH,
UNKNOWN
};
struct Field {
uint8_t identifier;
FieldType type;
bool hasValue;
std::variant<std::monostate, uint8_t, uint16_t> value;
};
struct FieldsParameters {
std::vector<Field> fields;
};
using PacketParameters = std::variant<std::monostate, FieldsParameters>;
// Define Message structure
struct Packet {
uint16_t source;
uint16_t destination;
PacketType type;
PacketParameters parameters;
};
#endif // PACKET_TYPES_H