MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / loop

Method loop

src/activities/network/WifiSelectionActivity.cpp:300–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298}
299
300void WifiSelectionActivity::loop() {
301 // Check scan progress
302 if (state == WifiSelectionState::SCANNING) {
303 processWifiScanResults();
304 return;
305 }
306
307 // Check connection progress
308 if (state == WifiSelectionState::CONNECTING || state == WifiSelectionState::AUTO_CONNECTING) {
309 checkConnectionStatus();
310 return;
311 }
312
313 if (state == WifiSelectionState::PASSWORD_ENTRY) {
314 // Reach here once password entry finished in subactivity
315 attemptConnection();
316 return;
317 }
318
319 // Handle save prompt state
320 if (state == WifiSelectionState::SAVE_PROMPT) {
321 if (mappedInput.wasPressed(MappedInputManager::Button::Up) ||
322 mappedInput.wasPressed(MappedInputManager::Button::Left)) {
323 if (savePromptSelection > 0) {
324 savePromptSelection--;
325 requestUpdate();
326 }
327 } else if (mappedInput.wasPressed(MappedInputManager::Button::Down) ||
328 mappedInput.wasPressed(MappedInputManager::Button::Right)) {
329 if (savePromptSelection < 1) {
330 savePromptSelection++;
331 requestUpdate();
332 }
333 } else if (mappedInput.wasPressed(MappedInputManager::Button::Confirm)) {
334 if (savePromptSelection == 0) {
335 // User chose "Yes" - save the password
336 RenderLock lock(*this);
337 WIFI_STORE.addCredential(selectedSSID, enteredPassword);
338 }
339 // Complete - parent will start web server
340 onComplete(true);
341 } else if (mappedInput.wasPressed(MappedInputManager::Button::Back)) {
342 // Skip saving, complete anyway
343 onComplete(true);
344 }
345 return;
346 }
347
348 // Handle forget prompt state (connection failed with saved credentials)
349 if (state == WifiSelectionState::FORGET_PROMPT) {
350 if (mappedInput.wasPressed(MappedInputManager::Button::Up) ||
351 mappedInput.wasPressed(MappedInputManager::Button::Left)) {
352 if (forgetPromptSelection > 0) {
353 forgetPromptSelection--;
354 requestUpdate();
355 }
356 } else if (mappedInput.wasPressed(MappedInputManager::Button::Down) ||
357 mappedInput.wasPressed(MappedInputManager::Button::Right)) {

Callers

nothing calls this directly

Calls 9

addCredentialMethod · 0.80
removeCredentialMethod · 0.80
endMethod · 0.80
onNextMethod · 0.80
onPreviousMethod · 0.80
wasPressedMethod · 0.45
beginMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected