| 68 | // region Secondary updates |
| 69 | |
| 70 | void View::connect(lv_event_t* event) { |
| 71 | LOGGER.debug("connect()"); |
| 72 | auto* widget = lv_event_get_current_target_obj(event); |
| 73 | auto index = reinterpret_cast<size_t>(lv_obj_get_user_data(widget)); |
| 74 | auto* self = static_cast<View*>(lv_event_get_user_data(event)); |
| 75 | auto ap_records = self->state->getApRecords(); |
| 76 | |
| 77 | if (index < ap_records.size()) { |
| 78 | LOGGER.info("Clicked {}/{}", index, ap_records.size() - 1); |
| 79 | auto& ssid = ap_records[index].ssid; |
| 80 | LOGGER.info("Clicked AP: {}", ssid); |
| 81 | std::string connection_target = service::wifi::getConnectionTarget(); |
| 82 | if (connection_target == ssid) { |
| 83 | self->bindings->onDisconnect(); |
| 84 | } else { |
| 85 | self->bindings->onConnectSsid(ssid); |
| 86 | } |
| 87 | } else { |
| 88 | LOGGER.warn("Clicked AP: record {}/{} does not exist", index, ap_records.size() - 1); |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | void View::showDetails(lv_event_t* event) { |
| 93 | LOGGER.debug("showDetails()"); |
no test coverage detected