diff options
author | HampusM <hampus@hampusmat.com> | 2022-05-14 12:57:01 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-05-14 12:57:01 +0200 |
commit | 39e2964b0315faeac0c9f8431334ba10093b9490 (patch) | |
tree | 9cae9425845b32eac5c0b5c1e93601f09e718a21 /minion/src/wifi_module.hpp | |
parent | cd00813c0740930d389f935f0c2d7d8a11eef02d (diff) |
refactor(minion): create network connection class
Diffstat (limited to 'minion/src/wifi_module.hpp')
-rw-r--r-- | minion/src/wifi_module.hpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/minion/src/wifi_module.hpp b/minion/src/wifi_module.hpp index bac5998..6adaf05 100644 --- a/minion/src/wifi_module.hpp +++ b/minion/src/wifi_module.hpp @@ -1,6 +1,7 @@ #pragma once #include "http/request.hpp" +#include "network_connection.hpp" #include <SoftwareSerial.h> #include <stddef.h> @@ -91,15 +92,17 @@ public: /** * Reads a incoming HTTP request. * - * @returns A request. Has a connection ID of -1 if reading the request failed. + * @returns A request. Has a connection with a ID of -1 if reading the request failed. */ auto read_incoming_request() noexcept -> HTTPRequest; - auto close_connection(size_t connection_id) noexcept -> bool; + auto close_connection(NetworkConnection &connection) noexcept -> bool; - auto - send_response(size_t connection_id, size_t status_code, const char *data) noexcept - -> bool; + auto send_response( + const NetworkConnection &connection, + size_t status_code, + const char *data + ) noexcept -> bool; private: SoftwareSerial _serial; @@ -113,7 +116,7 @@ private: */ auto _send_serial(const char *command) noexcept -> bool; - size_t _read_connection_id() noexcept; + int8_t _read_connection_id() noexcept; size_t _read_request_data_length() noexcept; |