summaryrefslogtreecommitdiff
path: root/minion/src/wifi_module.hpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-05-16 13:49:54 +0200
committerHampusM <hampus@hampusmat.com>2022-05-16 13:50:31 +0200
commit0529ac97653bc535c5c1db832d258f661d69309c (patch)
tree48c0b6ded9d82e01d5e96f12c66e0a9b6d385618 /minion/src/wifi_module.hpp
parent3ede86caf948d6e989fd056ea4f8d8c588939971 (diff)
refactor(minion): improve network code readability
Diffstat (limited to 'minion/src/wifi_module.hpp')
-rw-r--r--minion/src/wifi_module.hpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/minion/src/wifi_module.hpp b/minion/src/wifi_module.hpp
index 6adaf05..51e90f0 100644
--- a/minion/src/wifi_module.hpp
+++ b/minion/src/wifi_module.hpp
@@ -14,6 +14,11 @@ constexpr auto REQUEST_METHOD_STR_MAX_LENGTH = 10U;
constexpr auto REQUEST_PATH_MAX_LENGTH = 64U;
constexpr auto REQUEST_HTTP_VERSION_MAX_LENGTH = 10U;
+constexpr auto WIFI_CONNECT_COMMAND_BASE_LENGTH = 7U;
+constexpr auto CREATE_TCP_SERVER_COMMAND_BASE_LENGTH = 8U;
+constexpr auto CLOSE_CONNECTION_COMMAND_BASE_LENGTH = 51U;
+constexpr auto SEND_RESPONSE_COMMAND_BASE_LENGTH = 51U;
+
constexpr auto ASCII_TO_CHAR = 48U;
constexpr auto TIMEOUT_SHORT = 1500U;
@@ -23,6 +28,8 @@ constexpr auto TIMEOUT_LONG = 10000U;
constexpr auto RESPONSE_HTTP_VERSION = "HTTP/1.1";
constexpr auto RESPONSE_STATUS_CODE_LENGTH = 3U;
+constexpr auto NUMBER_BASE = 10U;
+
enum WifiMode
{
Station = 1,
@@ -116,11 +123,11 @@ private:
*/
auto _send_serial(const char *command) noexcept -> bool;
- int8_t _read_connection_id() noexcept;
+ auto _read_connection_id() noexcept -> int8_t;
- size_t _read_request_data_length() noexcept;
+ auto _read_request_data_length() noexcept -> size_t;
- HTTPRequestMethod _read_request_method(size_t &request_data_length) noexcept;
+ auto _read_request_method(size_t &request_data_length) noexcept -> HTTPRequestMethod;
/**
* Reads from the wifi module until it responds with a status.