flip_trader.h 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #ifndef FLIP_TRADE_E_H
  2. #define FLIP_TRADE_E_H
  3. #include <flipper_http/flipper_http.h>
  4. #include <easy_flipper/easy_flipper.h>
  5. #include <furi.h>
  6. #include <furi_hal.h>
  7. #include <gui/gui.h>
  8. #include <gui/view.h>
  9. #include <gui/modules/submenu.h>
  10. #include <gui/view_dispatcher.h>
  11. #include <notification/notification.h>
  12. #include <dialogs/dialogs.h>
  13. #include <jsmn/jsmn.h>
  14. #define TAG "FlipTrader"
  15. // Define the submenu items for our FlipTrader application
  16. typedef enum
  17. {
  18. // FlipTraderSubmenuIndexMain, // Click to run get the info of the selected pair
  19. FlipTradeSubmenuIndexAssets, // Click to view the assets screen (ETHUSD, BTCUSD, etc.)
  20. FlipTraderSubmenuIndexAbout, // Click to view the about screen
  21. FlipTraderSubmenuIndexSettings, // Click to view the WiFi settings screen
  22. //
  23. FlipTraderSubmenuIndexAssetStartIndex, // Start of the submenu items for the assets
  24. } FlipTraderSubmenuIndex;
  25. // Define a single view for our FlipTrader application
  26. typedef enum
  27. {
  28. FlipTraderViewMain, // The screen that displays the info of the selected pair
  29. FlipTraderViewMainSubmenu, // The main submenu of the FlipTrader app
  30. FlipTraderViewAbout, // The about screen
  31. FlipTraderViewWiFiSettings, // The WiFi settings screen
  32. FlipTraderViewTextInputSSID, // The text input screen for the SSID
  33. FlipTraderViewTextInputPassword, // The text input screen for the password
  34. //
  35. FlipTraderViewAssetsSubmenu, // The submenu for the assets
  36. FlipTraderViewWidgetResult, // The text box that displays the random fact
  37. FlipTraderViewLoader, // The loader screen retrieves data from the internet
  38. } FlipTraderView;
  39. // Each screen will have its own view
  40. typedef struct
  41. {
  42. ViewDispatcher *view_dispatcher; // Switches between our views
  43. View *view_loader; // The screen that loads data from internet
  44. Submenu *submenu_main; // The submenu
  45. Submenu *submenu_assets; // The submenu for the assets
  46. Widget *widget_about; // The widget
  47. Widget *widget_result; // The widget that displays the result
  48. VariableItemList *variable_item_list_wifi; // The variable item list (settngs)
  49. VariableItem *variable_item_ssid; // The variable item for the SSID
  50. VariableItem *variable_item_password; // The variable item for the password
  51. TextInput *uart_text_input_ssid; // The text input for the SSID
  52. TextInput *uart_text_input_password; // The text input for the password
  53. char *uart_text_input_buffer_ssid; // Buffer for the text input (SSID)
  54. char *uart_text_input_temp_buffer_ssid; // Temporary buffer for the text input (SSID)
  55. uint32_t uart_text_input_buffer_size_ssid; // Size of the text input buffer (SSID)
  56. char *uart_text_input_buffer_password; // Buffer for the text input (password)
  57. char *uart_text_input_temp_buffer_password; // Temporary buffer for the text input (password)
  58. uint32_t uart_text_input_buffer_size_password; // Size of the text input buffer (password)
  59. } FlipTraderApp;
  60. #define ASSET_COUNT 42
  61. extern char **asset_names;
  62. // index
  63. extern uint32_t asset_index;
  64. // Function to free the resources used by FlipTraderApp
  65. void flip_trader_app_free(FlipTraderApp *app);
  66. char **asset_names_alloc();
  67. void asset_names_free(char **names);
  68. extern FlipTraderApp *app_instance;
  69. #endif // FLIP_TRADE_E_H