Ken Van Hoeylandt 6c67845645
Cleanup and improvements (#194)
- Lots of changes for migrating C code to C++
- Improved `Lockable` in several ways like adding `withLock()` (+ tests)
- Improved `Semaphore` a bit for improved readability, and also added some tests
- Upgrade Linux machine in GitHub Actions so that we can compile with a newer GCC
- Simplification of WiFi connection
- Updated funding options
- (and more)
2025-01-28 17:39:58 +01:00

39 lines
811 B
C++

#include "app/wificonnect/State.h"
#include <cstring>
namespace tt::app::wificonnect {
void State::setConnectionError(bool error) {
lock.lock();
connectionError = error;
lock.unlock();
}
bool State::hasConnectionError() const {
lock.lock();
auto result = connectionError;
lock.unlock();
return result;
}
void State::setApSettings(const service::wifi::settings::WifiApSettings* newSettings) {
lock.lock();
memcpy(&this->apSettings, newSettings, sizeof(service::wifi::settings::WifiApSettings));
lock.unlock();
}
void State::setConnecting(bool isConnecting) {
lock.lock();
connecting = isConnecting;
lock.unlock();
}
bool State::isConnecting() const {
lock.lock();
auto result = connecting;
lock.unlock();
return result;
}
} // namespace