| 106 | } |
| 107 | |
| 108 | void View::createSsidListItem(const service::wifi::ApRecord& record, bool isConnecting, size_t index) { |
| 109 | if (isConnecting) { |
| 110 | auto* button = lv_list_add_button(networks_list, LV_SYMBOL_WIFI, record.ssid.c_str()); |
| 111 | lv_obj_add_event_cb(button, showDetails, LV_EVENT_SHORT_CLICKED, this); |
| 112 | } else { |
| 113 | const std::string auth_info = (record.auth_mode == WIFI_AUTH_OPEN) ? "(open) " : " "; |
| 114 | const auto percentage = mapRssiToPercentage(record.rssi); |
| 115 | const auto label = std::format("{} {}{}%", record.ssid, auth_info, percentage); |
| 116 | auto* button = lv_list_add_button(networks_list, nullptr, label.c_str()); |
| 117 | lv_obj_set_user_data(button, reinterpret_cast<void*>(index)); |
| 118 | if (service::wifi::settings::contains(record.ssid)) { |
| 119 | lv_obj_add_event_cb(button, showDetails, LV_EVENT_SHORT_CLICKED, this); |
| 120 | } else { |
| 121 | lv_obj_add_event_cb(button, connect, LV_EVENT_SHORT_CLICKED, this); |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | void View::updateConnectToHidden() { |
| 127 | if (connect_to_hidden == nullptr) { |
nothing calls this directly
no test coverage detected