diff options
author | HampusM <hampus@hampusmat.com> | 2022-05-13 22:33:12 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-05-13 22:33:12 +0200 |
commit | cd00813c0740930d389f935f0c2d7d8a11eef02d (patch) | |
tree | ad1d20704e6707b5fcb734876c4a0cbed860c297 /minion/src/gymnasiearbete.cpp | |
parent | fc1a41c627f25c1fa52c87d002d08870fa8876ac (diff) |
refactor(minion): wifi module create http request object in stack
Diffstat (limited to 'minion/src/gymnasiearbete.cpp')
-rw-r--r-- | minion/src/gymnasiearbete.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/minion/src/gymnasiearbete.cpp b/minion/src/gymnasiearbete.cpp index 47e386e..092250a 100644 --- a/minion/src/gymnasiearbete.cpp +++ b/minion/src/gymnasiearbete.cpp @@ -74,35 +74,33 @@ void setup() void loop() { - const auto *request = wifi_module.read_incoming_request(); + const auto request = wifi_module.read_incoming_request(); - if (request == nullptr) + if (request.connection_id() == -1) { return; } - const auto connection_id = request->connection_id(); + const auto connection_id = request.connection_id(); Serial.print("Connection ID: "); Serial.println(static_cast<unsigned int>(connection_id)); Serial.print("Request method: "); - Serial.println(http_request_method_strs[static_cast<size_t>(request->method())]); + Serial.println(http_request_method_strs[static_cast<size_t>(request.method())]); Serial.print("Request HTTP version: "); - Serial.println(request->http_version()); + Serial.println(request.http_version()); Serial.print("Request path: "); - Serial.println(request->path()); + Serial.println(request.path()); Serial.print("\nData: "); - Serial.println(request->data()); + Serial.println(request.data()); wifi_module.send_response(connection_id, 200U, "hello there!"); wifi_module.close_connection(connection_id); - delete request; - delay(SECOND_IN_MILLIS); } |