Skip to content

Commit bce0224

Browse files
committed
move base pack here
0 parents  commit bce0224

19 files changed

+646
-0
lines changed

application.fam

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
App(
2+
appid="nfc_rfid_detector",
3+
name="NFC/RFID detector",
4+
apptype=FlipperAppType.EXTERNAL,
5+
targets=["f7"],
6+
entry_point="nfc_rfid_detector_app",
7+
requires=["gui"],
8+
stack_size=4 * 1024,
9+
order=50,
10+
fap_icon="nfc_rfid_detector_10px.png",
11+
fap_category="Tools",
12+
fap_icon_assets="images",
13+
)

helpers/nfc_rfid_detector_event.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#pragma once
2+
3+
typedef enum {
4+
//NfcRfidDetectorCustomEvent
5+
NfcRfidDetectorCustomEventStartId = 100,
6+
7+
} NfcRfidDetectorCustomEvent;

helpers/nfc_rfid_detector_types.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#pragma once
2+
3+
#include <furi.h>
4+
#include <furi_hal.h>
5+
6+
#define NFC_RFID_DETECTOR_VERSION_APP "0.1"
7+
#define NFC_RFID_DETECTOR_DEVELOPED "SkorP"
8+
#define NFC_RFID_DETECTOR_GITHUB "https://github.com/flipperdevices/flipperzero-firmware"
9+
10+
typedef enum {
11+
NfcRfidDetectorViewVariableItemList,
12+
NfcRfidDetectorViewSubmenu,
13+
NfcRfidDetectorViewFieldPresence,
14+
NfcRfidDetectorViewWidget,
15+
} NfcRfidDetectorView;

images/Modern_reader_18x34.png

3.58 KB
Loading

images/Move_flipper_26x39.png

3.61 KB
Loading

images/NFC_detect_45x30.png

168 Bytes
Loading

images/Rfid_detect_45x30.png

158 Bytes
Loading

nfc_rfid_detector_10px.png

124 Bytes
Loading

