MenuFunctions.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 18
  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. // WiFi menu stuff
  42. Menu wifiSnifferMenu;
  43. Menu wifiScannerMenu;
  44. Menu wifiAttackMenu;
  45. // Bluetooth menu stuff
  46. Menu bluetoothSnifferMenu;
  47. Menu bluetoothScannerMenu;
  48. TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
  49. void addNodes(Menu* menu, String name, uint16_t color, Menu* child, int place, std::function<void()> callable);
  50. void showMenuList(Menu* menu, int layer);
  51. public:
  52. MenuFunctions();
  53. uint16_t x = -1, y = -1;
  54. boolean pressed = false;
  55. void buildButtons(Menu* menu);
  56. void changeMenu(Menu* menu);
  57. void displayCurrentMenu();
  58. void main();
  59. void RunSetup();
  60. };
  61. #endif