mirror of
https://github.com/BotChain-Robots/firmware.git
synced 2026-07-08 17:47:21 +02:00
Initial TCP server
This commit is contained in:
@@ -7,6 +7,6 @@
|
||||
|
||||
class IRPCServer {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
#endif //IRPCSERVER_H
|
||||
|
||||
@@ -5,15 +5,34 @@
|
||||
#ifndef TCPSERVER_H
|
||||
#define TCPSERVER_H
|
||||
|
||||
#include <vector>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
|
||||
#include "IRPCServer.h"
|
||||
|
||||
class TCPServer : IRPCServer {
|
||||
public:
|
||||
TCPServer();
|
||||
~TCPServer();
|
||||
explicit TCPServer(int port);
|
||||
~TCPServer();
|
||||
|
||||
private:
|
||||
bool authenticate_client(int client_sock);
|
||||
|
||||
}
|
||||
static bool is_network_connected();
|
||||
[[noreturn]] static void tcp_server_task(void *args);
|
||||
[[noreturn]] static void socket_monitor_thread(void *args);
|
||||
|
||||
int m_port;
|
||||
int m_server_sock;
|
||||
|
||||
TaskHandle_t m_task;
|
||||
TaskHandle_t m_rx_task;
|
||||
TaskHandle_t m_tx_task;
|
||||
|
||||
SemaphoreHandle_t m_mutex;
|
||||
std::unordered_set<int> m_clients;
|
||||
};
|
||||
|
||||
#endif //TCPSERVER_H
|
||||
|
||||
Reference in New Issue
Block a user