summaryrefslogtreecommitdiff
path: root/minion/src/wifi_module.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'minion/src/wifi_module.cpp')
-rw-r--r--minion/src/wifi_module.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/minion/src/wifi_module.cpp b/minion/src/wifi_module.cpp
index 8895722..d56e51e 100644
--- a/minion/src/wifi_module.cpp
+++ b/minion/src/wifi_module.cpp
@@ -29,8 +29,8 @@ void WiFiModule::reset() noexcept
const auto response_status = _read(2000U, response);
Serial.println(
- response_status == ResponseStatus::OK ? "Reset wifi module"
- : "Failed to reset wifi module"
+ response_status == WiFiModuleResponseStatus::OK ? "Reset wifi module"
+ : "Failed to reset wifi module"
);
}
@@ -64,7 +64,7 @@ auto WiFiModule::connect_to_wifi(const char *ssid, const char *password) noexcep
const auto response_status = _read(20000U, response);
- return response_status == ResponseStatus::OK;
+ return response_status == WiFiModuleResponseStatus::OK;
}
void WiFiModule::set_wifi_mode(WifiMode wifi_mode) noexcept
@@ -125,7 +125,9 @@ void WiFiModule::set_echo_enabled(bool is_enabled) noexcept
const auto response_status = _read(1500U, response);
- Serial.print(response_status == ResponseStatus::OK ? "Turned " : "Failed to turn ");
+ Serial.print(
+ response_status == WiFiModuleResponseStatus::OK ? "Turned " : "Failed to turn "
+ );
Serial.print(is_enabled ? "on" : "off");
Serial.println(" AT commands echo");
}
@@ -164,7 +166,7 @@ auto WiFiModule::test() noexcept -> bool
const auto response_status = _read(5000U, response);
- if (response_status == ResponseStatus::TIMEOUT)
+ if (response_status == WiFiModuleResponseStatus::TIMEOUT)
{
return false;
}
@@ -195,7 +197,7 @@ auto WiFiModule::get_local_ip(char *local_ip_out) noexcept -> const char *
const auto response_status = _read(10000U, buf);
- if (response_status != ResponseStatus::OK)
+ if (response_status != WiFiModuleResponseStatus::OK)
{
free(buf);
@@ -312,7 +314,7 @@ auto WiFiModule::close_connection(size_t connection_id) noexcept -> bool
const auto response_status = _read(4000U, response);
- if (response_status == ResponseStatus::OK)
+ if (response_status == WiFiModuleResponseStatus::OK)
{
Serial.print("Closed connection to ");
Serial.println(connection_id);
@@ -422,12 +424,13 @@ HTTPRequestMethod WiFiModule::_read_request_method(size_t &request_data_length)
return request_method;
}
-auto WiFiModule::_read(uint64_t timeout, char *response_out) noexcept -> ResponseStatus
+auto WiFiModule::_read(uint64_t timeout, char *response_out) noexcept
+ -> WiFiModuleResponseStatus
{
const auto start_time = millis();
bool has_end = false;
- auto status = ResponseStatus::TIMEOUT;
+ auto status = WiFiModuleResponseStatus::TIMEOUT;
while (!has_end && (start_time + timeout) > millis())
{
@@ -439,19 +442,19 @@ auto WiFiModule::_read(uint64_t timeout, char *response_out) noexcept -> Respons
if (util::str_ends_with(response_out, "OK"))
{
- status = ResponseStatus::OK;
+ status = WiFiModuleResponseStatus::OK;
has_end = true;
}
if (util::str_ends_with(response_out, "ERROR"))
{
- status = ResponseStatus::ERROR;
+ status = WiFiModuleResponseStatus::ERROR;
has_end = true;
}
if (util::str_ends_with(response_out, "FAIL"))
{
- status = ResponseStatus::FAIL;
+ status = WiFiModuleResponseStatus::FAIL;
has_end = true;
}
}