nfc_maker.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #pragma once
  2. #include <furi.h>
  3. #include <gui/gui.h>
  4. #include <gui/view.h>
  5. #include <gui/modules/validators.h>
  6. #include <gui/view_dispatcher.h>
  7. #include <gui/scene_manager.h>
  8. #include <assets_icons.h>
  9. #include <gui/modules/submenu.h>
  10. #include <gui/modules/text_input.h>
  11. #include <gui/modules/byte_input.h>
  12. #include <gui/modules/popup.h>
  13. #include "scenes/nfc_maker_scene.h"
  14. #include <lib/flipper_format/flipper_format.h>
  15. #include <toolbox/name_generator.h>
  16. #include <applications/main/nfc/nfc_app_i.h>
  17. #include <furi_hal_bt.h>
  18. #define MAC_INPUT_LEN GAP_MAC_ADDR_SIZE
  19. #define MAIL_INPUT_LEN 128
  20. #define PHONE_INPUT_LEN 17
  21. #define BIG_INPUT_LEN 248
  22. #define SMALL_INPUT_LEN 90
  23. #define NTAG_DATA_AREA_UNIT_SIZE 2 * MF_ULTRALIGHT_PAGE_SIZE
  24. typedef enum {
  25. Ntag203,
  26. Ntag213,
  27. Ntag215,
  28. Ntag216,
  29. NtagI2C1K,
  30. NtagI2C2K,
  31. NtagMAX,
  32. } Ntag;
  33. extern const NfcDataGeneratorType ntag_generators[NtagMAX];
  34. extern const char* ntag_names[NtagMAX];
  35. extern const size_t ntag_sizes[NtagMAX];
  36. #define MAX_NDEF_LEN ntag_sizes[NtagI2C2K]
  37. typedef enum {
  38. WifiAuthenticationOpen = 0x01,
  39. WifiAuthenticationWpa2Personal = 0x20,
  40. WifiAuthenticationWpa2Enterprise = 0x10,
  41. WifiAuthenticationWpaPersonal = 0x02,
  42. WifiAuthenticationWpaEnterprise = 0x08,
  43. WifiAuthenticationShared = 0x04,
  44. } WifiAuthentication;
  45. typedef enum {
  46. WifiEncryptionAes = 0x08,
  47. WifiEncryptionWep = 0x02,
  48. WifiEncryptionTkip = 0x04,
  49. WifiEncryptionNone = 0x01,
  50. } WifiEncryption;
  51. typedef struct {
  52. Gui* gui;
  53. SceneManager* scene_manager;
  54. ViewDispatcher* view_dispatcher;
  55. Submenu* submenu;
  56. TextInput* text_input;
  57. ByteInput* byte_input;
  58. Popup* popup;
  59. NfcDevice* nfc_device;
  60. uint8_t* ndef_buffer;
  61. uint8_t mac_buf[MAC_INPUT_LEN];
  62. char mail_buf[MAIL_INPUT_LEN];
  63. char phone_buf[PHONE_INPUT_LEN];
  64. char big_buf[BIG_INPUT_LEN];
  65. char small_buf1[SMALL_INPUT_LEN];
  66. char small_buf2[SMALL_INPUT_LEN];
  67. char save_buf[BIG_INPUT_LEN];
  68. } NfcMaker;
  69. typedef enum {
  70. NfcMakerViewSubmenu,
  71. NfcMakerViewTextInput,
  72. NfcMakerViewByteInput,
  73. NfcMakerViewPopup,
  74. } NfcMakerView;