MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / createSsidListItem

Method createSsidListItem

Tactility/Source/app/wifimanage/View.cpp:108–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108void 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
126void View::updateConnectToHidden() {
127 if (connect_to_hidden == nullptr) {

Callers

nothing calls this directly

Calls 2

containsFunction · 0.85
mapRssiToPercentageFunction · 0.70

Tested by

no test coverage detected