| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- #ifndef WEB_CRAWLER_CALLBACK_H
- #define WEB_CRAWLER_CALLBACK_H
- #include "web_crawler.h"
- #include <flip_storage/web_crawler_storage.h>
- extern bool sent_http_request;
- extern bool get_success;
- extern bool already_success;
- void web_crawler_http_method_change(VariableItem *item);
- /**
- * @brief Navigation callback to handle exiting from other views to the submenu.
- * @param context The context - WebCrawlerApp object.
- * @return WebCrawlerViewSubmenu
- */
- uint32_t web_crawler_back_to_configure_callback(void *context);
- /**
- * @brief Navigation callback to handle returning to the Wifi Settings screen.
- * @param context The context - WebCrawlerApp object.
- * @return WebCrawlerViewSubmenu
- */
- uint32_t web_crawler_back_to_main_callback(void *context);
- uint32_t web_crawler_back_to_file_callback(void *context);
- uint32_t web_crawler_back_to_wifi_callback(void *context);
- uint32_t web_crawler_back_to_request_callback(void *context);
- /**
- * @brief Navigation callback to handle exiting the app from the main submenu.
- * @param context The context - unused
- * @return VIEW_NONE to exit the app
- */
- uint32_t web_crawler_exit_app_callback(void *context);
- /**
- * @brief Handle submenu item selection.
- * @param context The context - WebCrawlerApp object.
- * @param index The WebCrawlerSubmenuIndex item that was clicked.
- */
- void web_crawler_submenu_callback(void *context, uint32_t index);
- /**
- * @brief Configuration enter callback to handle different items.
- * @param context The context - WebCrawlerApp object.
- * @param index The index of the item that was clicked.
- */
- void web_crawler_wifi_enter_callback(void *context, uint32_t index);
- /**
- * @brief Configuration enter callback to handle different items.
- * @param context The context - WebCrawlerApp object.
- * @param index The index of the item that was clicked.
- */
- void web_crawler_file_enter_callback(void *context, uint32_t index);
- /**
- * @brief Configuration enter callback to handle different items.
- * @param context The context - WebCrawlerApp object.
- * @param index The index of the item that was clicked.
- */
- void web_crawler_request_enter_callback(void *context, uint32_t index);
- /**
- * @brief Callback for when the user finishes entering the URL.
- * @param context The context - WebCrawlerApp object.
- */
- void web_crawler_set_path_updated(void *context);
- /**
- * @brief Callback for when the user finishes entering the headers
- * @param context The context - WebCrawlerApp object.
- */
- void web_crawler_set_headers_updated(void *context);
- /**
- * @brief Callback for when the user finishes entering the payload.
- * @param context The context - WebCrawlerApp object.
- */
- void web_crawler_set_payload_updated(void *context);
- /**
- * @brief Callback for when the user finishes entering the SSID.
- * @param context The context - WebCrawlerApp object.
- */
- void web_crawler_set_ssid_updated(void *context);
- /**
- * @brief Callback for when the user finishes entering the Password.
- * @param context The context - WebCrawlerApp object.
- */
- void web_crawler_set_password_update(void *context);
- /**
- * @brief Callback for when the user finishes entering the File Type.
- * @param context The context - WebCrawlerApp object.
- */
- void web_crawler_set_file_type_update(void *context);
- /**
- * @brief Callback for when the user finishes entering the File Rename.
- * @param context The context - WebCrawlerApp object.
- */
- void web_crawler_set_file_rename_update(void *context);
- /**
- * @brief Handler for Path configuration item click.
- * @param context The context - WebCrawlerApp object.
- * @param index The index of the item that was clicked.
- */
- void web_crawler_setting_item_path_clicked(void *context, uint32_t index);
- /**
- * @brief Handler for headers configuration item click.
- * @param context The context - WebCrawlerApp object.
- * @param index The index of the item that was clicked.
- */
- void web_crawler_setting_item_headers_clicked(void *context, uint32_t index);
- /**
- * @brief Handler for payload configuration item click.
- * @param context The context - WebCrawlerApp object.
- * @param index The index of the item that was clicked.
- */
- void web_crawler_setting_item_payload_clicked(void *context, uint32_t index);
- /**
- * @brief Handler for SSID configuration item click.
- * @param context The context - WebCrawlerApp object.
- * @param index The index of the item that was clicked.
- */
- void web_crawler_setting_item_ssid_clicked(void *context, uint32_t index);
- /**
- * @brief Handler for Password configuration item click.
- * @param context The context - WebCrawlerApp object.
- * @param index The index of the item that was clicked.
- */
- void web_crawler_setting_item_password_clicked(void *context, uint32_t index);
- /**
- * @brief Handler for File Type configuration item click.
- * @param context The context - WebCrawlerApp object.
- * @param index The index of the item that was clicked.
- */
- void web_crawler_setting_item_file_type_clicked(void *context, uint32_t index);
- /**
- * @brief Handler for File Rename configuration item click.
- * @param context The context - WebCrawlerApp object.
- * @param index The index of the item that was clicked.
- */
- void web_crawler_setting_item_file_rename_clicked(void *context, uint32_t index);
- /**
- * @brief Handler for File Delete configuration item click.
- * @param context The context - WebCrawlerApp object.
- * @param index The index of the item that was clicked.
- */
- void web_crawler_setting_item_file_delete_clicked(void *context, uint32_t index);
- void web_crawler_setting_item_file_read_clicked(void *context, uint32_t index);
- // Add edits by Derek Jamison
- typedef enum DataState DataState;
- enum DataState
- {
- DataStateInitial,
- DataStateRequested,
- DataStateReceived,
- DataStateParsed,
- DataStateParseError,
- DataStateError,
- };
- typedef enum WebCrawlerCustomEvent WebCrawlerCustomEvent;
- enum WebCrawlerCustomEvent
- {
- WebCrawlerCustomEventProcess,
- };
- typedef struct DataLoaderModel DataLoaderModel;
- typedef bool (*DataLoaderFetch)(DataLoaderModel *model);
- typedef char *(*DataLoaderParser)(DataLoaderModel *model);
- struct DataLoaderModel
- {
- char *title;
- char *data_text;
- DataState data_state;
- DataLoaderFetch fetcher;
- DataLoaderParser parser;
- void *parser_context;
- size_t request_index;
- size_t request_count;
- ViewNavigationCallback back_callback;
- FuriTimer *timer;
- };
- void web_crawler_generic_switch_to_view(WebCrawlerApp *app, char *title, DataLoaderFetch fetcher, DataLoaderParser parser, size_t request_count, ViewNavigationCallback back, uint32_t view_id);
- void web_crawler_loader_draw_callback(Canvas *canvas, void *model);
- void web_crawler_loader_init(View *view);
- void web_crawler_loader_free_model(View *view);
- bool web_crawler_custom_event_callback(void *context, uint32_t index);
- #endif
|