Added WiFi kernel drivers and refactored Wifi service (#557)
+ other improvements
This commit is contained in:
committed by
GitHub
parent
dbb96a891c
commit
1c2806bddf
@@ -76,7 +76,7 @@ void View::connect(lv_event_t* event) {
|
||||
|
||||
if (index < ap_records.size()) {
|
||||
LOG_I(TAG, "Clicked %zu/%zu", index, ap_records.size() - 1);
|
||||
auto& ssid = ap_records[index].ssid;
|
||||
std::string ssid = ap_records[index].ssid;
|
||||
LOG_I(TAG, "Clicked AP: %s", ssid.c_str());
|
||||
std::string connection_target = service::wifi::getConnectionTarget();
|
||||
if (connection_target == ssid) {
|
||||
@@ -97,7 +97,7 @@ void View::showDetails(lv_event_t* event) {
|
||||
auto ap_records = self->state->getApRecords();
|
||||
|
||||
if (index < ap_records.size()) {
|
||||
auto& ssid = ap_records[index].ssid;
|
||||
std::string ssid = ap_records[index].ssid;
|
||||
LOG_I(TAG, "Clicked AP: %s", ssid.c_str());
|
||||
self->bindings->onShowApSettings(ssid);
|
||||
} else {
|
||||
@@ -105,14 +105,14 @@ void View::showDetails(lv_event_t* event) {
|
||||
}
|
||||
}
|
||||
|
||||
void View::createSsidListItem(const service::wifi::ApRecord& record, bool isConnecting, size_t index) {
|
||||
void View::createSsidListItem(const WifiApRecord& record, bool isConnecting, size_t index) {
|
||||
if (isConnecting) {
|
||||
auto* button = lv_list_add_button(networks_list, LV_SYMBOL_WIFI, record.ssid.c_str());
|
||||
auto* button = lv_list_add_button(networks_list, LV_SYMBOL_WIFI, record.ssid);
|
||||
lv_obj_add_event_cb(button, showDetails, LV_EVENT_SHORT_CLICKED, this);
|
||||
} else {
|
||||
const std::string auth_info = (record.auth_mode == WIFI_AUTH_OPEN) ? "(open) " : " ";
|
||||
const std::string auth_info = (record.authentication_type == WIFI_AUTHENTICATION_TYPE_OPEN) ? "(open) " : " ";
|
||||
const auto percentage = mapRssiToPercentage(record.rssi);
|
||||
const auto label = std::format("{} {}{}%", record.ssid, auth_info, percentage);
|
||||
const auto label = std::format("{} {}{}%", std::string(record.ssid), auth_info, percentage);
|
||||
auto* button = lv_list_add_button(networks_list, nullptr, label.c_str());
|
||||
lv_obj_set_user_data(button, reinterpret_cast<void*>(index));
|
||||
if (service::wifi::settings::contains(record.ssid)) {
|
||||
|
||||
Reference in New Issue
Block a user