diff --git a/include/event_handlers/WebSocket.h b/include/message_handlers/WebSocket.h similarity index 78% rename from include/event_handlers/WebSocket.h rename to include/message_handlers/WebSocket.h index 626b6216..98c8dc0e 100644 --- a/include/event_handlers/WebSocket.h +++ b/include/message_handlers/WebSocket.h @@ -2,7 +2,7 @@ #include -namespace OpenShock::EventHandlers::WebSocket { +namespace OpenShock::MessageHandlers::WebSocket { void HandleGatewayBinary(const uint8_t* data, std::size_t len); void HandleLocalBinary(uint8_t socketId, const uint8_t* data, std::size_t len); } diff --git a/include/event_handlers/impl/WSGateway.h b/include/message_handlers/impl/WSGateway.h similarity index 100% rename from include/event_handlers/impl/WSGateway.h rename to include/message_handlers/impl/WSGateway.h diff --git a/include/event_handlers/impl/WSLocal.h b/include/message_handlers/impl/WSLocal.h similarity index 100% rename from include/event_handlers/impl/WSLocal.h rename to include/message_handlers/impl/WSLocal.h diff --git a/src/CaptivePortalInstance.cpp b/src/CaptivePortalInstance.cpp index 876729b5..62970fe1 100644 --- a/src/CaptivePortalInstance.cpp +++ b/src/CaptivePortalInstance.cpp @@ -5,9 +5,9 @@ const char* const TAG = "CaptivePortalInstance"; #include "CommandHandler.h" -#include "event_handlers/WebSocket.h" #include "GatewayConnectionManager.h" #include "Logging.h" +#include "message_handlers/WebSocket.h" #include "serialization/WSLocal.h" #include "util/FnProxy.h" #include "util/HexUtils.h" @@ -29,7 +29,8 @@ const uint32_t WEBSOCKET_UPDATE_INTERVAL = 10; // 10ms / 100Hz using namespace OpenShock; -const esp_partition_t* _getStaticPartition() { +const esp_partition_t* _getStaticPartition() +{ const esp_partition_t* partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_SPIFFS, "static0"); if (partition != nullptr) { return partition; @@ -43,7 +44,8 @@ const esp_partition_t* _getStaticPartition() { return nullptr; } -const char* _getPartitionHash() { +const char* _getPartitionHash() +{ const esp_partition_t* partition = _getStaticPartition(); if (partition == nullptr) { return nullptr; @@ -63,7 +65,8 @@ CaptivePortalInstance::CaptivePortalInstance() , m_socketDeFragger(std::bind(&CaptivePortalInstance::handleWebSocketEvent, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4)) , m_fileSystem() , m_dnsServer() - , m_taskHandle(nullptr) { + , m_taskHandle(nullptr) +{ m_socketServer.onEvent(std::bind(&WebSocketDeFragger::handler, &m_socketDeFragger, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4)); m_socketServer.begin(); m_socketServer.enableHeartbeat(WEBSOCKET_PING_INTERVAL, WEBSOCKET_PING_TIMEOUT, WEBSOCKET_PING_RETRIES); @@ -130,7 +133,8 @@ discord.gg/OpenShock } } -CaptivePortalInstance::~CaptivePortalInstance() { +CaptivePortalInstance::~CaptivePortalInstance() +{ if (m_taskHandle != nullptr) { vTaskDelete(m_taskHandle); m_taskHandle = nullptr; @@ -141,7 +145,8 @@ CaptivePortalInstance::~CaptivePortalInstance() { m_dnsServer.stop(); } -void CaptivePortalInstance::task() { +void CaptivePortalInstance::task() +{ while (true) { m_socketServer.loop(); // instance->m_dnsServer.processNextRequest(); @@ -149,7 +154,8 @@ void CaptivePortalInstance::task() { } } -void CaptivePortalInstance::handleWebSocketClientConnected(uint8_t socketId) { +void CaptivePortalInstance::handleWebSocketClientConnected(uint8_t socketId) +{ OS_LOGD(TAG, "WebSocket client #%u connected from %s", socketId, m_socketServer.remoteIP(socketId).toString().c_str()); WiFiNetwork connectedNetwork; @@ -166,15 +172,18 @@ void CaptivePortalInstance::handleWebSocketClientConnected(uint8_t socketId) { Serialization::Local::SerializeWiFiNetworksEvent(Serialization::Types::WifiNetworkEventType::Discovered, networks, std::bind(&CaptivePortalInstance::sendMessageBIN, this, socketId, std::placeholders::_1, std::placeholders::_2)); } -void CaptivePortalInstance::handleWebSocketClientDisconnected(uint8_t socketId) { +void CaptivePortalInstance::handleWebSocketClientDisconnected(uint8_t socketId) +{ OS_LOGD(TAG, "WebSocket client #%u disconnected", socketId); } -void CaptivePortalInstance::handleWebSocketClientError(uint8_t socketId, uint16_t code, const char* message) { +void CaptivePortalInstance::handleWebSocketClientError(uint8_t socketId, uint16_t code, const char* message) +{ OS_LOGE(TAG, "WebSocket client #%u error %u: %s", socketId, code, message); } -void CaptivePortalInstance::handleWebSocketEvent(uint8_t socketId, WebSocketMessageType type, const uint8_t* payload, std::size_t length) { +void CaptivePortalInstance::handleWebSocketEvent(uint8_t socketId, WebSocketMessageType type, const uint8_t* payload, std::size_t length) +{ switch (type) { case WebSocketMessageType::Connected: handleWebSocketClientConnected(socketId); @@ -186,7 +195,7 @@ void CaptivePortalInstance::handleWebSocketEvent(uint8_t socketId, WebSocketMess OS_LOGE(TAG, "Message type is not supported"); break; case WebSocketMessageType::Binary: - EventHandlers::WebSocket::HandleLocalBinary(socketId, payload, length); + MessageHandlers::WebSocket::HandleLocalBinary(socketId, payload, length); break; case WebSocketMessageType::Error: handleWebSocketClientError(socketId, length, reinterpret_cast(payload)); diff --git a/src/GatewayClient.cpp b/src/GatewayClient.cpp index 8c250426..ca445c35 100644 --- a/src/GatewayClient.cpp +++ b/src/GatewayClient.cpp @@ -4,9 +4,9 @@ const char* const TAG = "GatewayClient"; #include "Common.h" #include "config/Config.h" -#include "event_handlers/WebSocket.h" #include "events/Events.h" #include "Logging.h" +#include "message_handlers/WebSocket.h" #include "OtaUpdateManager.h" #include "serialization/WSGateway.h" #include "Time.h" @@ -203,7 +203,7 @@ void GatewayClient::_handleEvent(WStype_t type, uint8_t* payload, std::size_t le OS_LOGV(TAG, "Received pong from API"); break; case WStype_BIN: - EventHandlers::WebSocket::HandleGatewayBinary(payload, length); + MessageHandlers::WebSocket::HandleGatewayBinary(payload, length); break; case WStype_FRAGMENT_BIN_START: OS_LOGE(TAG, "Received binary fragment start from API, this is not supported!"); diff --git a/src/event_handlers/websocket/Gateway.cpp b/src/message_handlers/websocket/Gateway.cpp similarity index 90% rename from src/event_handlers/websocket/Gateway.cpp rename to src/message_handlers/websocket/Gateway.cpp index 1be52a78..3f6fb1f2 100644 --- a/src/event_handlers/websocket/Gateway.cpp +++ b/src/message_handlers/websocket/Gateway.cpp @@ -1,8 +1,8 @@ -#include "event_handlers/WebSocket.h" +#include "message_handlers/WebSocket.h" const char* const TAG = "ServerMessageHandlers"; -#include "event_handlers/impl/WSGateway.h" +#include "message_handlers/impl/WSGateway.h" #include "Logging.h" @@ -34,7 +34,8 @@ static std::array s_serverHandlers = []() return handlers; }(); -void EventHandlers::WebSocket::HandleGatewayBinary(const uint8_t* data, std::size_t len) { +void MessageHandlers::WebSocket::HandleGatewayBinary(const uint8_t* data, std::size_t len) +{ // Deserialize auto msg = flatbuffers::GetRoot(data); if (msg == nullptr) { diff --git a/src/event_handlers/websocket/Local.cpp b/src/message_handlers/websocket/Local.cpp similarity index 92% rename from src/event_handlers/websocket/Local.cpp rename to src/message_handlers/websocket/Local.cpp index 8c5b0f23..4728fe57 100644 --- a/src/event_handlers/websocket/Local.cpp +++ b/src/message_handlers/websocket/Local.cpp @@ -1,9 +1,9 @@ -#include "event_handlers/WebSocket.h" +#include "message_handlers/WebSocket.h" const char* const TAG = "LocalMessageHandlers"; -#include "event_handlers/impl/WSLocal.h" #include "Logging.h" +#include "message_handlers/impl/WSLocal.h" #include "serialization/_fbs/LocalToHubMessage_generated.h" @@ -39,7 +39,8 @@ static std::array s_localHandlers = []() { return handlers; }(); -void EventHandlers::WebSocket::HandleLocalBinary(uint8_t socketId, const uint8_t* data, std::size_t len) { +void MessageHandlers::WebSocket::HandleLocalBinary(uint8_t socketId, const uint8_t* data, std::size_t len) +{ // Deserialize auto msg = flatbuffers::GetRoot(data); if (msg == nullptr) { diff --git a/src/event_handlers/websocket/gateway/CaptivePortalConfig.cpp b/src/message_handlers/websocket/gateway/CaptivePortalConfig.cpp similarity index 86% rename from src/event_handlers/websocket/gateway/CaptivePortalConfig.cpp rename to src/message_handlers/websocket/gateway/CaptivePortalConfig.cpp index f30327c4..a0f04366 100644 --- a/src/event_handlers/websocket/gateway/CaptivePortalConfig.cpp +++ b/src/message_handlers/websocket/gateway/CaptivePortalConfig.cpp @@ -1,4 +1,4 @@ -#include "event_handlers/impl/WSGateway.h" +#include "message_handlers/impl/WSGateway.h" const char* const TAG = "ServerMessageHandlers"; @@ -9,7 +9,8 @@ const char* const TAG = "ServerMessageHandlers"; using namespace OpenShock::MessageHandlers::Server; -void _Private::HandleCaptivePortalConfig(const OpenShock::Serialization::Gateway::GatewayToHubMessage* root) { +void _Private::HandleCaptivePortalConfig(const OpenShock::Serialization::Gateway::GatewayToHubMessage* root) +{ auto msg = root->payload_as_CaptivePortalConfig(); if (msg == nullptr) { OS_LOGE(TAG, "Payload cannot be parsed as CaptivePortalConfig"); diff --git a/src/event_handlers/websocket/gateway/OtaInstall.cpp b/src/message_handlers/websocket/gateway/OtaInstall.cpp similarity index 93% rename from src/event_handlers/websocket/gateway/OtaInstall.cpp rename to src/message_handlers/websocket/gateway/OtaInstall.cpp index 55812ce1..8faf5ef4 100644 --- a/src/event_handlers/websocket/gateway/OtaInstall.cpp +++ b/src/message_handlers/websocket/gateway/OtaInstall.cpp @@ -1,4 +1,4 @@ -#include "event_handlers/impl/WSGateway.h" +#include "message_handlers/impl/WSGateway.h" const char* const TAG = "ServerMessageHandlers"; @@ -10,7 +10,8 @@ const char* const TAG = "ServerMessageHandlers"; using namespace OpenShock::MessageHandlers::Server; -void _Private::HandleOtaInstall(const OpenShock::Serialization::Gateway::GatewayToHubMessage* root) { +void _Private::HandleOtaInstall(const OpenShock::Serialization::Gateway::GatewayToHubMessage* root) +{ auto msg = root->payload_as_OtaInstall(); if (msg == nullptr) { OS_LOGE(TAG, "Payload cannot be parsed as OtaInstall"); diff --git a/src/event_handlers/websocket/gateway/ShockerCommandList.cpp b/src/message_handlers/websocket/gateway/ShockerCommandList.cpp similarity index 82% rename from src/event_handlers/websocket/gateway/ShockerCommandList.cpp rename to src/message_handlers/websocket/gateway/ShockerCommandList.cpp index 620cf07f..306afa80 100644 --- a/src/event_handlers/websocket/gateway/ShockerCommandList.cpp +++ b/src/message_handlers/websocket/gateway/ShockerCommandList.cpp @@ -1,4 +1,4 @@ -#include "event_handlers/impl/WSGateway.h" +#include "message_handlers/impl/WSGateway.h" const char* const TAG = "ServerMessageHandlers"; @@ -10,7 +10,8 @@ const char* const TAG = "ServerMessageHandlers"; using namespace OpenShock::MessageHandlers::Server; -void _Private::HandleShockerCommandList(const OpenShock::Serialization::Gateway::GatewayToHubMessage* root) { +void _Private::HandleShockerCommandList(const OpenShock::Serialization::Gateway::GatewayToHubMessage* root) +{ auto msg = root->payload_as_ShockerCommandList(); if (msg == nullptr) { OS_LOGE(TAG, "Payload cannot be parsed as ShockerCommandList"); @@ -26,9 +27,9 @@ void _Private::HandleShockerCommandList(const OpenShock::Serialization::Gateway: OS_LOGV(TAG, "Received command list from API (%u commands)", commands->size()); for (auto command : *commands) { - uint16_t id = command->id(); - uint8_t intensity = command->intensity(); - uint16_t durationMs = command->duration(); + uint16_t id = command->id(); + uint8_t intensity = command->intensity(); + uint16_t durationMs = command->duration(); OpenShock::ShockerModelType model = command->model(); OpenShock::ShockerCommandType type = command->type(); diff --git a/src/event_handlers/websocket/gateway/_InvalidMessage.cpp b/src/message_handlers/websocket/gateway/_InvalidMessage.cpp similarity index 79% rename from src/event_handlers/websocket/gateway/_InvalidMessage.cpp rename to src/message_handlers/websocket/gateway/_InvalidMessage.cpp index d6ff4754..15ae23aa 100644 --- a/src/event_handlers/websocket/gateway/_InvalidMessage.cpp +++ b/src/message_handlers/websocket/gateway/_InvalidMessage.cpp @@ -1,4 +1,4 @@ -#include "event_handlers/impl/WSGateway.h" +#include "message_handlers/impl/WSGateway.h" const char* const TAG = "ServerMessageHandlers"; @@ -6,7 +6,8 @@ const char* const TAG = "ServerMessageHandlers"; using namespace OpenShock::MessageHandlers::Server; -void _Private::HandleInvalidMessage(const OpenShock::Serialization::Gateway::GatewayToHubMessage* root) { +void _Private::HandleInvalidMessage(const OpenShock::Serialization::Gateway::GatewayToHubMessage* root) +{ if (root == nullptr) { OS_LOGE(TAG, "Message cannot be parsed"); return; diff --git a/src/event_handlers/websocket/local/AccountLinkCommand.cpp b/src/message_handlers/websocket/local/AccountLinkCommand.cpp similarity index 90% rename from src/event_handlers/websocket/local/AccountLinkCommand.cpp rename to src/message_handlers/websocket/local/AccountLinkCommand.cpp index c98683c4..9b019db1 100644 --- a/src/event_handlers/websocket/local/AccountLinkCommand.cpp +++ b/src/message_handlers/websocket/local/AccountLinkCommand.cpp @@ -1,4 +1,4 @@ -#include "event_handlers/impl/WSLocal.h" +#include "message_handlers/impl/WSLocal.h" const char* const TAG = "LocalMessageHandlers"; @@ -8,7 +8,8 @@ const char* const TAG = "LocalMessageHandlers"; #include -void serializeAccountLinkCommandResult(uint8_t socketId, OpenShock::Serialization::Local::AccountLinkResultCode result) { +void serializeAccountLinkCommandResult(uint8_t socketId, OpenShock::Serialization::Local::AccountLinkResultCode result) +{ flatbuffers::FlatBufferBuilder builder(1024); // TODO: Determine a good size auto responseOffset = OpenShock::Serialization::Local::CreateAccountLinkCommandResult(builder, result); @@ -25,7 +26,8 @@ void serializeAccountLinkCommandResult(uint8_t socketId, OpenShock::Serializatio using namespace OpenShock::MessageHandlers::Local; -void _Private::HandleAccountLinkCommand(uint8_t socketId, const OpenShock::Serialization::Local::LocalToHubMessage* root) { +void _Private::HandleAccountLinkCommand(uint8_t socketId, const OpenShock::Serialization::Local::LocalToHubMessage* root) +{ auto msg = root->payload_as_AccountLinkCommand(); if (msg == nullptr) { OS_LOGE(TAG, "Payload cannot be parsed as AccountLinkCommand"); diff --git a/src/event_handlers/websocket/local/AccountUnlinkCommand.cpp b/src/message_handlers/websocket/local/AccountUnlinkCommand.cpp similarity index 81% rename from src/event_handlers/websocket/local/AccountUnlinkCommand.cpp rename to src/message_handlers/websocket/local/AccountUnlinkCommand.cpp index 1d91902f..d72ffaf5 100644 --- a/src/event_handlers/websocket/local/AccountUnlinkCommand.cpp +++ b/src/message_handlers/websocket/local/AccountUnlinkCommand.cpp @@ -1,4 +1,4 @@ -#include "event_handlers/impl/WSLocal.h" +#include "message_handlers/impl/WSLocal.h" const char* const TAG = "LocalMessageHandlers"; @@ -9,7 +9,8 @@ const char* const TAG = "LocalMessageHandlers"; using namespace OpenShock::MessageHandlers::Local; -void _Private::HandleAccountUnlinkCommand(uint8_t socketId, const OpenShock::Serialization::Local::LocalToHubMessage* root) { +void _Private::HandleAccountUnlinkCommand(uint8_t socketId, const OpenShock::Serialization::Local::LocalToHubMessage* root) +{ (void)socketId; auto msg = root->payload_as_AccountUnlinkCommand(); diff --git a/src/event_handlers/websocket/local/SetEStopPinCommand.cpp b/src/message_handlers/websocket/local/SetEStopPinCommand.cpp similarity index 97% rename from src/event_handlers/websocket/local/SetEStopPinCommand.cpp rename to src/message_handlers/websocket/local/SetEStopPinCommand.cpp index b9e328d9..9f61ec55 100644 --- a/src/event_handlers/websocket/local/SetEStopPinCommand.cpp +++ b/src/message_handlers/websocket/local/SetEStopPinCommand.cpp @@ -1,4 +1,4 @@ -#include "event_handlers/impl/WSLocal.h" +#include "message_handlers/impl/WSLocal.h" #include "CaptivePortal.h" #include "CommandHandler.h" diff --git a/src/event_handlers/websocket/local/SetRfTxPinCommand.cpp b/src/message_handlers/websocket/local/SetRfTxPinCommand.cpp similarity index 97% rename from src/event_handlers/websocket/local/SetRfTxPinCommand.cpp rename to src/message_handlers/websocket/local/SetRfTxPinCommand.cpp index 490215f9..a21e1e15 100644 --- a/src/event_handlers/websocket/local/SetRfTxPinCommand.cpp +++ b/src/message_handlers/websocket/local/SetRfTxPinCommand.cpp @@ -1,4 +1,4 @@ -#include "event_handlers/impl/WSLocal.h" +#include "message_handlers/impl/WSLocal.h" const char* const TAG = "LocalMessageHandlers"; diff --git a/src/event_handlers/websocket/local/WiFiNetworkConnectCommand.cpp b/src/message_handlers/websocket/local/WiFiNetworkConnectCommand.cpp similarity index 94% rename from src/event_handlers/websocket/local/WiFiNetworkConnectCommand.cpp rename to src/message_handlers/websocket/local/WiFiNetworkConnectCommand.cpp index 80bb0029..eb05e6a5 100644 --- a/src/event_handlers/websocket/local/WiFiNetworkConnectCommand.cpp +++ b/src/message_handlers/websocket/local/WiFiNetworkConnectCommand.cpp @@ -1,4 +1,4 @@ -#include "event_handlers/impl/WSLocal.h" +#include "message_handlers/impl/WSLocal.h" const char* const TAG = "LocalMessageHandlers"; @@ -10,9 +10,10 @@ const char* const TAG = "LocalMessageHandlers"; using namespace OpenShock::MessageHandlers::Local; -void _Private::HandleWiFiNetworkConnectCommand(uint8_t socketId, const OpenShock::Serialization::Local::LocalToHubMessage* root) { +void _Private::HandleWiFiNetworkConnectCommand(uint8_t socketId, const OpenShock::Serialization::Local::LocalToHubMessage* root) +{ (void)socketId; - + auto msg = root->payload_as_WifiNetworkConnectCommand(); if (msg == nullptr) { OS_LOGE(TAG, "Payload cannot be parsed as WiFiNetworkConnectCommand"); diff --git a/src/event_handlers/websocket/local/WiFiNetworkDisconnectCommand.cpp b/src/message_handlers/websocket/local/WiFiNetworkDisconnectCommand.cpp similarity index 91% rename from src/event_handlers/websocket/local/WiFiNetworkDisconnectCommand.cpp rename to src/message_handlers/websocket/local/WiFiNetworkDisconnectCommand.cpp index 52b309fd..1e04aad8 100644 --- a/src/event_handlers/websocket/local/WiFiNetworkDisconnectCommand.cpp +++ b/src/message_handlers/websocket/local/WiFiNetworkDisconnectCommand.cpp @@ -1,4 +1,4 @@ -#include "event_handlers/impl/WSLocal.h" +#include "message_handlers/impl/WSLocal.h" const char* const TAG = "LocalMessageHandlers"; @@ -10,9 +10,10 @@ const char* const TAG = "LocalMessageHandlers"; using namespace OpenShock::MessageHandlers::Local; -void _Private::HandleWiFiNetworkDisconnectCommand(uint8_t socketId, const OpenShock::Serialization::Local::LocalToHubMessage* root) { +void _Private::HandleWiFiNetworkDisconnectCommand(uint8_t socketId, const OpenShock::Serialization::Local::LocalToHubMessage* root) +{ (void)socketId; - + auto msg = root->payload_as_WifiNetworkDisconnectCommand(); if (msg == nullptr) { OS_LOGE(TAG, "Payload cannot be parsed as WiFiNetworkDisconnectCommand"); diff --git a/src/event_handlers/websocket/local/WiFiNetworkForgetCommand.cpp b/src/message_handlers/websocket/local/WiFiNetworkForgetCommand.cpp similarity index 88% rename from src/event_handlers/websocket/local/WiFiNetworkForgetCommand.cpp rename to src/message_handlers/websocket/local/WiFiNetworkForgetCommand.cpp index 6cd1db1c..f1c4f8b5 100644 --- a/src/event_handlers/websocket/local/WiFiNetworkForgetCommand.cpp +++ b/src/message_handlers/websocket/local/WiFiNetworkForgetCommand.cpp @@ -1,4 +1,4 @@ -#include "event_handlers/impl/WSLocal.h" +#include "message_handlers/impl/WSLocal.h" const char* const TAG = "LocalMessageHandlers"; @@ -10,9 +10,10 @@ const char* const TAG = "LocalMessageHandlers"; using namespace OpenShock::MessageHandlers::Local; -void _Private::HandleWiFiNetworkForgetCommand(uint8_t socketId, const OpenShock::Serialization::Local::LocalToHubMessage* root) { +void _Private::HandleWiFiNetworkForgetCommand(uint8_t socketId, const OpenShock::Serialization::Local::LocalToHubMessage* root) +{ (void)socketId; - + auto msg = root->payload_as_WifiNetworkForgetCommand(); if (msg == nullptr) { OS_LOGE(TAG, "Payload cannot be parsed as WiFiNetworkForgetCommand"); diff --git a/src/event_handlers/websocket/local/WiFiNetworkSaveCommand.cpp b/src/message_handlers/websocket/local/WiFiNetworkSaveCommand.cpp similarity index 91% rename from src/event_handlers/websocket/local/WiFiNetworkSaveCommand.cpp rename to src/message_handlers/websocket/local/WiFiNetworkSaveCommand.cpp index 6ddf9fba..70c0b453 100644 --- a/src/event_handlers/websocket/local/WiFiNetworkSaveCommand.cpp +++ b/src/message_handlers/websocket/local/WiFiNetworkSaveCommand.cpp @@ -1,4 +1,4 @@ -#include "event_handlers/impl/WSLocal.h" +#include "message_handlers/impl/WSLocal.h" const char* const TAG = "LocalMessageHandlers"; @@ -10,9 +10,10 @@ const char* const TAG = "LocalMessageHandlers"; using namespace OpenShock::MessageHandlers::Local; -void _Private::HandleWiFiNetworkSaveCommand(uint8_t socketId, const OpenShock::Serialization::Local::LocalToHubMessage* root) { +void _Private::HandleWiFiNetworkSaveCommand(uint8_t socketId, const OpenShock::Serialization::Local::LocalToHubMessage* root) +{ (void)socketId; - + auto msg = root->payload_as_WifiNetworkSaveCommand(); if (msg == nullptr) { OS_LOGE(TAG, "Payload cannot be parsed as WiFiNetworkSaveCommand"); diff --git a/src/event_handlers/websocket/local/WiFiScanCommand.cpp b/src/message_handlers/websocket/local/WiFiScanCommand.cpp similarity index 83% rename from src/event_handlers/websocket/local/WiFiScanCommand.cpp rename to src/message_handlers/websocket/local/WiFiScanCommand.cpp index 06000867..8a4b3665 100644 --- a/src/event_handlers/websocket/local/WiFiScanCommand.cpp +++ b/src/message_handlers/websocket/local/WiFiScanCommand.cpp @@ -1,4 +1,4 @@ -#include "event_handlers/impl/WSLocal.h" +#include "message_handlers/impl/WSLocal.h" const char* const TAG = "LocalMessageHandlers"; @@ -7,9 +7,10 @@ const char* const TAG = "LocalMessageHandlers"; using namespace OpenShock::MessageHandlers::Local; -void _Private::HandleWiFiScanCommand(uint8_t socketId, const OpenShock::Serialization::Local::LocalToHubMessage* root) { +void _Private::HandleWiFiScanCommand(uint8_t socketId, const OpenShock::Serialization::Local::LocalToHubMessage* root) +{ (void)socketId; - + auto msg = root->payload_as_WifiScanCommand(); if (msg == nullptr) { OS_LOGE(TAG, "Payload cannot be parsed as WiFiScanCommand"); diff --git a/src/event_handlers/websocket/local/_InvalidMessage.cpp b/src/message_handlers/websocket/local/_InvalidMessage.cpp similarity index 78% rename from src/event_handlers/websocket/local/_InvalidMessage.cpp rename to src/message_handlers/websocket/local/_InvalidMessage.cpp index 59723167..8afe35fa 100644 --- a/src/event_handlers/websocket/local/_InvalidMessage.cpp +++ b/src/message_handlers/websocket/local/_InvalidMessage.cpp @@ -1,4 +1,4 @@ -#include "event_handlers/impl/WSLocal.h" +#include "message_handlers/impl/WSLocal.h" const char* const TAG = "LocalMessageHandlers"; @@ -6,9 +6,10 @@ const char* const TAG = "LocalMessageHandlers"; using namespace OpenShock::MessageHandlers::Local; -void _Private::HandleInvalidMessage(uint8_t socketId, const OpenShock::Serialization::Local::LocalToHubMessage* root) { +void _Private::HandleInvalidMessage(uint8_t socketId, const OpenShock::Serialization::Local::LocalToHubMessage* root) +{ (void)socketId; - + if (root == nullptr) { OS_LOGE(TAG, "Message cannot be parsed"); return;