-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
nfc_playlist.h
85 lines (70 loc) · 2.37 KB
/
nfc_playlist.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#pragma once
#include <furi.h>
#include <furi_hal.h>
#include <string.h>
#include "nfc_playlist_icons.h"
#include <gui/gui.h>
#include <gui/view_dispatcher.h>
#include <gui/scene_manager.h>
#include <gui/modules/popup.h>
#include <gui/modules/variable_item_list.h>
#include <gui/modules/submenu.h>
#include <gui/modules/file_browser.h>
#include <gui/modules/text_input.h>
#include <gui/modules/widget.h>
#include <gui/modules/widget_elements/widget_element.h>
#include <notification/notification_messages.h>
#include <storage/storage.h>
#include <toolbox/stream/stream.h>
#include <toolbox/stream/file_stream.h>
#include <toolbox/path.h>
#include "lib/emulation_worker/nfc_playlist_emulation_worker.h"
#include "scenes/nfc_playlist_scene.h"
#define PLAYLIST_LOCATION "/ext/apps_data/nfc_playlist/"
#define PLAYLIST_DIR "/ext/apps_data/nfc_playlist"
#define NFC_ITEM_LOCATION "/ext/nfc/"
#define MAX_PLAYLIST_NAME_LEN 50
typedef enum {
NfcPlaylistView_Submenu,
NfcPlaylistView_Popup,
NfcPlaylistView_Widget,
NfcPlaylistView_VariableItemList,
NfcPlaylistView_FileBrowser,
NfcPlaylistView_TextInput
} NfcPlaylistViews;
typedef struct {
FuriString* playlist_path;
uint8_t playlist_length;
uint8_t emulate_timeout;
uint8_t emulate_delay;
bool emulate_led_indicator;
bool skip_error;
} NfcPlaylistSettings;
typedef struct {
SceneManager* scene_manager;
ViewDispatcher* view_dispatcher;
Submenu* submenu;
Popup* popup;
Widget* widget;
VariableItemList* variable_item_list;
FileBrowser* file_browser;
FuriString* file_browser_output;
TextInput* text_input;
char* text_input_output;
NotificationApp* notification;
FuriThread* thread;
NfcPlaylistEmulationWorker* nfc_playlist_emulation_worker;
NfcPlaylistSettings settings;
} NfcPlaylist;
static const int options_emulate_timeout[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
static const int default_emulate_timeout = 4;
static const int options_emulate_delay[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
static const int default_emulate_delay = 0;
static const bool default_emulate_led_indicator = true;
static const bool default_skip_error = false;
typedef enum NfcPlaylistLedState {
NfcPlaylistLedState_Normal,
NfcPlaylistLedState_Error
} NfcPlaylistLedState;
void start_blink(NfcPlaylist* nfc_playlist, int state);
void stop_blink(NfcPlaylist* nfc_playlist);