-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathseader_i.h
159 lines (125 loc) · 3.74 KB
/
seader_i.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#pragma once
#define ASN_EMIT_DEBUG 0
#include <stdlib.h> // malloc
#include <stdint.h> // uint32_t
#include <stdarg.h> // __VA_ARGS__
#include <string.h>
#include <stdio.h>
#include <furi.h>
#include <furi_hal.h>
#include <gui/gui.h>
#include <gui/view_dispatcher.h>
#include <gui/scene_manager.h>
#include <notification/notification_messages.h>
#include <seader_icons.h>
#include <gui/modules/submenu.h>
#include <gui/modules/popup.h>
#include <gui/modules/loading.h>
#include <gui/modules/text_input.h>
#include <gui/modules/text_box.h>
#include <gui/modules/widget.h>
#include <input/input.h>
#include <lib/nfc/nfc.h>
#include <nfc/nfc_poller.h>
#include <nfc/nfc_device.h>
#include <nfc/helpers/nfc_data_generator.h>
// ASN1
#include <asn_system.h>
#include <asn_internal.h>
#include <asn_codecs_prim.h>
#include <asn_codecs.h>
#include <asn_application.h>
#include <Payload.h>
#include <FrameProtocol.h>
#include "plugin/interface.h"
#include <flipper_application/flipper_application.h>
#include <flipper_application/plugins/plugin_manager.h>
#include <loader/firmware_api/firmware_api.h>
#include "protocol/picopass_poller.h"
#include "scenes/seader_scene.h"
#include "seader_bridge.h"
#include "seader.h"
#include "ccid.h"
#include "uart.h"
#include "lrc.h"
#include "t_1.h"
#include "seader_worker.h"
#include "seader_credential.h"
#include "apdu_log.h"
#define WORKER_ALL_RX_EVENTS \
(WorkerEvtStop | WorkerEvtRxDone | WorkerEvtCfgChange | WorkerEvtLineCfgSet | \
WorkerEvtCtrlLineSet | WorkerEvtSamTxComplete)
#define WORKER_ALL_TX_EVENTS (WorkerEvtTxStop | WorkerEvtSamRx)
#define SEADER_TEXT_STORE_SIZE 128
enum SeaderCustomEvent {
// Reserve first 100 events for button types and indexes, starting from 0
SeaderCustomEventReserved = 100,
SeaderCustomEventViewExit,
SeaderCustomEventWorkerExit,
SeaderCustomEventByteInputDone,
SeaderCustomEventTextInputDone,
SeaderCustomEventPollerDetect,
SeaderCustomEventPollerSuccess,
};
typedef enum {
WorkerEvtStop = (1 << 0),
WorkerEvtRxDone = (1 << 1),
WorkerEvtTxStop = (1 << 2),
WorkerEvtSamRx = (1 << 3),
WorkerEvtSamTxComplete = (1 << 4),
WorkerEvtCfgChange = (1 << 5),
WorkerEvtLineCfgSet = (1 << 6),
WorkerEvtCtrlLineSet = (1 << 7),
} WorkerEvtFlags;
typedef struct {
uint16_t total_lines;
uint16_t current_line;
} SeaderAPDURunnerContext;
struct Seader {
bool revert_power;
bool is_debug_enabled;
SeaderWorker* worker;
ViewDispatcher* view_dispatcher;
Gui* gui;
NotificationApp* notifications;
SceneManager* scene_manager;
SeaderUartBridge* uart;
SeaderCredential* credential;
SamCommand_PR samCommand;
char text_store[SEADER_TEXT_STORE_SIZE + 1];
FuriString* text_box_store;
// Common Views
Submenu* submenu;
Popup* popup;
Loading* loading;
TextInput* text_input;
TextBox* text_box;
Widget* widget;
Nfc* nfc;
NfcPoller* poller;
PicopassPoller* picopass_poller;
NfcDevice* nfc_device;
PluginManager* plugin_manager;
PluginWiegand* plugin_wiegand;
APDULog* apdu_log;
SeaderAPDURunnerContext apdu_runner_ctx;
};
struct SeaderPollerContainer {
Iso14443_4aPoller* iso14443_4a_poller;
MfClassicPoller* mfc_poller;
PicopassPoller* picopass_poller;
};
typedef enum {
SeaderViewMenu,
SeaderViewPopup,
SeaderViewLoading,
SeaderViewTextInput,
SeaderViewTextBox,
SeaderViewWidget,
SeaderViewUart,
} SeaderView;
void seader_text_store_set(Seader* seader, const char* text, ...);
void seader_text_store_clear(Seader* seader);
void seader_blink_start(Seader* seader);
void seader_blink_stop(Seader* seader);
void seader_show_loading_popup(void* context, bool show);