Ken Van Hoeylandt faab6d825f
Merge develop into main (#339)
- Update ILI9341 driver to v2.0.1
- Lots of code cleanup for apps
- Refactor app "type" into "category" and added flags to the manifest (for show/hide statusbar and for hidden apps)
- Rename some ElfApp-related functionality and improved the way the static data was managed
- Rename "filebrowser" to "files"
- Added cstring functions to tt_init.cpp
- Minor fix in Boot app
- Updated external apps for SDK changes
2025-09-17 23:42:49 +02:00

55 lines
1.3 KiB
C++

#pragma once
#include <Tactility/app/App.h>
#include <Tactility/app/wificonnect/Bindings.h>
#include <Tactility/app/wificonnect/State.h>
#include <Tactility/app/wificonnect/View.h>
#include <Tactility/Mutex.h>
#include <Tactility/service/wifi/Wifi.h>
namespace tt::app::wificonnect {
class WifiConnect final : public App {
Mutex mutex;
State state;
Bindings bindings = {
.onConnectSsid = nullptr,
.onConnectSsidContext = nullptr
};
View view = View(&bindings, &state);
PubSub<service::wifi::WifiEvent>::SubscriptionHandle wifiSubscription;
bool view_enabled = false;
void onWifiEvent(service::wifi::WifiEvent event);
public:
WifiConnect();
~WifiConnect() override;
void lock();
void unlock();
void onShow(AppContext& app, lv_obj_t* parent) override;
void onHide(AppContext& app) override;
State& getState() { return state; }
Bindings& getBindings() { return bindings; }
View& getView() { return view; }
void requestViewUpdate();
};
/**
* Start the app with optional pre-filled fields.
*/
void start(const std::string& ssid = "", const std::string& password = "");
bool optSsidParameter(const std::shared_ptr<const Bundle>& bundle, std::string& ssid);
bool optPasswordParameter(const std::shared_ptr<const Bundle>& bundle, std::string& password);
} // namespace