app.c 982 B

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