- WiFi Connect app is now hidden by default, but accessible at the bottom of the WiFi Manage app when WiFi is turned on. - WiFi service now turns on WiFi when calling connect() and WiFi is not on. - Removed `blocking` option for `service::loader::startApp()`. This feature was unused and complex. - Various apps: Moved private headers into Private/ folder. - Various apps: created start() function for easy starting. - Added documentation to all TactilityC APIs - Refactored various `enum` into `class enum` - Refactor M5Stack `initBoot()` (but VBus is still 0V for some reason)
49 lines
1.4 KiB
C++
49 lines
1.4 KiB
C++
#include "app/wificonnect/State.h"
|
|
#include "Check.h"
|
|
#include <cstring>
|
|
|
|
namespace tt::app::wificonnect {
|
|
|
|
void State::setConnectionError(bool error) {
|
|
tt_check(lock.acquire(TtWaitForever) == TtStatusOk);
|
|
connectionError = error;
|
|
tt_check(lock.release() == TtStatusOk);
|
|
}
|
|
|
|
bool State::hasConnectionError() const {
|
|
tt_check(lock.acquire(TtWaitForever) == TtStatusOk);
|
|
auto result = connectionError;
|
|
tt_check(lock.release() == TtStatusOk);
|
|
return result;
|
|
}
|
|
|
|
void State::setApSettings(const service::wifi::settings::WifiApSettings* newSettings) {
|
|
tt_check(lock.acquire(TtWaitForever) == TtStatusOk);
|
|
memcpy(&this->apSettings, newSettings, sizeof(service::wifi::settings::WifiApSettings));
|
|
tt_check(lock.release() == TtStatusOk);
|
|
}
|
|
|
|
const service::wifi::settings::WifiApSettings& State::lockApSettings() {
|
|
tt_check(lock.acquire(TtWaitForever) == TtStatusOk);
|
|
return apSettings;
|
|
}
|
|
|
|
void State::unlockApSettings() {
|
|
tt_check(lock.release() == TtStatusOk);
|
|
}
|
|
|
|
void State::setConnecting(bool isConnecting) {
|
|
tt_check(lock.acquire(TtWaitForever) == TtStatusOk);
|
|
connecting = isConnecting;
|
|
tt_check(lock.release() == TtStatusOk);
|
|
}
|
|
|
|
bool State::isConnecting() const {
|
|
tt_check(lock.acquire(TtWaitForever) == TtStatusOk);
|
|
auto result = connecting;
|
|
tt_check(lock.release() == TtStatusOk);
|
|
return result;
|
|
}
|
|
|
|
} // namespace
|