nfc_rfid_detector_app.c

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#include "nfc_rfid_detector_app_i.h"
2+
3+
#include <furi.h>
4+
#include <furi_hal.h>
5+
6+
static bool nfc_rfid_detector_app_custom_event_callback(void* context, uint32_t event) {
7+
furi_assert(context);
8+
NfcRfidDetectorApp* app = context;
9+
return scene_manager_handle_custom_event(app->scene_manager, event);
10+
}
11+
12+
static bool nfc_rfid_detector_app_back_event_callback(void* context) {
13+
furi_assert(context);
14+
NfcRfidDetectorApp* app = context;
15+
return scene_manager_handle_back_event(app->scene_manager);
16+
}
17+
18+
static void nfc_rfid_detector_app_tick_event_callback(void* context) {
19+
furi_assert(context);
20+
NfcRfidDetectorApp* app = context;
21+
scene_manager_handle_tick_event(app->scene_manager);
22+
}
23+
24+
NfcRfidDetectorApp* nfc_rfid_detector_app_alloc() {
25+
NfcRfidDetectorApp* app = malloc(sizeof(NfcRfidDetectorApp));
26+
27+
// GUI
28+
app->gui = furi_record_open(RECORD_GUI);
29+
30+
// View Dispatcher
31+
app->view_dispatcher = view_dispatcher_alloc();
32+
app->scene_manager = scene_manager_alloc(&nfc_rfid_detector_scene_handlers, app);
33+
view_dispatcher_enable_queue(app->view_dispatcher);
34+
35+
view_dispatcher_set_event_callback_context(app->view_dispatcher, app);
36+
view_dispatcher_set_custom_event_callback(
37+
app->view_dispatcher, nfc_rfid_detector_app_custom_event_callback);
38+
view_dispatcher_set_navigation_event_callback(
39+
app->view_dispatcher, nfc_rfid_detector_app_back_event_callback);
40+
view_dispatcher_set_tick_event_callback(
41+
app->view_dispatcher, nfc_rfid_detector_app_tick_event_callback, 100);
42+
43+
view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
44+
45+
// Open Notification record
46+
app->notifications = furi_record_open(RECORD_NOTIFICATION);
47+
48+
// SubMenu
49+
app->submenu = submenu_alloc();
50+
view_dispatcher_add_view(
51+
app->view_dispatcher, NfcRfidDetectorViewSubmenu, submenu_get_view(app->submenu));
52+
53+
// Widget
54+
app->widget = widget_alloc();
55+
view_dispatcher_add_view(
56+
app->view_dispatcher, NfcRfidDetectorViewWidget, widget_get_view(app->widget));
57+
58+
// Field Presence
59+
app->nfc_rfid_detector_field_presence = nfc_rfid_detector_view_field_presence_alloc();
60+
view_dispatcher_add_view(
61+
app->view_dispatcher,
62+
NfcRfidDetectorViewFieldPresence,
63+
nfc_rfid_detector_view_field_presence_get_view(app->nfc_rfid_detector_field_presence));
64+
65+
scene_manager_next_scene(app->scene_manager, NfcRfidDetectorSceneStart);
66+
67+
return app;
68+
}
69+
70+
void nfc_rfid_detector_app_free(NfcRfidDetectorApp* app) {
71+
furi_assert(app);
72+
73+
// Submenu
74+
view_dispatcher_remove_view(app->view_dispatcher, NfcRfidDetectorViewSubmenu);
75+
submenu_free(app->submenu);
76+
77+
// Widget
78+
view_dispatcher_remove_view(app->view_dispatcher, NfcRfidDetectorViewWidget);
79+
widget_free(app->widget);
80+
81+
// Field Presence
82+
view_dispatcher_remove_view(app->view_dispatcher, NfcRfidDetectorViewFieldPresence);
83+
nfc_rfid_detector_view_field_presence_free(app->nfc_rfid_detector_field_presence);
84+
85+
// View dispatcher
86+
view_dispatcher_free(app->view_dispatcher);
87+
scene_manager_free(app->scene_manager);
88+
89+
// Notifications
90+
furi_record_close(RECORD_NOTIFICATION);
91+
app->notifications = NULL;
92+
93+
// Close records
94+
furi_record_close(RECORD_GUI);
95+
96+
free(app);
97+
}
98+
99+
int32_t nfc_rfid_detector_app(void* p) {
100+
UNUSED(p);
101+
NfcRfidDetectorApp* nfc_rfid_detector_app = nfc_rfid_detector_app_alloc();
102+
103+
view_dispatcher_run(nfc_rfid_detector_app->view_dispatcher);
104+
105+
nfc_rfid_detector_app_free(nfc_rfid_detector_app);
106+
107+
return 0;
108+
}

nfc_rfid_detector_app_i.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#include "nfc_rfid_detector_app_i.h"
2+
3+
#include <furi.h>
4+
5+
#define TAG "NfcRfidDetector"
6+
7+
void nfc_rfid_detector_app_field_presence_start(NfcRfidDetectorApp* app) {
8+
furi_assert(app);
9+
10+
// start the field presence rfid detection
11+
furi_hal_rfid_field_detect_start();
12+
13+
// start the field presence nfc detection
14+
furi_hal_nfc_exit_sleep();
15+
furi_hal_nfc_field_detect_start();
16+
}
17+
18+
void nfc_rfid_detector_app_field_presence_stop(NfcRfidDetectorApp* app) {
19+
furi_assert(app);
20+
21+
// stop the field presence rfid detection
22+
furi_hal_rfid_field_detect_stop();
23+
24+
// stop the field presence nfc detection
25+
furi_hal_nfc_start_sleep();
26+
}
27+
28+
bool nfc_rfid_detector_app_field_presence_is_nfc(NfcRfidDetectorApp* app) {
29+
furi_assert(app);
30+
31+
// check if the field presence is nfc
32+
return furi_hal_nfc_field_is_present();
33+
}
34+
35+
bool nfc_rfid_detector_app_field_presence_is_rfid(NfcRfidDetectorApp* app, uint32_t* frequency) {
36+
furi_assert(app);
37+
38+
// check if the field presence is rfid
39+
return furi_hal_rfid_field_is_present(frequency);
40+
}

0 commit comments

Comments
 (0)