app.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include <uart_text_input.h>
  2. #include <web_crawler_e.h>
  3. #include <flipper_http.h>
  4. #include <web_crawler_storage.h>
  5. #include <web_crawler_free.h>
  6. #include <web_crawler_callback.h>
  7. #include <web_crawler_i.h>
  8. /**
  9. * @brief Entry point for the WebCrawler application.
  10. * @param p Input parameter - unused
  11. * @return 0 to indicate success, -1 on failure
  12. */
  13. int32_t web_crawler_app(void *p)
  14. {
  15. UNUSED(p);
  16. WebCrawlerApp *app = web_crawler_app_alloc();
  17. if (!app)
  18. {
  19. FURI_LOG_E(TAG, "Failed to allocate WebCrawlerApp");
  20. return -1;
  21. }
  22. // send settings and connect wifi
  23. if (!flipper_http_connect_wifi())
  24. {
  25. FURI_LOG_E(TAG, "Failed to connect to WiFi");
  26. return -1;
  27. }
  28. if (!flipper_http_ping())
  29. {
  30. FURI_LOG_E(TAG, "Failed to ping the device");
  31. return -1;
  32. }
  33. // Run the application
  34. view_dispatcher_run(app->view_dispatcher);
  35. // Free resources after the application loop ends
  36. web_crawler_app_free(app);
  37. return 0;
  38. }