mirror of
https://github.com/BotChain-Robots/firmware.git
synced 2026-07-08 09:37:21 +02:00
add flatbuffer definitions
This commit is contained in:
@@ -0,0 +1,267 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_MOVEMENT_MOVEMENT_H_
|
||||
#define FLATBUFFERS_GENERATED_MOVEMENT_MOVEMENT_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 12 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 19,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
namespace movement {
|
||||
|
||||
struct ConditionBlob;
|
||||
|
||||
struct MovementEntry;
|
||||
struct MovementEntryBuilder;
|
||||
|
||||
struct MovementSet;
|
||||
struct MovementSetBuilder;
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(2) ConditionBlob FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
uint16_t value_;
|
||||
uint8_t cond_;
|
||||
uint8_t module_type_;
|
||||
uint8_t in_use_;
|
||||
int8_t padding0__;
|
||||
|
||||
public:
|
||||
ConditionBlob()
|
||||
: value_(0),
|
||||
cond_(0),
|
||||
module_type_(0),
|
||||
in_use_(0),
|
||||
padding0__(0) {
|
||||
(void)padding0__;
|
||||
}
|
||||
ConditionBlob(uint16_t _value, uint8_t _cond, uint8_t _module_type, uint8_t _in_use)
|
||||
: value_(::flatbuffers::EndianScalar(_value)),
|
||||
cond_(::flatbuffers::EndianScalar(_cond)),
|
||||
module_type_(::flatbuffers::EndianScalar(_module_type)),
|
||||
in_use_(::flatbuffers::EndianScalar(_in_use)),
|
||||
padding0__(0) {
|
||||
(void)padding0__;
|
||||
}
|
||||
uint16_t value() const {
|
||||
return ::flatbuffers::EndianScalar(value_);
|
||||
}
|
||||
uint8_t cond() const {
|
||||
return ::flatbuffers::EndianScalar(cond_);
|
||||
}
|
||||
uint8_t module_type() const {
|
||||
return ::flatbuffers::EndianScalar(module_type_);
|
||||
}
|
||||
uint8_t in_use() const {
|
||||
return ::flatbuffers::EndianScalar(in_use_);
|
||||
}
|
||||
};
|
||||
FLATBUFFERS_STRUCT_END(ConditionBlob, 6);
|
||||
|
||||
struct MovementEntry FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef MovementEntryBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_BOARD_ID = 4,
|
||||
VT_MODULE_TYPE = 6,
|
||||
VT_VALUE_ACTION = 8,
|
||||
VT_CONDITION = 10,
|
||||
VT_ACK = 12,
|
||||
VT_ACK_TTL_MS = 14,
|
||||
VT_POST_DELAY_MS = 16
|
||||
};
|
||||
uint16_t board_id() const {
|
||||
return GetField<uint16_t>(VT_BOARD_ID, 0);
|
||||
}
|
||||
uint8_t module_type() const {
|
||||
return GetField<uint8_t>(VT_MODULE_TYPE, 0);
|
||||
}
|
||||
uint16_t value_action() const {
|
||||
return GetField<uint16_t>(VT_VALUE_ACTION, 0);
|
||||
}
|
||||
const movement::ConditionBlob *condition() const {
|
||||
return GetStruct<const movement::ConditionBlob *>(VT_CONDITION);
|
||||
}
|
||||
uint8_t ack() const {
|
||||
return GetField<uint8_t>(VT_ACK, 0);
|
||||
}
|
||||
uint16_t ack_ttl_ms() const {
|
||||
return GetField<uint16_t>(VT_ACK_TTL_MS, 0);
|
||||
}
|
||||
uint16_t post_delay_ms() const {
|
||||
return GetField<uint16_t>(VT_POST_DELAY_MS, 0);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<uint16_t>(verifier, VT_BOARD_ID, 2) &&
|
||||
VerifyField<uint8_t>(verifier, VT_MODULE_TYPE, 1) &&
|
||||
VerifyField<uint16_t>(verifier, VT_VALUE_ACTION, 2) &&
|
||||
VerifyField<movement::ConditionBlob>(verifier, VT_CONDITION, 2) &&
|
||||
VerifyField<uint8_t>(verifier, VT_ACK, 1) &&
|
||||
VerifyField<uint16_t>(verifier, VT_ACK_TTL_MS, 2) &&
|
||||
VerifyField<uint16_t>(verifier, VT_POST_DELAY_MS, 2) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct MovementEntryBuilder {
|
||||
typedef MovementEntry Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_board_id(uint16_t board_id) {
|
||||
fbb_.AddElement<uint16_t>(MovementEntry::VT_BOARD_ID, board_id, 0);
|
||||
}
|
||||
void add_module_type(uint8_t module_type) {
|
||||
fbb_.AddElement<uint8_t>(MovementEntry::VT_MODULE_TYPE, module_type, 0);
|
||||
}
|
||||
void add_value_action(uint16_t value_action) {
|
||||
fbb_.AddElement<uint16_t>(MovementEntry::VT_VALUE_ACTION, value_action, 0);
|
||||
}
|
||||
void add_condition(const movement::ConditionBlob *condition) {
|
||||
fbb_.AddStruct(MovementEntry::VT_CONDITION, condition);
|
||||
}
|
||||
void add_ack(uint8_t ack) {
|
||||
fbb_.AddElement<uint8_t>(MovementEntry::VT_ACK, ack, 0);
|
||||
}
|
||||
void add_ack_ttl_ms(uint16_t ack_ttl_ms) {
|
||||
fbb_.AddElement<uint16_t>(MovementEntry::VT_ACK_TTL_MS, ack_ttl_ms, 0);
|
||||
}
|
||||
void add_post_delay_ms(uint16_t post_delay_ms) {
|
||||
fbb_.AddElement<uint16_t>(MovementEntry::VT_POST_DELAY_MS, post_delay_ms, 0);
|
||||
}
|
||||
explicit MovementEntryBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<MovementEntry> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<MovementEntry>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<MovementEntry> CreateMovementEntry(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
uint16_t board_id = 0,
|
||||
uint8_t module_type = 0,
|
||||
uint16_t value_action = 0,
|
||||
const movement::ConditionBlob *condition = nullptr,
|
||||
uint8_t ack = 0,
|
||||
uint16_t ack_ttl_ms = 0,
|
||||
uint16_t post_delay_ms = 0) {
|
||||
MovementEntryBuilder builder_(_fbb);
|
||||
builder_.add_condition(condition);
|
||||
builder_.add_post_delay_ms(post_delay_ms);
|
||||
builder_.add_ack_ttl_ms(ack_ttl_ms);
|
||||
builder_.add_value_action(value_action);
|
||||
builder_.add_board_id(board_id);
|
||||
builder_.add_ack(ack);
|
||||
builder_.add_module_type(module_type);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
struct MovementSet FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef MovementSetBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_NUM_MOVEMENTS = 4,
|
||||
VT_MOVEMENTS = 6
|
||||
};
|
||||
uint8_t num_movements() const {
|
||||
return GetField<uint8_t>(VT_NUM_MOVEMENTS, 0);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<movement::MovementEntry>> *movements() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<movement::MovementEntry>> *>(VT_MOVEMENTS);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<uint8_t>(verifier, VT_NUM_MOVEMENTS, 1) &&
|
||||
VerifyOffset(verifier, VT_MOVEMENTS) &&
|
||||
verifier.VerifyVector(movements()) &&
|
||||
verifier.VerifyVectorOfTables(movements()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct MovementSetBuilder {
|
||||
typedef MovementSet Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_num_movements(uint8_t num_movements) {
|
||||
fbb_.AddElement<uint8_t>(MovementSet::VT_NUM_MOVEMENTS, num_movements, 0);
|
||||
}
|
||||
void add_movements(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<movement::MovementEntry>>> movements) {
|
||||
fbb_.AddOffset(MovementSet::VT_MOVEMENTS, movements);
|
||||
}
|
||||
explicit MovementSetBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<MovementSet> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<MovementSet>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<MovementSet> CreateMovementSet(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
uint8_t num_movements = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<movement::MovementEntry>>> movements = 0) {
|
||||
MovementSetBuilder builder_(_fbb);
|
||||
builder_.add_movements(movements);
|
||||
builder_.add_num_movements(num_movements);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<MovementSet> CreateMovementSetDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
uint8_t num_movements = 0,
|
||||
const std::vector<::flatbuffers::Offset<movement::MovementEntry>> *movements = nullptr) {
|
||||
auto movements__ = movements ? _fbb.CreateVector<::flatbuffers::Offset<movement::MovementEntry>>(*movements) : 0;
|
||||
return movement::CreateMovementSet(
|
||||
_fbb,
|
||||
num_movements,
|
||||
movements__);
|
||||
}
|
||||
|
||||
inline const movement::MovementSet *GetMovementSet(const void *buf) {
|
||||
return ::flatbuffers::GetRoot<movement::MovementSet>(buf);
|
||||
}
|
||||
|
||||
inline const movement::MovementSet *GetSizePrefixedMovementSet(const void *buf) {
|
||||
return ::flatbuffers::GetSizePrefixedRoot<movement::MovementSet>(buf);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifyMovementSetBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifyBuffer<movement::MovementSet>(nullptr);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifySizePrefixedMovementSetBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifySizePrefixedBuffer<movement::MovementSet>(nullptr);
|
||||
}
|
||||
|
||||
inline void FinishMovementSetBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<movement::MovementSet> root) {
|
||||
fbb.Finish(root);
|
||||
}
|
||||
|
||||
inline void FinishSizePrefixedMovementSetBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<movement::MovementSet> root) {
|
||||
fbb.FinishSizePrefixed(root);
|
||||
}
|
||||
|
||||
} // namespace movement
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_MOVEMENT_MOVEMENT_H_
|
||||
@@ -0,0 +1,229 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_TOPOLOGY_TOPOLOGY_H_
|
||||
#define FLATBUFFERS_GENERATED_TOPOLOGY_TOPOLOGY_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 12 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 19,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
namespace topology {
|
||||
|
||||
struct ChannelBoardConn;
|
||||
|
||||
struct NeighbourBlob;
|
||||
struct NeighbourBlobBuilder;
|
||||
|
||||
struct Topology;
|
||||
struct TopologyBuilder;
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(2) ChannelBoardConn FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
uint8_t channel_;
|
||||
int8_t padding0__;
|
||||
uint16_t board_id_;
|
||||
|
||||
public:
|
||||
ChannelBoardConn()
|
||||
: channel_(0),
|
||||
padding0__(0),
|
||||
board_id_(0) {
|
||||
(void)padding0__;
|
||||
}
|
||||
ChannelBoardConn(uint8_t _channel, uint16_t _board_id)
|
||||
: channel_(::flatbuffers::EndianScalar(_channel)),
|
||||
padding0__(0),
|
||||
board_id_(::flatbuffers::EndianScalar(_board_id)) {
|
||||
(void)padding0__;
|
||||
}
|
||||
uint8_t channel() const {
|
||||
return ::flatbuffers::EndianScalar(channel_);
|
||||
}
|
||||
uint16_t board_id() const {
|
||||
return ::flatbuffers::EndianScalar(board_id_);
|
||||
}
|
||||
};
|
||||
FLATBUFFERS_STRUCT_END(ChannelBoardConn, 4);
|
||||
|
||||
struct NeighbourBlob FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef NeighbourBlobBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_CURR_BOARD_ID = 4,
|
||||
VT_NUM_CONNECTIONS = 6,
|
||||
VT_NEIGHBOUR_CONNECTIONS = 8
|
||||
};
|
||||
uint16_t curr_board_id() const {
|
||||
return GetField<uint16_t>(VT_CURR_BOARD_ID, 0);
|
||||
}
|
||||
uint8_t num_connections() const {
|
||||
return GetField<uint8_t>(VT_NUM_CONNECTIONS, 0);
|
||||
}
|
||||
const ::flatbuffers::Vector<const topology::ChannelBoardConn *> *neighbour_connections() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<const topology::ChannelBoardConn *> *>(VT_NEIGHBOUR_CONNECTIONS);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<uint16_t>(verifier, VT_CURR_BOARD_ID, 2) &&
|
||||
VerifyField<uint8_t>(verifier, VT_NUM_CONNECTIONS, 1) &&
|
||||
VerifyOffset(verifier, VT_NEIGHBOUR_CONNECTIONS) &&
|
||||
verifier.VerifyVector(neighbour_connections()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct NeighbourBlobBuilder {
|
||||
typedef NeighbourBlob Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_curr_board_id(uint16_t curr_board_id) {
|
||||
fbb_.AddElement<uint16_t>(NeighbourBlob::VT_CURR_BOARD_ID, curr_board_id, 0);
|
||||
}
|
||||
void add_num_connections(uint8_t num_connections) {
|
||||
fbb_.AddElement<uint8_t>(NeighbourBlob::VT_NUM_CONNECTIONS, num_connections, 0);
|
||||
}
|
||||
void add_neighbour_connections(::flatbuffers::Offset<::flatbuffers::Vector<const topology::ChannelBoardConn *>> neighbour_connections) {
|
||||
fbb_.AddOffset(NeighbourBlob::VT_NEIGHBOUR_CONNECTIONS, neighbour_connections);
|
||||
}
|
||||
explicit NeighbourBlobBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<NeighbourBlob> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<NeighbourBlob>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<NeighbourBlob> CreateNeighbourBlob(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
uint16_t curr_board_id = 0,
|
||||
uint8_t num_connections = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<const topology::ChannelBoardConn *>> neighbour_connections = 0) {
|
||||
NeighbourBlobBuilder builder_(_fbb);
|
||||
builder_.add_neighbour_connections(neighbour_connections);
|
||||
builder_.add_curr_board_id(curr_board_id);
|
||||
builder_.add_num_connections(num_connections);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<NeighbourBlob> CreateNeighbourBlobDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
uint16_t curr_board_id = 0,
|
||||
uint8_t num_connections = 0,
|
||||
const std::vector<topology::ChannelBoardConn> *neighbour_connections = nullptr) {
|
||||
auto neighbour_connections__ = neighbour_connections ? _fbb.CreateVectorOfStructs<topology::ChannelBoardConn>(*neighbour_connections) : 0;
|
||||
return topology::CreateNeighbourBlob(
|
||||
_fbb,
|
||||
curr_board_id,
|
||||
num_connections,
|
||||
neighbour_connections__);
|
||||
}
|
||||
|
||||
struct Topology FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef TopologyBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_NUM_BOARDS = 4,
|
||||
VT_BOARDS = 6
|
||||
};
|
||||
uint16_t num_boards() const {
|
||||
return GetField<uint16_t>(VT_NUM_BOARDS, 0);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<topology::NeighbourBlob>> *boards() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<topology::NeighbourBlob>> *>(VT_BOARDS);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<uint16_t>(verifier, VT_NUM_BOARDS, 2) &&
|
||||
VerifyOffset(verifier, VT_BOARDS) &&
|
||||
verifier.VerifyVector(boards()) &&
|
||||
verifier.VerifyVectorOfTables(boards()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct TopologyBuilder {
|
||||
typedef Topology Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_num_boards(uint16_t num_boards) {
|
||||
fbb_.AddElement<uint16_t>(Topology::VT_NUM_BOARDS, num_boards, 0);
|
||||
}
|
||||
void add_boards(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<topology::NeighbourBlob>>> boards) {
|
||||
fbb_.AddOffset(Topology::VT_BOARDS, boards);
|
||||
}
|
||||
explicit TopologyBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<Topology> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<Topology>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<Topology> CreateTopology(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
uint16_t num_boards = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<topology::NeighbourBlob>>> boards = 0) {
|
||||
TopologyBuilder builder_(_fbb);
|
||||
builder_.add_boards(boards);
|
||||
builder_.add_num_boards(num_boards);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<Topology> CreateTopologyDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
uint16_t num_boards = 0,
|
||||
const std::vector<::flatbuffers::Offset<topology::NeighbourBlob>> *boards = nullptr) {
|
||||
auto boards__ = boards ? _fbb.CreateVector<::flatbuffers::Offset<topology::NeighbourBlob>>(*boards) : 0;
|
||||
return topology::CreateTopology(
|
||||
_fbb,
|
||||
num_boards,
|
||||
boards__);
|
||||
}
|
||||
|
||||
inline const topology::Topology *GetTopology(const void *buf) {
|
||||
return ::flatbuffers::GetRoot<topology::Topology>(buf);
|
||||
}
|
||||
|
||||
inline const topology::Topology *GetSizePrefixedTopology(const void *buf) {
|
||||
return ::flatbuffers::GetSizePrefixedRoot<topology::Topology>(buf);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifyTopologyBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifyBuffer<topology::Topology>(nullptr);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifySizePrefixedTopologyBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifySizePrefixedBuffer<topology::Topology>(nullptr);
|
||||
}
|
||||
|
||||
inline void FinishTopologyBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<topology::Topology> root) {
|
||||
fbb.Finish(root);
|
||||
}
|
||||
|
||||
inline void FinishSizePrefixedTopologyBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<topology::Topology> root) {
|
||||
fbb.FinishSizePrefixed(root);
|
||||
}
|
||||
|
||||
} // namespace topology
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_TOPOLOGY_TOPOLOGY_H_
|
||||
@@ -1,4 +1,4 @@
|
||||
idf_component_register(SRCS "MovementManager.cpp" "MovementManager.cpp" "TopologyManager.cpp"
|
||||
PRIV_REQUIRES esp_event nvs_flash
|
||||
PRIV_REQUIRES esp_event nvs_flash rmt dataLink flatbuffers
|
||||
# REQUIRES esp_timer
|
||||
INCLUDE_DIRS "include")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "MovementBlobs.h"
|
||||
#include "MovementSetManager.h"
|
||||
#include "esp_log.h"
|
||||
#ifdef MOVEMENTS
|
||||
|
||||
@@ -15,4 +15,32 @@ MovementSetManager::~MovementSetManager(){
|
||||
nvs_close(handle);
|
||||
}
|
||||
|
||||
// esp_err_t MovementSetManager::add_movement(struct MovementEntry& entry, uint8_t& index){
|
||||
// return ESP_OK;
|
||||
// }
|
||||
|
||||
// esp_err_t MovementSetManager::remove_movement(uint8_t index){
|
||||
// return ESP_OK;
|
||||
// }
|
||||
|
||||
// esp_err_t MovementSetManager::update_movement(struct MovementEntry& entry, uint8_t index){
|
||||
// return ESP_OK;
|
||||
// }
|
||||
|
||||
// esp_err_t MovementSetManager::get_curr_movement_set(struct MovementSet& set){
|
||||
// return ESP_OK;
|
||||
// }
|
||||
|
||||
// esp_err_t MovementSetManager::verify_movement_set(){
|
||||
// return ESP_OK;
|
||||
// }
|
||||
|
||||
// esp_err_t MovementSetManager::get_nvs_movement_set(struct MovementSet& set){
|
||||
// return ESP_OK;
|
||||
// }
|
||||
|
||||
// esp_err_t MovementSetManager::write_nvs_movement_set(){
|
||||
// return ESP_OK;
|
||||
// }
|
||||
|
||||
#endif //MOVEMENTS
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "TopologyBlobs.h"
|
||||
#include "TopologyManager.h"
|
||||
#include "esp_log.h"
|
||||
#ifdef MOVEMENTS
|
||||
|
||||
@@ -9,10 +9,91 @@ TopologyManager::TopologyManager(){
|
||||
ESP_LOGE(MOVEMENTS_DEBUG_TAG, "Failed to open nvs for %s", MOVEMENTS_NVS_NAMESPACE);
|
||||
return;
|
||||
}
|
||||
|
||||
ready = true;
|
||||
};
|
||||
|
||||
TopologyManager::~TopologyManager(){
|
||||
nvs_close(handle);
|
||||
}
|
||||
|
||||
// esp_err_t TopologyManager::add_board_to_topology(struct NeighbourBlob& blob){
|
||||
// if (!ready){
|
||||
// return ESP_ERR_INVALID_STATE;
|
||||
// }
|
||||
|
||||
// if (blob.num_connections > MAX_CHANNELS || blob.curr_board_id == PC_ADDR || blob.curr_board_id == BROADCAST_ADDR){
|
||||
// return ESP_ERR_INVALID_ARG;
|
||||
// }
|
||||
|
||||
// for (uint8_t i = 0; i < blob.num_connections; i++){
|
||||
// ChannelBoardConn connection = blob.neighbour_connections[i];
|
||||
// if (connection.channel > MAX_CHANNELS || connection.board_id == PC_ADDR
|
||||
// || connection == BROADCAST_ADDR || connection.board_id == blob.curr_board_id){
|
||||
// return ESP_ERR_INVALID_ARG;
|
||||
// }
|
||||
// }
|
||||
|
||||
// topology[blob.curr_board_id] = blob;
|
||||
|
||||
// return ESP_OK;
|
||||
// }
|
||||
|
||||
// esp_err_t TopologyManager::remove_board_from_topology(uint16_t board_id){
|
||||
// if (!ready){
|
||||
// return ESP_ERR_INVALID_STATE;
|
||||
// }
|
||||
|
||||
// if (topology.find(board_id) == topology.end()){
|
||||
// return ESP_ERR_NOT_FOUND;
|
||||
// }
|
||||
|
||||
// topology.erase(board_id);
|
||||
|
||||
// return ESP_OK;
|
||||
// }
|
||||
|
||||
// esp_err_t TopologyManager::get_board_in_topology(struct NeighbourBlob& blob){
|
||||
// if (!ready){
|
||||
// return ESP_ERR_INVALID_STATE;
|
||||
// }
|
||||
|
||||
// if (topology.find(board_id) == topology.end()){
|
||||
// return ESP_ERR_NOT_FOUND;
|
||||
// }
|
||||
|
||||
// blob = topology.find(board_id);
|
||||
|
||||
// return ESP_OK;
|
||||
// }
|
||||
|
||||
// esp_err_t TopologyManager::verify_topology(){
|
||||
// if (!ready){
|
||||
// return ESP_ERR_INVALID_STATE;
|
||||
// }
|
||||
// return ESP_OK;
|
||||
// }
|
||||
|
||||
// esp_err_t TopologyManager::get_curr_topology(struct Topology& topology){
|
||||
// if (!ready){
|
||||
// return ESP_ERR_INVALID_STATE;
|
||||
// }
|
||||
|
||||
// return ESP_OK;
|
||||
// }
|
||||
|
||||
// esp_err_t TopologyManager::write_nvs_topology(){
|
||||
// if (!ready){
|
||||
// return ESP_ERR_INVALID_STATE;
|
||||
// }
|
||||
// return ESP_OK;
|
||||
// }
|
||||
|
||||
// esp_err_t TopologyManager::get_nvs_topology(struct Topology& topology){
|
||||
// if (!ready){
|
||||
// return ESP_ERR_INVALID_STATE;
|
||||
// }
|
||||
// return ESP_OK;
|
||||
// }
|
||||
|
||||
#endif //MOVEMENTS
|
||||
@@ -1,50 +0,0 @@
|
||||
#include "MovementManager.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "TopologyBlobs.h"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#ifdef MOVEMENTS
|
||||
#pragma once
|
||||
|
||||
typedef struct _condition_blob {
|
||||
uint16_t value;
|
||||
uint8_t cond;
|
||||
uint8_t moduleType;
|
||||
uint8_t in_use;
|
||||
} ConditionBlob;
|
||||
|
||||
typedef struct _movement_entry {
|
||||
uint16_t board_id;
|
||||
uint8_t moduleType;
|
||||
uint16_t value_action;
|
||||
ConditionBlob condition;
|
||||
uint8_t ack;
|
||||
uint16_t ack_ttl_ms;
|
||||
uint16_t post_delay_ms;
|
||||
} MovementEntry;
|
||||
|
||||
typedef struct _movement {
|
||||
uint8_t num_movements;
|
||||
MovementEntry movements[];
|
||||
} MovementSet;
|
||||
|
||||
class MovementSetManager {
|
||||
public:
|
||||
MovementSetManager();
|
||||
~MovementSetManager();
|
||||
esp_err_t add_movement(MovementEntry& entry, uint8_t& index);
|
||||
esp_err_t remove_movement(uint8_t index);
|
||||
esp_err_t update_movement(MovementEntry& entry, uint8_t index);
|
||||
esp_err_t get_curr_movement_set(MovementSet& set);
|
||||
esp_err_t verify_movement_set();
|
||||
esp_err_t get_nvs_movement_set(MovementSet& set);
|
||||
esp_err_t write_nvs_movement_set();
|
||||
|
||||
private:
|
||||
std::unique_ptr<TopologyManager> topology_manager;
|
||||
std::vector<MovementEntry> movements;
|
||||
nvs_handle_t handle;
|
||||
};
|
||||
|
||||
#endif //MOVEMENTS
|
||||
28
components/movements/include/MovementSetManager.h
Normal file
28
components/movements/include/MovementSetManager.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "MovementManager.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "TopologyManager.h"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#ifdef MOVEMENTS
|
||||
#pragma once
|
||||
|
||||
class MovementSetManager {
|
||||
public:
|
||||
MovementSetManager();
|
||||
~MovementSetManager();
|
||||
// esp_err_t add_movement(struct MovementEntry& entry, uint8_t& index);
|
||||
// esp_err_t remove_movement(uint8_t index);
|
||||
// esp_err_t update_movement(struct MovementEntry& entry, uint8_t index);
|
||||
// esp_err_t get_curr_movement_set(struct MovementSet& set);
|
||||
// esp_err_t verify_movement_set();
|
||||
// esp_err_t get_nvs_movement_set(struct MovementSet& set);
|
||||
// esp_err_t write_nvs_movement_set();
|
||||
|
||||
private:
|
||||
std::unique_ptr<TopologyManager> topology_manager;
|
||||
std::vector<struct MovementEntry> movements;
|
||||
nvs_handle_t handle;
|
||||
};
|
||||
|
||||
#endif //MOVEMENTS
|
||||
@@ -1,42 +0,0 @@
|
||||
#include "MovementManager.h"
|
||||
#include "nvs_flash.h"
|
||||
#include <unordered_map>
|
||||
|
||||
#ifdef MOVEMENTS
|
||||
#pragma once
|
||||
|
||||
typedef struct _channel_board_conn {
|
||||
uint8_t channel;
|
||||
uint16_t board_id;
|
||||
} ChannelBoardConn;
|
||||
|
||||
typedef struct _neighbour_blob {
|
||||
uint16_t curr_board_id;
|
||||
uint8_t num_connections;
|
||||
ChannelBoardConn neighbour_connections[];
|
||||
} NeighbourBlob;
|
||||
|
||||
typedef struct _topology {
|
||||
uint16_t num_boards;
|
||||
NeighbourBlob boards[];
|
||||
} Topology;
|
||||
|
||||
class TopologyManager {
|
||||
public:
|
||||
TopologyManager();
|
||||
~TopologyManager();
|
||||
esp_err_t add_board_to_topology(NeighbourBlob blob);
|
||||
esp_err_t remove_board_from_topology(uint16_t board_id);
|
||||
esp_err_t update_board_in_topology(NeighbourBlob blob);
|
||||
esp_err_t get_board_in_topology(NeighbourBlob& blob);
|
||||
esp_err_t verify_topology();
|
||||
esp_err_t get_curr_topology(Topology& topology);
|
||||
esp_err_t write_nvs_topology();
|
||||
esp_err_t get_nvs_topology(Topology& topology);
|
||||
|
||||
private:
|
||||
std::unordered_map<uint16_t, NeighbourBlob> topology;
|
||||
nvs_handle_t handle;
|
||||
};
|
||||
|
||||
#endif //MOVEMENTS
|
||||
31
components/movements/include/TopologyManager.h
Normal file
31
components/movements/include/TopologyManager.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "MovementManager.h"
|
||||
#include "nvs_flash.h"
|
||||
#include <unordered_map>
|
||||
|
||||
// move these to constants header file?
|
||||
#include "RMTManager.h"
|
||||
#include "DataLinkManager.h"
|
||||
#include "Frames.h"
|
||||
|
||||
#ifdef MOVEMENTS
|
||||
#pragma once
|
||||
|
||||
class TopologyManager {
|
||||
public:
|
||||
TopologyManager();
|
||||
~TopologyManager();
|
||||
// esp_err_t add_board_to_topology(struct NeighbourBlob& blob);
|
||||
// esp_err_t remove_board_from_topology(uint16_t board_id);
|
||||
// esp_err_t get_board_in_topology(struct NeighbourBlob& blob);
|
||||
// esp_err_t verify_topology();
|
||||
// esp_err_t get_curr_topology(struct Topology& topology);
|
||||
// esp_err_t write_nvs_topology();
|
||||
// esp_err_t get_nvs_topology(struct Topology& topology);
|
||||
|
||||
private:
|
||||
// std::unordered_map<uint16_t, struct NeighbourBlob> topology;
|
||||
nvs_handle_t handle;
|
||||
bool ready = false;
|
||||
};
|
||||
|
||||
#endif //MOVEMENTS
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef RMT_COMMUNICATIONS
|
||||
#define RMT_COMMUNICATIONS
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "esp_event.h"
|
||||
|
||||
Reference in New Issue
Block a user