fields builder

This commit is contained in:
2025-02-06 18:01:27 +01:00
parent c3a54d8e5b
commit 8ecfb95167
5 changed files with 28 additions and 10 deletions

View File

@@ -4,18 +4,10 @@
#include <sp/protocol/Field.h>
#include <sp/protocol/MessageBase.h>
enum PacketId {
KeepAlive = 0,
};
enum KeepAlivePacketFields {
KeepAliveId = 0
};
using KeepAliveFields = std::tuple<sp::Field<std::uint64_t>>;
using KeepAliveFields = sp::FieldsBuilder<std::uint64_t>::Type;
class KeepAlivePacket : public sp::MessageBase<sp::PacketMessage,
sp::option::StaticNumIdImpl<KeepAlive>, // provide idImpl() if needed
sp::option::DispatchImpl<KeepAlivePacket>, // provide dispatchImpl() if needed
sp::option::FieldsImpl<KeepAliveFields> // provide access to fields
> {};
DeclarePacket(KeepAlive);

View File

@@ -1,5 +1,9 @@
#pragma once
enum PacketId {
KeepAlive
};
#include <examples/KeepAlivePacket.h>
using AllPackets = std::tuple<KeepAlivePacket>;