forked from CoretechR/OMOTE
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
currently can scan for networks and show them but clicking does nothing.
- Loading branch information
MatthewColvin
committed
Oct 15, 2023
1 parent
38ec26d
commit 99787a6
Showing
9 changed files
with
96 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
Platformio/OmoteUI/UIs/BasicRefactored/page/WifiSettings.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include "WifiSettings.hpp" | ||
#include "Label.hpp" | ||
#include "List.hpp" | ||
#include "LvglResourceManager.hpp" | ||
//#include <Arduino.h> | ||
|
||
using namespace UI; | ||
using namespace UI::Page; | ||
|
||
WifiSettings::WifiSettings(std::shared_ptr<wifiHandlerInterface> aWifi) | ||
: Base(ID::Pages::WifiSettings), mWifi(aWifi), | ||
mScanCompleteHandler(mWifi->ScanCompleteNotification()), | ||
mScanningText(AddElement<Widget::Label>( | ||
std::make_unique<Widget::Label>("Scanning..."))), | ||
mWifiNetworks( | ||
AddElement<Widget::List>(std::make_unique<Widget::List>())) { | ||
|
||
mScanCompleteHandler = [this](auto aWifiInfos) { | ||
// Serial.println("populating UI"); | ||
mScanningText->SetText("Networks Found"); | ||
for (WifiInfo wifiInfo : aWifiInfos) { | ||
mWifiNetworks->AddItem(wifiInfo.ssid, LV_SYMBOL_WIFI, [] {}); | ||
} | ||
}; | ||
|
||
mWifi->scan(); | ||
|
||
// mWifi->onScanDone([this](auto aWifiInfos) { | ||
// | ||
// }); | ||
} | ||
|
||
void WifiSettings::SetHeight(lv_coord_t aHeight) { | ||
Base::SetHeight(aHeight); | ||
mScanningText->AlignTo(this, LV_ALIGN_TOP_MID); | ||
mScanningText->SetHeight(15); | ||
const auto padding = 10; | ||
mWifiNetworks->AlignTo(mScanningText, LV_ALIGN_OUT_BOTTOM_MID, 0, padding); | ||
mWifiNetworks->SetHeight(GetContentHeight() - mScanningText->GetBottom() - | ||
padding); | ||
}; |
27 changes: 27 additions & 0 deletions
27
Platformio/OmoteUI/UIs/BasicRefactored/page/WifiSettings.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#pragma once | ||
#include "PageBase.hpp" | ||
#include "wifiHandlerInterface.h" | ||
|
||
namespace UI::Widget { | ||
class List; | ||
class Label; | ||
} // namespace UI::Widget | ||
|
||
namespace UI::Page { | ||
class WifiSettings : public Base { | ||
public: | ||
WifiSettings(std::shared_ptr<wifiHandlerInterface> aWifi); | ||
|
||
std::string GetTitle() override { return "Wifi Settings"; }; | ||
|
||
void SetHeight(lv_coord_t aHeight) override; | ||
|
||
private: | ||
std::shared_ptr<wifiHandlerInterface> mWifi; | ||
Handler<wifiHandlerInterface::ScanDoneDataTy> mScanCompleteHandler; | ||
|
||
UI::Widget::Label *mScanningText; | ||
UI::Widget::List *mWifiNetworks; | ||
}; | ||
|
||
} // namespace UI::Page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
#include "Label.hpp" | ||
#include "BackgroundScreen.hpp" | ||
#include "Colors.hpp" | ||
#include "LvglResourceManager.hpp" | ||
|
||
using namespace UI::Widget; | ||
|
||
Label::Label(std::string aText) | ||
: Base(lv_label_create(UI::Screen::BackgroundScreen::getLvInstance()), ID::Widgets::Label) { | ||
: Base(lv_label_create(UI::Screen::BackgroundScreen::getLvInstance()), | ||
ID::Widgets::Label) { | ||
SetText(aText); | ||
} | ||
|
||
void Label::SetText(std::string aText) { | ||
auto lock = LvglResourceManager::GetInstance().scopeLock(); | ||
lv_label_set_text(LvglSelf(), aText.c_str()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters