mirror of
https://github.com/BotChain-Robots/firmware.git
synced 2026-07-08 17:47:21 +02:00
Add basic wifi support
This commit is contained in:
16
components/rpc/include/CommunicationRouter.h
Normal file
16
components/rpc/include/CommunicationRouter.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// Created by Johnathon Slightham on 2025-05-25.
|
||||
//
|
||||
|
||||
#ifndef COMMUNICATIONROUTER_H
|
||||
#define COMMUNICATIONROUTER_H
|
||||
|
||||
|
||||
|
||||
class CommunicationRouter {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif //COMMUNICATIONROUTER_H
|
||||
8
components/rpc/include/DiscoveryService.h
Normal file
8
components/rpc/include/DiscoveryService.h
Normal file
@@ -0,0 +1,8 @@
|
||||
//
|
||||
// Created by Johnathon Slightham on 2025-05-25.
|
||||
//
|
||||
|
||||
#ifndef DISCOVERYSERVICE_H
|
||||
#define DISCOVERYSERVICE_H
|
||||
|
||||
#endif //DISCOVERYSERVICE_H
|
||||
8
components/rpc/include/ICommunicationRouter.h
Normal file
8
components/rpc/include/ICommunicationRouter.h
Normal file
@@ -0,0 +1,8 @@
|
||||
//
|
||||
// Created by Johnathon Slightham on 2025-05-25.
|
||||
//
|
||||
|
||||
#ifndef ICOMMUNICATIONROUTER_H
|
||||
#define ICOMMUNICATIONROUTER_H
|
||||
|
||||
#endif //ICOMMUNICATIONROUTER_H
|
||||
8
components/rpc/include/IMessagingInterface.h
Normal file
8
components/rpc/include/IMessagingInterface.h
Normal file
@@ -0,0 +1,8 @@
|
||||
//
|
||||
// Created by Johnathon Slightham on 2025-05-25.
|
||||
//
|
||||
|
||||
#ifndef IMESSAGINGINTERFACE_H
|
||||
#define IMESSAGINGINTERFACE_H
|
||||
|
||||
#endif //IMESSAGINGINTERFACE_H
|
||||
8
components/rpc/include/IRPCServer.h
Normal file
8
components/rpc/include/IRPCServer.h
Normal file
@@ -0,0 +1,8 @@
|
||||
//
|
||||
// Created by Johnathon Slightham on 2025-05-25.
|
||||
//
|
||||
|
||||
#ifndef IRPCSERVER_H
|
||||
#define IRPCSERVER_H
|
||||
|
||||
#endif //IRPCSERVER_H
|
||||
16
components/rpc/include/MessagingInterface.h
Normal file
16
components/rpc/include/MessagingInterface.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// Created by Johnathon Slightham on 2025-05-25.
|
||||
//
|
||||
|
||||
#ifndef MESSAGINGINTERFACE_H
|
||||
#define MESSAGINGINTERFACE_H
|
||||
|
||||
|
||||
|
||||
class MessagingInterface {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif //MESSAGINGINTERFACE_H
|
||||
8
components/rpc/include/RPCFactory.h
Normal file
8
components/rpc/include/RPCFactory.h
Normal file
@@ -0,0 +1,8 @@
|
||||
//
|
||||
// Created by Johnathon Slightham on 2025-05-25.
|
||||
//
|
||||
|
||||
#ifndef RPCFACTORY_H
|
||||
#define RPCFACTORY_H
|
||||
|
||||
#endif //RPCFACTORY_H
|
||||
8
components/rpc/include/TCPServer.h
Normal file
8
components/rpc/include/TCPServer.h
Normal file
@@ -0,0 +1,8 @@
|
||||
//
|
||||
// Created by Johnathon Slightham on 2025-05-25.
|
||||
//
|
||||
|
||||
#ifndef TCPSERVER_H
|
||||
#define TCPSERVER_H
|
||||
|
||||
#endif //TCPSERVER_H
|
||||
39
components/rpc/include/WifiManager.h
Normal file
39
components/rpc/include/WifiManager.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#ifndef NETWORKMANAGER_H
|
||||
#define NETWORKMANAGER_H
|
||||
|
||||
#include "esp_event.h"
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/semphr.h"
|
||||
|
||||
class WifiManager {
|
||||
public:
|
||||
WifiManager() = default;
|
||||
~WifiManager() = default;
|
||||
int init();
|
||||
int connect();
|
||||
int disconnect();
|
||||
|
||||
[[noreturn]] void manage();
|
||||
|
||||
enum class wifi_state { connect, connected, disconnected, connecting, disconnect, searching };
|
||||
|
||||
private:
|
||||
void update_state(wifi_state state);
|
||||
[[noreturn]] static void s_manage(WifiManager *that);
|
||||
int init_connection();
|
||||
int handle_connecting();
|
||||
int handle_disconnect();
|
||||
int handle_search();
|
||||
|
||||
static void wifi_event_handler(void *event_handler_arg, esp_event_base_t event_base, int32_t event_id, void *event_data);
|
||||
|
||||
|
||||
SemaphoreHandle_t m_mutex;
|
||||
wifi_state m_state;
|
||||
TaskHandle_t m_task;
|
||||
unsigned int m_attempts;
|
||||
|
||||
};
|
||||
|
||||
#endif //NETWORKMANAGER_H
|
||||
Reference in New Issue
Block a user