nfc_maker.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 "nfc_maker_icons.h"
  9. #include <gui/modules/submenu.h>
  10. #include "nfc_maker_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 <furi_hal_bt.h>
  17. #include "newstrnlen.h"
  18. #include <nfc/nfc_device.h>
  19. #include <nfc/helpers/nfc_data_generator.h>
  20. #include <nfc/protocols/mf_ultralight/mf_ultralight.h>
  21. #include <nfc/nfc.h>
  22. #define NFC_MK_APP_FOLDER EXT_PATH("nfc")
  23. #define NFC_MK_APP_EXTENSION ".nfc"
  24. #define MAC_INPUT_LEN GAP_MAC_ADDR_SIZE
  25. #define MAIL_INPUT_LEN 128
  26. #define PHONE_INPUT_LEN 17
  27. #define BIG_INPUT_LEN 248
  28. #define SMALL_INPUT_LEN 90
  29. #define NTAG_DATA_AREA_UNIT_SIZE 2 * MF_ULTRALIGHT_PAGE_SIZE
  30. typedef enum {
  31. Ntag203,
  32. Ntag213,
  33. Ntag215,
  34. Ntag216,
  35. NtagI2C1K,
  36. NtagI2C2K,
  37. NtagMAX,
  38. } Ntag;
  39. extern const NfcDataGeneratorType ntag_generators[NtagMAX];
  40. extern const char* ntag_names[NtagMAX];
  41. extern const size_t ntag_sizes[NtagMAX];
  42. #define MAX_NDEF_LEN ntag_sizes[NtagI2C2K]
  43. typedef enum {
  44. WifiAuthenticationOpen = 0x01,
  45. WifiAuthenticationWpa2Personal = 0x20,
  46. WifiAuthenticationWpa2Enterprise = 0x10,
  47. WifiAuthenticationWpaPersonal = 0x02,
  48. WifiAuthenticationWpaEnterprise = 0x08,
  49. WifiAuthenticationShared = 0x04,
  50. } WifiAuthentication;
  51. typedef enum {
  52. WifiEncryptionAes = 0x08,
  53. WifiEncryptionWep = 0x02,
  54. WifiEncryptionTkip = 0x04,
  55. WifiEncryptionNone = 0x01,
  56. } WifiEncryption;
  57. typedef struct {
  58. Gui* gui;
  59. SceneManager* scene_manager;
  60. ViewDispatcher* view_dispatcher;
  61. Submenu* submenu;
  62. NFCMaker_TextInput* text_input;
  63. ByteInput* byte_input;
  64. Popup* popup;
  65. NfcDevice* nfc_device;
  66. uint8_t* ndef_buffer;
  67. uint8_t mac_buf[MAC_INPUT_LEN];
  68. char mail_buf[MAIL_INPUT_LEN];
  69. char phone_buf[PHONE_INPUT_LEN];
  70. char big_buf[BIG_INPUT_LEN];
  71. char small_buf1[SMALL_INPUT_LEN];
  72. char small_buf2[SMALL_INPUT_LEN];
  73. char save_buf[BIG_INPUT_LEN];
  74. } NfcMaker;
  75. typedef enum {
  76. NfcMakerViewSubmenu,
  77. NfcMakerViewTextInput,
  78. NfcMakerViewByteInput,
  79. NfcMakerViewPopup,
  80. } NfcMakerView;