mirror of
https://github.com/BotChain-Robots/firmware.git
synced 2026-07-08 17:47:21 +02:00
UDP implementation
This commit is contained in:
@@ -37,6 +37,7 @@ public:
|
||||
m_config_manager(ConfigManager::get_instance()),
|
||||
m_pc_connection(CommunicationFactory::create_connection_manager(m_config_manager.get_communication_method())),
|
||||
m_lossless_server(CommunicationFactory::create_lossless_server(m_config_manager.get_communication_method(), m_tcp_rx_queue)),
|
||||
m_lossy_server(CommunicationFactory::create_lossy_server(m_config_manager.get_communication_method(), m_tcp_rx_queue)),
|
||||
m_data_link_manager(std::make_unique<DataLinkManager>(m_config_manager.get_module_id(), MODULE_TO_NUM_CHANNELS_MAP[m_config_manager.get_module_type()])),
|
||||
m_module_id(m_config_manager.get_module_id()),
|
||||
m_last_leader_updated(std::chrono::system_clock::now()),
|
||||
@@ -44,14 +45,14 @@ public:
|
||||
OrientationDetection::init();
|
||||
update_leader();
|
||||
|
||||
xTaskCreate(router_thread, "communication_router", 4096, this, 3, &this->m_router_thread);
|
||||
xTaskCreate(router_thread, "router", 4096, this, 3, &this->m_router_thread);
|
||||
|
||||
const auto num_channels = MODULE_TO_NUM_CHANNELS_MAP[m_config_manager.get_module_type()];
|
||||
this->m_link_layer_threads.resize(num_channels);
|
||||
for (int i = 0; i < num_channels; i++) {
|
||||
auto *params = new link_layer_thread_params(this, i);
|
||||
xTaskCreate(link_layer_thread, "communication_router_rmt", 4096, params, 3, &this->m_link_layer_threads[i]);
|
||||
}
|
||||
// const auto num_channels = MODULE_TO_NUM_CHANNELS_MAP[m_config_manager.get_module_type()];
|
||||
// this->m_link_layer_threads.resize(num_channels);
|
||||
// for (int i = 0; i < num_channels; i++) {
|
||||
// auto *params = new link_layer_thread_params(this, i);
|
||||
// xTaskCreate(link_layer_thread, "router_rmt", 4096, params, 3, &this->m_link_layer_threads[i]);
|
||||
// }
|
||||
}
|
||||
|
||||
~CommunicationRouter();
|
||||
@@ -65,7 +66,7 @@ public:
|
||||
[[nodiscard]] uint8_t get_leader() const;
|
||||
|
||||
// todo: does this really need to be here (so i can access from thread)?
|
||||
std::shared_ptr<PtrQueue<std::vector<uint8_t>>> m_tcp_rx_queue;
|
||||
std::shared_ptr<PtrQueue<std::vector<uint8_t>>> m_tcp_rx_queue; // todo: this should probably be thread safe
|
||||
std::function<void(char*, int)> m_rx_callback;
|
||||
private:
|
||||
TaskHandle_t m_router_thread = nullptr;
|
||||
@@ -73,6 +74,7 @@ private:
|
||||
std::unique_ptr<IConnectionManager> m_pc_connection;
|
||||
std::vector<TaskHandle_t> m_link_layer_threads;
|
||||
std::unique_ptr<IRPCServer> m_lossless_server;
|
||||
std::unique_ptr<IRPCServer> m_lossy_server;
|
||||
std::unique_ptr<DataLinkManager> m_data_link_manager;
|
||||
uint8_t m_leader = 0;
|
||||
uint8_t m_module_id;
|
||||
|
||||
Reference in New Issue
Block a user