mirror of
https://github.com/BotChain-Robots/firmware.git
synced 2026-07-08 17:47:21 +02:00
Board to PC
This commit is contained in:
@@ -4,21 +4,31 @@
|
||||
|
||||
#include "MessagingInterface.h"
|
||||
|
||||
#include <ConfigManager.h>
|
||||
#include <freertos/queue.h>
|
||||
#include <freertos/semphr.h>
|
||||
|
||||
#include "MPIMessageBuilder.h"
|
||||
|
||||
MessagingInterface::~MessagingInterface() {
|
||||
vQueueDelete(m_mpi_rx_queue);
|
||||
vSemaphoreDelete(m_map_semaphore);
|
||||
|
||||
for (const auto [_tag, queue] : m_tag_to_queue) {
|
||||
vQueueDelete(queue);
|
||||
}
|
||||
}
|
||||
|
||||
int MessagingInterface::send(char* buffer, int size, int destination, int tag, bool durable) {
|
||||
Flatbuffers::MPIMessageBuilder builder;
|
||||
const auto [mpi_buffer, mpi_size] = builder.build_mpi_message(Messaging::MessageType_PTP, ConfigManager::get_module_id(), destination, sequence_number++, durable, tag, std::vector<uint8_t>(buffer, buffer + size));
|
||||
|
||||
m_router->send_msg(static_cast<char *>(mpi_buffer), mpi_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MessagingInterface::broadcast(char* buffer, int size, int root, bool durable) {
|
||||
|
||||
// todo: impl
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user