rfid / subghz modified for sfw_mode support

This commit is contained in:
jbohack
2022-12-30 15:33:36 -05:00
parent 83c0f941df
commit ce9db8691f
10 changed files with 80 additions and 10 deletions

View File

@@ -1,5 +1,6 @@
#include "../lfrfid_i.h" #include "../lfrfid_i.h"
#include "../helpers/rfid_writer.h" #include "../helpers/rfid_writer.h"
#include "../../../settings/desktop_settings/desktop_settings_app.h"
static void writer_initialize(T55xxTiming* t55xxtiming) { static void writer_initialize(T55xxTiming* t55xxtiming) {
t55xxtiming->wait_time = 400; t55xxtiming->wait_time = 400;
@@ -14,6 +15,9 @@ static void lfrfid_clear_t5577_password_and_config_to_EM(LfRfid* app) {
T55xxTiming* t55xxtiming = malloc(sizeof(T55xxTiming)); T55xxTiming* t55xxtiming = malloc(sizeof(T55xxTiming));
Popup* popup = app->popup; Popup* popup = app->popup;
char curr_buf[32] = {}; char curr_buf[32] = {};
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
DESKTOP_SETTINGS_LOAD(settings);
//TODO: use .txt file in resourses for passwords. //TODO: use .txt file in resourses for passwords.
const uint32_t default_passwords[] = { const uint32_t default_passwords[] = {
0x51243648, 0x000D8787, 0x19920427, 0x50524F58, 0xF9DCEBA0, 0x65857569, 0x05D73B9F, 0x51243648, 0x000D8787, 0x19920427, 0x50524F58, 0xF9DCEBA0, 0x65857569, 0x05D73B9F,
@@ -41,7 +45,12 @@ static void lfrfid_clear_t5577_password_and_config_to_EM(LfRfid* app) {
writer_initialize(t55xxtiming); writer_initialize(t55xxtiming);
popup_set_header(popup, "Removing\npassword", 90, 36, AlignCenter, AlignCenter); popup_set_header(popup, "Removing\npassword", 90, 36, AlignCenter, AlignCenter);
if (settings->sfw_mode) {
popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61_sfw);
}
else {
popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61); popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61);
}
popup_set_text(popup, curr_buf, 90, 56, AlignCenter, AlignCenter); popup_set_text(popup, curr_buf, 90, 56, AlignCenter, AlignCenter);
notification_message(app->notifications, &sequence_blink_start_magenta); notification_message(app->notifications, &sequence_blink_start_magenta);
@@ -59,17 +68,25 @@ static void lfrfid_clear_t5577_password_and_config_to_EM(LfRfid* app) {
notification_message(app->notifications, &sequence_blink_stop); notification_message(app->notifications, &sequence_blink_stop);
popup_reset(app->popup); popup_reset(app->popup);
free(t55xxtiming); free(t55xxtiming);
free(settings);
} }
void lfrfid_scene_clear_t5577_on_enter(void* context) { void lfrfid_scene_clear_t5577_on_enter(void* context) {
LfRfid* app = context; LfRfid* app = context;
Popup* popup = app->popup; Popup* popup = app->popup;
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
DESKTOP_SETTINGS_LOAD(settings);
lfrfid_clear_t5577_password_and_config_to_EM(app); lfrfid_clear_t5577_password_and_config_to_EM(app);
notification_message(app->notifications, &sequence_success); notification_message(app->notifications, &sequence_success);
popup_set_header(popup, "Done!", 94, 10, AlignCenter, AlignTop); popup_set_header(popup, "Done!", 94, 10, AlignCenter, AlignTop);
if (settings->sfw_mode) {
popup_set_icon(popup, 0, 7, &I_RFIDDolphinSuccess_108x57_sfw);
}
else {
popup_set_icon(popup, 0, 7, &I_RFIDDolphinSuccess_108x57); popup_set_icon(popup, 0, 7, &I_RFIDDolphinSuccess_108x57);
}
popup_set_context(popup, app); popup_set_context(popup, app);
popup_set_callback(popup, lfrfid_popup_timeout_callback); popup_set_callback(popup, lfrfid_popup_timeout_callback);
popup_set_timeout(popup, 1500); popup_set_timeout(popup, 1500);
@@ -77,6 +94,7 @@ void lfrfid_scene_clear_t5577_on_enter(void* context) {
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup); view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup);
notification_message_block(app->notifications, &sequence_set_green_255); notification_message_block(app->notifications, &sequence_set_green_255);
free(settings);
} }
bool lfrfid_scene_clear_t5577_on_event(void* context, SceneManagerEvent event) { bool lfrfid_scene_clear_t5577_on_event(void* context, SceneManagerEvent event) {

View File

@@ -1,8 +1,11 @@
#include "../lfrfid_i.h" #include "../lfrfid_i.h"
#include "../../../settings/desktop_settings/desktop_settings_app.h"
void lfrfid_scene_emulate_on_enter(void* context) { void lfrfid_scene_emulate_on_enter(void* context) {
LfRfid* app = context; LfRfid* app = context;
Popup* popup = app->popup; Popup* popup = app->popup;
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
DESKTOP_SETTINGS_LOAD(settings);
popup_set_header(popup, "Emulating", 89, 30, AlignCenter, AlignTop); popup_set_header(popup, "Emulating", 89, 30, AlignCenter, AlignTop);
if(!furi_string_empty(app->file_name)) { if(!furi_string_empty(app->file_name)) {
@@ -16,13 +19,19 @@ void lfrfid_scene_emulate_on_enter(void* context) {
AlignCenter, AlignCenter,
AlignTop); AlignTop);
} }
if (settings->sfw_mode) {
popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61_sfw);
}
else {
popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61); popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61);
}
lfrfid_worker_start_thread(app->lfworker); lfrfid_worker_start_thread(app->lfworker);
lfrfid_worker_emulate_start(app->lfworker, (LFRFIDProtocol)app->protocol_id); lfrfid_worker_emulate_start(app->lfworker, (LFRFIDProtocol)app->protocol_id);
notification_message(app->notifications, &sequence_blink_start_magenta); notification_message(app->notifications, &sequence_blink_start_magenta);
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup); view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup);
free(settings);
} }
bool lfrfid_scene_emulate_on_event(void* context, SceneManagerEvent event) { bool lfrfid_scene_emulate_on_event(void* context, SceneManagerEvent event) {

View File

@@ -1,4 +1,5 @@
#include "../lfrfid_i.h" #include "../lfrfid_i.h"
#include "../../../settings/desktop_settings/desktop_settings_app.h"
#define RAW_READ_TIME 5000 #define RAW_READ_TIME 5000
@@ -28,12 +29,18 @@ static void timer_callback(void* context) {
void lfrfid_scene_raw_read_on_enter(void* context) { void lfrfid_scene_raw_read_on_enter(void* context) {
LfRfid* app = context; LfRfid* app = context;
Popup* popup = app->popup; Popup* popup = app->popup;
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
DESKTOP_SETTINGS_LOAD(settings);
LfRfidReadRawState* state = malloc(sizeof(LfRfidReadRawState)); LfRfidReadRawState* state = malloc(sizeof(LfRfidReadRawState));
scene_manager_set_scene_state(app->scene_manager, LfRfidSceneRawRead, (uint32_t)state); scene_manager_set_scene_state(app->scene_manager, LfRfidSceneRawRead, (uint32_t)state);
state->string_file_name = furi_string_alloc(); state->string_file_name = furi_string_alloc();
if (settings->sfw_mode) {
popup_set_icon(popup, 0, 3, &I_RFIDDolphinReceive_97x61_sfw);
}
else {
popup_set_icon(popup, 0, 3, &I_RFIDDolphinReceive_97x61); popup_set_icon(popup, 0, 3, &I_RFIDDolphinReceive_97x61);
}
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup); view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup);
lfrfid_worker_start_thread(app->lfworker); lfrfid_worker_start_thread(app->lfworker);
lfrfid_make_app_folder(app); lfrfid_make_app_folder(app);
@@ -58,6 +65,7 @@ void lfrfid_scene_raw_read_on_enter(void* context) {
state->is_psk = false; state->is_psk = false;
state->error = false; state->error = false;
free(settings);
} }
bool lfrfid_scene_raw_read_on_event(void* context, SceneManagerEvent event) { bool lfrfid_scene_raw_read_on_event(void* context, SceneManagerEvent event) {

View File

@@ -1,18 +1,27 @@
#include "../lfrfid_i.h" #include "../lfrfid_i.h"
#include "../../../settings/desktop_settings/desktop_settings_app.h"
void lfrfid_scene_rpc_on_enter(void* context) { void lfrfid_scene_rpc_on_enter(void* context) {
LfRfid* app = context; LfRfid* app = context;
Popup* popup = app->popup; Popup* popup = app->popup;
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
DESKTOP_SETTINGS_LOAD(settings);
popup_set_header(popup, "LF RFID", 89, 42, AlignCenter, AlignBottom); popup_set_header(popup, "LF RFID", 89, 42, AlignCenter, AlignBottom);
popup_set_text(popup, "RPC mode", 89, 44, AlignCenter, AlignTop); popup_set_text(popup, "RPC mode", 89, 44, AlignCenter, AlignTop);
if (settings->sfw_mode) {
popup_set_icon(popup, 0, 12, &I_RFIDDolphinSend_97x61_sfw);
}
else {
popup_set_icon(popup, 0, 12, &I_RFIDDolphinSend_97x61); popup_set_icon(popup, 0, 12, &I_RFIDDolphinSend_97x61);
}
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup); view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup);
notification_message(app->notifications, &sequence_display_backlight_on); notification_message(app->notifications, &sequence_display_backlight_on);
app->rpc_state = LfRfidRpcStateIdle; app->rpc_state = LfRfidRpcStateIdle;
free(settings);
} }
bool lfrfid_scene_rpc_on_event(void* context, SceneManagerEvent event) { bool lfrfid_scene_rpc_on_event(void* context, SceneManagerEvent event) {

View File

@@ -1,4 +1,5 @@
#include "../lfrfid_i.h" #include "../lfrfid_i.h"
#include "../../../settings/desktop_settings/desktop_settings_app.h"
static void lfrfid_write_callback(LFRFIDWorkerWriteResult result, void* context) { static void lfrfid_write_callback(LFRFIDWorkerWriteResult result, void* context) {
LfRfid* app = context; LfRfid* app = context;
@@ -20,6 +21,8 @@ static void lfrfid_write_callback(LFRFIDWorkerWriteResult result, void* context)
void lfrfid_scene_write_on_enter(void* context) { void lfrfid_scene_write_on_enter(void* context) {
LfRfid* app = context; LfRfid* app = context;
Popup* popup = app->popup; Popup* popup = app->popup;
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
DESKTOP_SETTINGS_LOAD(settings);
popup_set_header(popup, "Writing", 89, 30, AlignCenter, AlignTop); popup_set_header(popup, "Writing", 89, 30, AlignCenter, AlignTop);
if(!furi_string_empty(app->file_name)) { if(!furi_string_empty(app->file_name)) {
@@ -33,7 +36,12 @@ void lfrfid_scene_write_on_enter(void* context) {
AlignCenter, AlignCenter,
AlignTop); AlignTop);
} }
if (settings->sfw_mode) {
popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61_sfw);
}
else {
popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61); popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61);
}
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup); view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup);
@@ -44,6 +52,7 @@ void lfrfid_scene_write_on_enter(void* context) {
lfrfid_worker_write_start( lfrfid_worker_write_start(
app->lfworker, (LFRFIDProtocol)app->protocol_id, lfrfid_write_callback, app); app->lfworker, (LFRFIDProtocol)app->protocol_id, lfrfid_write_callback, app);
notification_message(app->notifications, &sequence_blink_start_magenta); notification_message(app->notifications, &sequence_blink_start_magenta);
free(settings);
} }
bool lfrfid_scene_write_on_event(void* context, SceneManagerEvent event) { bool lfrfid_scene_write_on_event(void* context, SceneManagerEvent event) {

View File

@@ -1,11 +1,19 @@
#include "../lfrfid_i.h" #include "../lfrfid_i.h"
#include "../../../settings/desktop_settings/desktop_settings_app.h"
void lfrfid_scene_write_success_on_enter(void* context) { void lfrfid_scene_write_success_on_enter(void* context) {
LfRfid* app = context; LfRfid* app = context;
Popup* popup = app->popup; Popup* popup = app->popup;
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
DESKTOP_SETTINGS_LOAD(settings);
popup_set_header(popup, "Successfully\nwritten!", 94, 3, AlignCenter, AlignTop); popup_set_header(popup, "Successfully\nwritten!", 94, 3, AlignCenter, AlignTop);
if (settings->sfw_mode) {
popup_set_icon(popup, 0, 6, &I_RFIDDolphinSuccess_108x57_sfw);
}
else {
popup_set_icon(popup, 0, 6, &I_RFIDDolphinSuccess_108x57); popup_set_icon(popup, 0, 6, &I_RFIDDolphinSuccess_108x57);
}
popup_set_context(popup, app); popup_set_context(popup, app);
popup_set_callback(popup, lfrfid_popup_timeout_callback); popup_set_callback(popup, lfrfid_popup_timeout_callback);
popup_set_timeout(popup, 1500); popup_set_timeout(popup, 1500);
@@ -13,6 +21,7 @@ void lfrfid_scene_write_success_on_enter(void* context) {
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup); view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup);
notification_message_block(app->notifications, &sequence_set_green_255); notification_message_block(app->notifications, &sequence_set_green_255);
free(settings);
} }
bool lfrfid_scene_write_success_on_event(void* context, SceneManagerEvent event) { bool lfrfid_scene_write_success_on_event(void* context, SceneManagerEvent event) {

View File

@@ -1,6 +1,7 @@
#include "../subghz_i.h" #include "../subghz_i.h"
#include <lib/subghz/protocols/keeloq.h> #include <lib/subghz/protocols/keeloq.h>
#include <lib/subghz/protocols/star_line.h> #include <lib/subghz/protocols/star_line.h>
#include "../../../settings/desktop_settings/desktop_settings_app.h"
typedef enum { typedef enum {
SubGhzRpcStateIdle, SubGhzRpcStateIdle,
@@ -10,17 +11,24 @@ typedef enum {
void subghz_scene_rpc_on_enter(void* context) { void subghz_scene_rpc_on_enter(void* context) {
SubGhz* subghz = context; SubGhz* subghz = context;
Popup* popup = subghz->popup; Popup* popup = subghz->popup;
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
DESKTOP_SETTINGS_LOAD(settings);
popup_set_header(popup, "Sub-GHz", 89, 42, AlignCenter, AlignBottom); popup_set_header(popup, "Sub-GHz", 89, 42, AlignCenter, AlignBottom);
popup_set_text(popup, "RPC mode", 89, 44, AlignCenter, AlignTop); popup_set_text(popup, "RPC mode", 89, 44, AlignCenter, AlignTop);
if (settings->sfw_mode) {
popup_set_icon(popup, 0, 12, &I_RFIDDolphinSend_97x61_sfw);
}
else {
popup_set_icon(popup, 0, 12, &I_RFIDDolphinSend_97x61); popup_set_icon(popup, 0, 12, &I_RFIDDolphinSend_97x61);
}
view_dispatcher_switch_to_view(subghz->view_dispatcher, SubGhzViewIdPopup); view_dispatcher_switch_to_view(subghz->view_dispatcher, SubGhzViewIdPopup);
scene_manager_set_scene_state(subghz->scene_manager, SubGhzSceneRpc, SubGhzRpcStateIdle); scene_manager_set_scene_state(subghz->scene_manager, SubGhzSceneRpc, SubGhzRpcStateIdle);
notification_message(subghz->notifications, &sequence_display_backlight_on); notification_message(subghz->notifications, &sequence_display_backlight_on);
free(settings);
} }
bool subghz_scene_rpc_on_event(void* context, SceneManagerEvent event) { bool subghz_scene_rpc_on_event(void* context, SceneManagerEvent event) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB