MenuFunctions.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef MenuFunctions_h
  2. #define MenuFunctions_h
  3. #include "WiFiScan.h"
  4. #include "Display.h"
  5. extern Display display_obj;
  6. extern WiFiScan wifi_scan_obj;
  7. // Keypad start position, key sizes and spacing
  8. #define KEY_X 120 // Centre of key
  9. #define KEY_Y 50
  10. #define KEY_W 240 // Width and height
  11. #define KEY_H 22
  12. #define KEY_SPACING_X 0 // X and Y gap
  13. #define KEY_SPACING_Y 1
  14. #define KEY_TEXTSIZE 1 // Font size multiplier
  15. #define BUTTON_ARRAY_LEN 5
  16. #define FLASH_BUTTON 0
  17. struct Menu;
  18. // Individual Nodes of a menu
  19. struct MenuNode {
  20. String name;
  21. uint16_t color;
  22. Menu *childMenu;
  23. TFT_eSPI_Button* button;
  24. std::function<void()> callable; // Make a function that changes menu to a child menu
  25. };
  26. // Full Menus
  27. struct Menu {
  28. String name;
  29. SimpleList<MenuNode>* list;
  30. Menu * parentMenu;
  31. uint8_t selected;
  32. };
  33. class MenuFunctions
  34. {
  35. private:
  36. Menu* current_menu;
  37. // Main menu stuff
  38. Menu mainMenu;
  39. Menu wifiMenu;
  40. Menu bluetoothMenu;
  41. Menu generalMenu;
  42. // WiFi menu stuff
  43. Menu wifiSnifferMenu;
  44. Menu wifiScannerMenu;
  45. Menu wifiAttackMenu;
  46. // Bluetooth menu stuff
  47. Menu bluetoothSnifferMenu;
  48. Menu bluetoothScannerMenu;
  49. TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
  50. void addNodes(Menu* menu, String name, uint16_t color, Menu* child, int place, std::function<void()> callable);
  51. void showMenuList(Menu* menu, int layer);
  52. public:
  53. MenuFunctions();
  54. uint16_t x = -1, y = -1;
  55. boolean pressed = false;
  56. void buildButtons(Menu* menu);
  57. void changeMenu(Menu* menu);
  58. void displayCurrentMenu();
  59. void main();
  60. void RunSetup();
  61. };
  62. #endif