app.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // app.c
  2. #include <jsmn.h> // Include cJSON
  3. #include <uart_text_input.h> // Include the text input widget
  4. #include <flip_social_e.h> // Include the FlipSocialApp structure
  5. #include <flip_social_storage.h> // Include the storage functions
  6. #include <flip_social_callback.h> // Include the callback functions
  7. #include <flip_social_i.h> // Include the initialization functions
  8. #include <flip_social_free.h> // Include the cleanup functions
  9. /**
  10. * @brief Entry point for the Hello World application.
  11. * @details Initializes the app, runs the view dispatcher, and cleans up upon exit.
  12. * @param p Input parameter - unused
  13. * @return 0 to indicate success, -1 on failure
  14. */
  15. int32_t main_flip_social(void *p)
  16. {
  17. UNUSED(p);
  18. // Initialize the Hello World application
  19. FlipSocialApp *app = flip_social_app_alloc();
  20. if (!app)
  21. {
  22. // Allocation failed
  23. return -1; // Indicate failure
  24. }
  25. // send settings and connect wifi
  26. if (!flipper_http_connect_wifi())
  27. {
  28. FURI_LOG_E(TAG, "Failed to connect to WiFi");
  29. return -1;
  30. }
  31. if (!flipper_http_ping())
  32. {
  33. FURI_LOG_E(TAG, "Failed to ping the device");
  34. return -1;
  35. }
  36. // Run the view dispatcher
  37. view_dispatcher_run(app->view_dispatcher);
  38. // Free the resources used by the Hello World application
  39. flip_social_app_free(app);
  40. // Return 0 to indicate success
  41. return 0;
  42. }