mirror of
https://github.com/BotChain-Robots/firmware.git
synced 2026-07-08 17:47:21 +02:00
37 lines
1.1 KiB
C++
37 lines
1.1 KiB
C++
//
|
|
// Created by Johnathon Slightham on 2025-06-30.
|
|
//
|
|
|
|
#include "TopologyMessageBuilder.h"
|
|
#include "SerializedMessage.h"
|
|
|
|
namespace Flatbuffers {
|
|
SerializedMessage TopologyMessageBuilder::build_topology_message(
|
|
const uint8_t module_id,
|
|
const ModuleType module_type,
|
|
const std::vector<uint8_t>& channel_to_module,
|
|
const std::vector<int8_t>& orientation_to_module,
|
|
const Messaging::ConnectionType connection_type,
|
|
const uint8_t leader) {
|
|
builder_.Clear();
|
|
|
|
const auto orientation_to_module_vector = builder_.CreateVector(orientation_to_module);
|
|
const auto channel_to_module_vector = builder_.CreateVector(channel_to_module);
|
|
|
|
const auto message = Messaging::CreateTopologyMessage(
|
|
builder_,
|
|
module_id,
|
|
module_type,
|
|
channel_to_module.size(),
|
|
channel_to_module_vector,
|
|
orientation_to_module_vector,
|
|
connection_type,
|
|
leader
|
|
);
|
|
|
|
builder_.Finish(message);
|
|
|
|
return {builder_.GetBufferPointer(), builder_.GetSize()};
|
|
}
|
|
}
|